2026-01-14 12:31:40 +00:00
# tg-get-flow-blueprint
2025-07-03 14:58:32 +01:00
2026-01-14 12:31:40 +00:00
Retrieves and displays a flow blueprint definition in JSON format.
2025-07-03 14:58:32 +01:00
## Synopsis
```bash
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n CLASS_NAME [options]
2025-07-03 14:58:32 +01:00
```
## Description
2026-01-14 12:31:40 +00:00
The `tg-get-flow-blueprint` command retrieves a stored flow blueprint definition from TrustGraph and displays it in formatted JSON. This is useful for examining flow blueprint configurations, creating backups, or preparing to modify existing flow blueprintes.
2025-07-03 14:58:32 +01:00
2026-01-14 12:31:40 +00:00
The output can be saved to files for version control, documentation, or as input for creating new flow blueprintes with `tg-put-flow-blueprint` .
2025-07-03 14:58:32 +01:00
## Options
### Required Arguments
2026-01-14 12:31:40 +00:00
- `-n, --blueprint-name CLASS_NAME` : Name of the flow blueprint to retrieve
2025-07-03 14:58:32 +01:00
### Optional Arguments
- `-u, --api-url URL` : TrustGraph API URL (default: `$TRUSTGRAPH_URL` or `http://localhost:8088/` )
## Examples
2026-01-14 12:31:40 +00:00
### Display Flow Blueprint Definition
2025-07-03 14:58:32 +01:00
```bash
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "document-processing"
2025-07-03 14:58:32 +01:00
```
2026-01-14 12:31:40 +00:00
### Save Flow Blueprint to File
2025-07-03 14:58:32 +01:00
```bash
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "production-flow" > production-flow-backup.json
2025-07-03 14:58:32 +01:00
```
2026-01-14 12:31:40 +00:00
### Compare Flow Blueprintes
2025-07-03 14:58:32 +01:00
```bash
2026-01-14 12:31:40 +00:00
# Get multiple flow blueprintes for comparison
tg-get-flow-blueprint -n "dev-flow" > dev-flow.json
tg-get-flow-blueprint -n "prod-flow" > prod-flow.json
2025-07-03 14:58:32 +01:00
diff dev-flow.json prod-flow.json
```
### Using Custom API URL
```bash
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "remote-flow" -u http://production:8088/
2025-07-03 14:58:32 +01:00
```
## Output Format
2026-01-14 12:31:40 +00:00
The command outputs the flow blueprint definition in formatted JSON:
2025-07-03 14:58:32 +01:00
```json
{
"description": "Document processing and analysis flow",
"interfaces": {
"agent": {
"request": "non-persistent://tg/request/agent:doc-proc",
"response": "non-persistent://tg/response/agent:doc-proc"
},
"document-rag": {
"request": "non-persistent://tg/request/document-rag:doc-proc",
"response": "non-persistent://tg/response/document-rag:doc-proc"
},
"text-load": "persistent://tg/flow/text-document-load:doc-proc",
"document-load": "persistent://tg/flow/document-load:doc-proc",
"triples-store": "persistent://tg/flow/triples-store:doc-proc"
},
"tags": ["production", "document-processing"]
}
```
### Key Components
#### Description
2026-01-14 12:31:40 +00:00
Human-readable description of the flow blueprint purpose and capabilities.
2025-07-03 14:58:32 +01:00
#### Interfaces
Service definitions showing:
- **Request/Response Services**: Services with both request and response queues
- **Fire-and-Forget Services**: Services with only input queues
#### Tags (Optional)
2026-01-14 12:31:40 +00:00
Categorization tags for organizing flow blueprintes.
2025-07-03 14:58:32 +01:00
## Prerequisites
2026-01-14 12:31:40 +00:00
### Flow Blueprint Must Exist
Verify the flow blueprint exists before retrieval:
2025-07-03 14:58:32 +01:00
```bash
2026-01-14 12:31:40 +00:00
# Check available flow blueprintes
tg-show-flow-blueprints
2025-07-03 14:58:32 +01:00
# Look for specific class
2026-01-14 12:31:40 +00:00
tg-show-flow-blueprints | grep "target-class"
2025-07-03 14:58:32 +01:00
```
## Error Handling
2026-01-14 12:31:40 +00:00
### Flow Blueprint Not Found
2025-07-03 14:58:32 +01:00
```bash
2026-01-14 12:31:40 +00:00
Exception: Flow blueprint 'invalid-class' not found
2025-07-03 14:58:32 +01:00
```
2026-01-14 12:31:40 +00:00
**Solution**: Check available classes with `tg-show-flow-blueprints` and verify the class name.
2025-07-03 14:58:32 +01:00
### Connection Errors
```bash
Exception: Connection refused
```
**Solution**: Check the API URL and ensure TrustGraph is running.
### Permission Errors
```bash
2026-01-14 12:31:40 +00:00
Exception: Access denied to flow blueprint
2025-07-03 14:58:32 +01:00
```
2026-01-14 12:31:40 +00:00
**Solution**: Verify user permissions for accessing flow blueprint definitions.
2025-07-03 14:58:32 +01:00
## Use Cases
### Configuration Backup
```bash
2026-01-14 12:31:40 +00:00
# Backup all flow blueprintes
2025-07-03 14:58:32 +01:00
mkdir -p flow-class-backups/$(date +%Y%m%d)
2026-01-14 12:31:40 +00:00
tg-show-flow-blueprints | awk '{print $1}' | while read class; do
2025-07-03 14:58:32 +01:00
if [ "$class" != "flow" ]; then # Skip header
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "$class" > "flow-class-backups/$(date +%Y%m%d)/$class.json"
2025-07-03 14:58:32 +01:00
fi
done
```
2026-01-14 12:31:40 +00:00
### Flow Blueprint Migration
2025-07-03 14:58:32 +01:00
```bash
# Export from source environment
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "production-flow" -u http://source:8088/ > prod-flow.json
2025-07-03 14:58:32 +01:00
# Import to target environment
2026-01-14 12:31:40 +00:00
tg-put-flow-blueprint -n "production-flow" -c "$(cat prod-flow.json)" -u http://target:8088/
2025-07-03 14:58:32 +01:00
```
### Template Creation
```bash
2026-01-14 12:31:40 +00:00
# Get existing flow blueprint as template
tg-get-flow-blueprint -n "base-flow" > template.json
2025-07-03 14:58:32 +01:00
# Modify template and create new class
sed 's/base-flow/new-flow/g' template.json > new-flow.json
2026-01-14 12:31:40 +00:00
tg-put-flow-blueprint -n "custom-flow" -c "$(cat new-flow.json)"
2025-07-03 14:58:32 +01:00
```
### Configuration Analysis
```bash
2026-01-14 12:31:40 +00:00
# Analyze flow blueprint configurations
tg-get-flow-blueprint -n "complex-flow" | jq '.interfaces | keys'
tg-get-flow-blueprint -n "complex-flow" | jq '.interfaces | length'
2025-07-03 14:58:32 +01:00
```
### Version Control Integration
```bash
2026-01-14 12:31:40 +00:00
# Store flow blueprintes in git
2025-07-03 14:58:32 +01:00
mkdir -p flow-classes
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "main-flow" > flow-classes/main-flow.json
2025-07-03 14:58:32 +01:00
git add flow-classes/main-flow.json
git commit -m "Update main-flow configuration"
```
## JSON Processing
### Extract Specific Information
```bash
# Get only interface names
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "my-flow" | jq -r '.interfaces | keys[]'
2025-07-03 14:58:32 +01:00
# Get only description
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "my-flow" | jq -r '.description'
2025-07-03 14:58:32 +01:00
# Get request queues
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "my-flow" | jq -r '.interfaces | to_entries[] | select(.value.request) | .value.request'
2025-07-03 14:58:32 +01:00
```
### Validate Configuration
```bash
# Validate JSON structure
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "my-flow" | jq . > /dev/null & & echo "Valid JSON" || echo "Invalid JSON"
2025-07-03 14:58:32 +01:00
# Check required fields
2026-01-14 12:31:40 +00:00
config=$(tg-get-flow-blueprint -n "my-flow")
2025-07-03 14:58:32 +01:00
echo "$config" | jq -e '.description' > /dev/null || echo "Missing description"
echo "$config" | jq -e '.interfaces' > /dev/null || echo "Missing interfaces"
```
## Integration with Other Commands
2026-01-14 12:31:40 +00:00
### Flow Blueprint Lifecycle
2025-07-03 14:58:32 +01:00
```bash
2026-01-14 12:31:40 +00:00
# 1. Examine existing flow blueprint
tg-get-flow-blueprint -n "old-flow"
2025-07-03 14:58:32 +01:00
# 2. Save backup
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "old-flow" > old-flow-backup.json
2025-07-03 14:58:32 +01:00
# 3. Modify configuration
cp old-flow-backup.json new-flow.json
# Edit new-flow.json as needed
# 4. Upload new version
2026-01-14 12:31:40 +00:00
tg-put-flow-blueprint -n "updated-flow" -c "$(cat new-flow.json)"
2025-07-03 14:58:32 +01:00
2026-01-14 12:31:40 +00:00
# 5. Test new flow blueprint
2025-07-03 14:58:32 +01:00
tg-start-flow -n "updated-flow" -i "test-instance" -d "Testing updated flow"
```
### Bulk Operations
```bash
2026-01-14 12:31:40 +00:00
# Process multiple flow blueprintes
2025-07-03 14:58:32 +01:00
flow_classes=("flow1" "flow2" "flow3")
for class in "${flow_classes[@]}"; do
echo "Processing $class..."
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "$class" > "backup-$class.json"
2025-07-03 14:58:32 +01:00
# Modify configuration
sed 's/old-pattern/new-pattern/g' "backup-$class.json" > "updated-$class.json"
# Upload updated version
2026-01-14 12:31:40 +00:00
tg-put-flow-blueprint -n "$class" -c "$(cat updated-$class.json)"
2025-07-03 14:58:32 +01:00
done
```
## Environment Variables
- `TRUSTGRAPH_URL` : Default API URL
## Related Commands
2026-01-14 12:31:40 +00:00
- [`tg-put-flow-blueprint` ](tg-put-flow-blueprint.md ) - Upload/update flow blueprint definitions
- [`tg-show-flow-blueprints` ](tg-show-flow-blueprints.md ) - List available flow blueprintes
- [`tg-delete-flow-blueprint` ](tg-delete-flow-blueprint.md ) - Remove flow blueprint definitions
2025-07-03 14:58:32 +01:00
- [`tg-start-flow` ](tg-start-flow.md ) - Create flow instances from classes
## API Integration
2026-01-14 12:31:40 +00:00
This command uses the [Flow API ](../apis/api-flow.md ) with the `get-class` operation to retrieve flow blueprint definitions.
2025-07-03 14:58:32 +01:00
## Advanced Usage
### Configuration Diff
```bash
2026-01-14 12:31:40 +00:00
# Compare flow blueprint versions
tg-get-flow-blueprint -n "flow-v1" > v1.json
tg-get-flow-blueprint -n "flow-v2" > v2.json
2025-07-03 14:58:32 +01:00
diff -u v1.json v2.json
```
### Extract Queue Information
```bash
2026-01-14 12:31:40 +00:00
# Get all queue names from flow blueprint
tg-get-flow-blueprint -n "my-flow" | jq -r '
2025-07-03 14:58:32 +01:00
.interfaces |
to_entries[] |
if .value | type == "object" then
.value.request, .value.response
else
.value
end
' | sort | uniq
```
### Configuration Validation Script
```bash
#!/bin/bash
# validate-flow-class.sh
flow_class="$1"
if [ -z "$flow_class" ]; then
2026-01-14 12:31:40 +00:00
echo "Usage: $0 < flow-blueprint-name > "
2025-07-03 14:58:32 +01:00
exit 1
fi
2026-01-14 12:31:40 +00:00
echo "Validating flow blueprint: $flow_class"
2025-07-03 14:58:32 +01:00
# Get configuration
2026-01-14 12:31:40 +00:00
config=$(tg-get-flow-blueprint -n "$flow_class" 2>/dev/null)
2025-07-03 14:58:32 +01:00
if [ $? -ne 0 ]; then
2026-01-14 12:31:40 +00:00
echo "ERROR: Flow blueprint not found"
2025-07-03 14:58:32 +01:00
exit 1
fi
# Validate JSON
echo "$config" | jq . > /dev/null
if [ $? -ne 0 ]; then
echo "ERROR: Invalid JSON structure"
exit 1
fi
# Check required fields
desc=$(echo "$config" | jq -r '.description // empty')
if [ -z "$desc" ]; then
echo "WARNING: Missing description"
fi
interfaces=$(echo "$config" | jq -r '.interfaces // empty')
if [ -z "$interfaces" ] || [ "$interfaces" = "null" ]; then
echo "ERROR: Missing interfaces"
exit 1
fi
2026-01-14 12:31:40 +00:00
echo "Flow blueprint validation passed"
2025-07-03 14:58:32 +01:00
```
## Best Practices
2026-01-14 12:31:40 +00:00
1. **Regular Backups** : Save flow blueprint definitions before modifications
2025-07-03 14:58:32 +01:00
2. **Version Control** : Store configurations in version control systems
2026-01-14 12:31:40 +00:00
3. **Documentation** : Include meaningful descriptions in flow blueprintes
2025-07-03 14:58:32 +01:00
4. **Validation** : Validate JSON structure before using configurations
5. **Template Management** : Use existing classes as templates for new ones
2026-01-14 12:31:40 +00:00
6. **Change Tracking** : Document changes when updating flow blueprintes
2025-07-03 14:58:32 +01:00
## Troubleshooting
### Empty Output
```bash
# If command returns empty output
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "my-flow"
# Check if flow blueprint exists
tg-show-flow-blueprints | grep "my-flow"
2025-07-03 14:58:32 +01:00
```
### Invalid JSON Output
```bash
# If output appears corrupted
2026-01-14 12:31:40 +00:00
tg-get-flow-blueprint -n "my-flow" | jq .
2025-07-03 14:58:32 +01:00
# Should show parsing error if JSON is invalid
```
### Permission Issues
```bash
# If access denied errors occur
# Verify authentication and user permissions
# Contact system administrator if needed
```