Fix config inconsistency (#609)

* Plural/singular confusion in config key

* Flow class vs flow blueprint nomenclature change

* Update docs & CLI to reflect the above
This commit is contained in:
cybermaggedon 2026-01-14 12:31:40 +00:00 committed by GitHub
parent 99f17d1b9d
commit b08db761d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 816 additions and 814 deletions

View file

@ -1,6 +1,6 @@
# TrustGraph Flow API # TrustGraph Flow API
This API provides workflow management for TrustGraph components. It manages flow classes This API provides workflow management for TrustGraph components. It manages flow blueprintes
(workflow templates) and flow instances (active running workflows) that orchestrate (workflow templates) and flow instances (active running workflows) that orchestrate
complex data processing pipelines. complex data processing pipelines.
@ -10,26 +10,26 @@ complex data processing pipelines.
The request contains the following fields: The request contains the following fields:
- `operation`: The operation to perform (see operations below) - `operation`: The operation to perform (see operations below)
- `class_name`: Flow class name (for class operations and start-flow) - `blueprint_name`: Flow blueprint name (for class operations and start-flow)
- `class_definition`: Flow class definition JSON (for put-class) - `class_definition`: Flow blueprint definition JSON (for put-class)
- `description`: Flow description (for start-flow) - `description`: Flow description (for start-flow)
- `flow_id`: Flow instance ID (for flow instance operations) - `flow_id`: Flow instance ID (for flow instance operations)
### Response ### Response
The response contains the following fields: The response contains the following fields:
- `class_names`: Array of flow class names (returned by list-classes) - `blueprint_names`: Array of flow blueprint names (returned by list-classes)
- `flow_ids`: Array of active flow IDs (returned by list-flows) - `flow_ids`: Array of active flow IDs (returned by list-flows)
- `class_definition`: Flow class definition JSON (returned by get-class) - `class_definition`: Flow blueprint definition JSON (returned by get-class)
- `flow`: Flow instance JSON (returned by get-flow) - `flow`: Flow instance JSON (returned by get-flow)
- `description`: Flow description (returned by get-flow) - `description`: Flow description (returned by get-flow)
- `error`: Error information if operation fails - `error`: Error information if operation fails
## Operations ## Operations
### Flow Class Operations ### Flow Blueprint Operations
#### LIST-CLASSES - List All Flow Classes #### LIST-CLASSES - List All Flow Blueprintes
Request: Request:
```json ```json
@ -41,17 +41,17 @@ Request:
Response: Response:
```json ```json
{ {
"class_names": ["pdf-processor", "text-analyzer", "knowledge-extractor"] "blueprint_names": ["pdf-processor", "text-analyzer", "knowledge-extractor"]
} }
``` ```
#### GET-CLASS - Get Flow Class Definition #### GET-CLASS - Get Flow Blueprint Definition
Request: Request:
```json ```json
{ {
"operation": "get-class", "operation": "get-class",
"class_name": "pdf-processor" "blueprint_name": "pdf-processor"
} }
``` ```
@ -62,13 +62,13 @@ Response:
} }
``` ```
#### PUT-CLASS - Create/Update Flow Class #### PUT-CLASS - Create/Update Flow Blueprint
Request: Request:
```json ```json
{ {
"operation": "put-class", "operation": "put-class",
"class_name": "pdf-processor", "blueprint_name": "pdf-processor",
"class_definition": "{\"interfaces\": {\"text-completion\": {\"request\": \"persistent://tg/request/text-completion\", \"response\": \"persistent://tg/response/text-completion\"}}, \"description\": \"PDF processing workflow\"}" "class_definition": "{\"interfaces\": {\"text-completion\": {\"request\": \"persistent://tg/request/text-completion\", \"response\": \"persistent://tg/response/text-completion\"}}, \"description\": \"PDF processing workflow\"}"
} }
``` ```
@ -78,13 +78,13 @@ Response:
{} {}
``` ```
#### DELETE-CLASS - Remove Flow Class #### DELETE-CLASS - Remove Flow Blueprint
Request: Request:
```json ```json
{ {
"operation": "delete-class", "operation": "delete-class",
"class_name": "pdf-processor" "blueprint_name": "pdf-processor"
} }
``` ```
@ -135,7 +135,7 @@ Request:
```json ```json
{ {
"operation": "start-flow", "operation": "start-flow",
"class_name": "pdf-processor", "blueprint_name": "pdf-processor",
"flow_id": "flow-123", "flow_id": "flow-123",
"description": "Processing document batch 1" "description": "Processing document batch 1"
} }
@ -186,7 +186,7 @@ Response:
{ {
"id": "unique-request-id", "id": "unique-request-id",
"response": { "response": {
"class_names": ["pdf-processor", "text-analyzer"] "blueprint_names": ["pdf-processor", "text-analyzer"]
}, },
"complete": true "complete": true
} }
@ -264,11 +264,11 @@ from trustgraph.api.flow import FlowClient
client = FlowClient() client = FlowClient()
# List all flow classes # List all flow blueprintes
classes = await client.list_classes() classes = await client.list_blueprints()
# Get a flow class definition # Get a flow blueprint definition
definition = await client.get_class("pdf-processor") definition = await client.get_blueprint("pdf-processor")
# Start a flow instance # Start a flow instance
await client.start_flow("pdf-processor", "flow-123", "Processing batch 1") await client.start_flow("pdf-processor", "flow-123", "Processing batch 1")
@ -286,8 +286,8 @@ result = await flow.mcp_tool("file-reader", {"path": "/path/to/file.txt"})
## Features ## Features
- **Flow Classes**: Templates that define workflow structure and interfaces - **Flow Blueprintes**: Templates that define workflow structure and interfaces
- **Flow Instances**: Active running workflows based on flow classes - **Flow Instances**: Active running workflows based on flow blueprintes
- **Dynamic Management**: Flows can be started/stopped dynamically - **Dynamic Management**: Flows can be started/stopped dynamically
- **Template Processing**: Uses template replacement for customizing flow instances - **Template Processing**: Uses template replacement for customizing flow instances
- **Integration**: Works with TrustGraph ecosystem for data processing pipelines - **Integration**: Works with TrustGraph ecosystem for data processing pipelines

View file

@ -48,11 +48,11 @@ Most CLI commands support these common options:
- [`tg-show-flows`](tg-show-flows.md) - List all configured flows - [`tg-show-flows`](tg-show-flows.md) - List all configured flows
- [`tg-show-flow-state`](tg-show-flow-state.md) - Show current flow states - [`tg-show-flow-state`](tg-show-flow-state.md) - Show current flow states
**Flow Class Management:** **Flow Blueprint Management:**
- [`tg-put-flow-class`](tg-put-flow-class.md) - Upload/update flow class definition - [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Upload/update flow blueprint definition
- [`tg-get-flow-class`](tg-get-flow-class.md) - Retrieve flow class definition - [`tg-get-flow-blueprint`](tg-get-flow-blueprint.md) - Retrieve flow blueprint definition
- [`tg-delete-flow-class`](tg-delete-flow-class.md) - Remove flow class definition - [`tg-delete-flow-blueprint`](tg-delete-flow-blueprint.md) - Remove flow blueprint definition
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes - [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
### Knowledge Graph Management ### Knowledge Graph Management
@ -115,7 +115,7 @@ Most CLI commands support these common options:
### Basic Document Processing ### Basic Document Processing
```bash ```bash
# Start a flow # Start a flow
tg-start-flow --flow-id my-flow --class-name document-processing tg-start-flow --flow-id my-flow --blueprint-name document-processing
# Load a document # Load a document
tg-load-text --flow-id my-flow --text "Your document content" --title "Test Document" tg-load-text --flow-id my-flow --text "Your document content" --title "Test Document"
@ -138,8 +138,8 @@ tg-show-graph --limit 100
### Flow Management ### Flow Management
```bash ```bash
# Show available flow classes # Show available flow blueprintes
tg-show-flow-classes tg-show-flow-blueprints
# Show running flows # Show running flows
tg-show-flows tg-show-flows

View file

@ -1,24 +1,24 @@
# tg-delete-flow-class # tg-delete-flow-blueprint
Permanently deletes a flow class definition from TrustGraph. Permanently deletes a flow blueprint definition from TrustGraph.
## Synopsis ## Synopsis
```bash ```bash
tg-delete-flow-class -n CLASS_NAME [options] tg-delete-flow-blueprint -n CLASS_NAME [options]
``` ```
## Description ## Description
The `tg-delete-flow-class` command permanently removes a flow class definition from TrustGraph. This operation cannot be undone, so use with caution. The `tg-delete-flow-blueprint` command permanently removes a flow blueprint definition from TrustGraph. This operation cannot be undone, so use with caution.
**⚠️ Warning**: Deleting a flow class that has active flow instances may cause those instances to become unusable. Always check for active flows before deletion. **⚠️ Warning**: Deleting a flow blueprint that has active flow instances may cause those instances to become unusable. Always check for active flows before deletion.
## Options ## Options
### Required Arguments ### Required Arguments
- `-n, --class-name CLASS_NAME`: Name of the flow class to delete - `-n, --blueprint-name CLASS_NAME`: Name of the flow blueprint to delete
### Optional Arguments ### Optional Arguments
@ -26,65 +26,65 @@ The `tg-delete-flow-class` command permanently removes a flow class definition f
## Examples ## Examples
### Delete a Flow Class ### Delete a Flow Blueprint
```bash ```bash
tg-delete-flow-class -n "old-test-flow" tg-delete-flow-blueprint -n "old-test-flow"
``` ```
### Delete with Custom API URL ### Delete with Custom API URL
```bash ```bash
tg-delete-flow-class -n "deprecated-flow" -u http://staging:8088/ tg-delete-flow-blueprint -n "deprecated-flow" -u http://staging:8088/
``` ```
### Safe Deletion Workflow ### Safe Deletion Workflow
```bash ```bash
# 1. Check if flow class exists # 1. Check if flow blueprint exists
tg-show-flow-classes | grep "target-flow" tg-show-flow-blueprints | grep "target-flow"
# 2. Backup the flow class first # 2. Backup the flow blueprint first
tg-get-flow-class -n "target-flow" > backup-target-flow.json tg-get-flow-blueprint -n "target-flow" > backup-target-flow.json
# 3. Check for active flow instances # 3. Check for active flow instances
tg-show-flows | grep "target-flow" tg-show-flows | grep "target-flow"
# 4. Delete the flow class # 4. Delete the flow blueprint
tg-delete-flow-class -n "target-flow" tg-delete-flow-blueprint -n "target-flow"
# 5. Verify deletion # 5. Verify deletion
tg-show-flow-classes | grep "target-flow" || echo "Flow class deleted successfully" tg-show-flow-blueprints | grep "target-flow" || echo "Flow blueprint deleted successfully"
``` ```
## Prerequisites ## Prerequisites
### Flow Class Must Exist ### Flow Blueprint Must Exist
Verify the flow class exists before attempting deletion: Verify the flow blueprint exists before attempting deletion:
```bash ```bash
# List all flow classes # List all flow blueprintes
tg-show-flow-classes tg-show-flow-blueprints
# Check specific flow class # Check specific flow blueprint
tg-show-flow-classes | grep "target-class" tg-show-flow-blueprints | grep "target-class"
``` ```
### Check for Active Flow Instances ### Check for Active Flow Instances
Before deleting a flow class, check if any flow instances are using it: Before deleting a flow blueprint, check if any flow instances are using it:
```bash ```bash
# List all active flows # List all active flows
tg-show-flows tg-show-flows
# Look for instances using the flow class # Look for instances using the flow blueprint
tg-show-flows | grep "target-class" tg-show-flows | grep "target-class"
``` ```
## Error Handling ## Error Handling
### Flow Class Not Found ### Flow Blueprint Not Found
```bash ```bash
Exception: Flow class 'nonexistent-class' not found Exception: Flow blueprint 'nonexistent-class' not found
``` ```
**Solution**: Verify the flow class exists with `tg-show-flow-classes`. **Solution**: Verify the flow blueprint exists with `tg-show-flow-blueprints`.
### Connection Errors ### Connection Errors
```bash ```bash
@ -94,13 +94,13 @@ Exception: Connection refused
### Permission Errors ### Permission Errors
```bash ```bash
Exception: Access denied to delete flow class Exception: Access denied to delete flow blueprint
``` ```
**Solution**: Verify user permissions for flow class management. **Solution**: Verify user permissions for flow blueprint management.
### Active Flow Instances ### Active Flow Instances
```bash ```bash
Exception: Cannot delete flow class with active instances Exception: Cannot delete flow blueprint with active instances
``` ```
**Solution**: Stop all flow instances using this class before deletion. **Solution**: Stop all flow instances using this class before deletion.
@ -108,37 +108,37 @@ Exception: Cannot delete flow class with active instances
### Cleanup Development Classes ### Cleanup Development Classes
```bash ```bash
# Delete test and development flow classes # Delete test and development flow blueprintes
test_classes=("test-flow-v1" "dev-experiment" "prototype-flow") test_classes=("test-flow-v1" "dev-experiment" "prototype-flow")
for class in "${test_classes[@]}"; do for class in "${test_classes[@]}"; do
echo "Deleting $class..." echo "Deleting $class..."
tg-delete-flow-class -n "$class" tg-delete-flow-blueprint -n "$class"
done done
``` ```
### Migration Cleanup ### Migration Cleanup
```bash ```bash
# After migrating to new flow classes, remove old ones # After migrating to new flow blueprintes, remove old ones
old_classes=("legacy-flow" "deprecated-processor" "old-pipeline") old_classes=("legacy-flow" "deprecated-processor" "old-pipeline")
for class in "${old_classes[@]}"; do for class in "${old_classes[@]}"; do
# Backup first # Backup first
tg-get-flow-class -n "$class" > "backup-$class.json" 2>/dev/null tg-get-flow-blueprint -n "$class" > "backup-$class.json" 2>/dev/null
# Delete # Delete
tg-delete-flow-class -n "$class" tg-delete-flow-blueprint -n "$class"
echo "Deleted $class" echo "Deleted $class"
done done
``` ```
### Conditional Deletion ### Conditional Deletion
```bash ```bash
# Delete flow class only if no active instances exist # Delete flow blueprint only if no active instances exist
flow_class="target-flow" flow_class="target-flow"
active_instances=$(tg-show-flows | grep "$flow_class" | wc -l) active_instances=$(tg-show-flows | grep "$flow_class" | wc -l)
if [ $active_instances -eq 0 ]; then if [ $active_instances -eq 0 ]; then
echo "No active instances found, deleting flow class..." echo "No active instances found, deleting flow blueprint..."
tg-delete-flow-class -n "$flow_class" tg-delete-flow-blueprint -n "$flow_class"
else else
echo "Warning: $active_instances active instances found. Cannot delete." echo "Warning: $active_instances active instances found. Cannot delete."
tg-show-flows | grep "$flow_class" tg-show-flows | grep "$flow_class"
@ -154,13 +154,13 @@ flow_class="important-flow"
backup_dir="flow-class-backups/$(date +%Y%m%d-%H%M%S)" backup_dir="flow-class-backups/$(date +%Y%m%d-%H%M%S)"
mkdir -p "$backup_dir" mkdir -p "$backup_dir"
echo "Backing up flow class: $flow_class" echo "Backing up flow blueprint: $flow_class"
tg-get-flow-class -n "$flow_class" > "$backup_dir/$flow_class.json" tg-get-flow-blueprint -n "$flow_class" > "$backup_dir/$flow_class.json"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Backup created: $backup_dir/$flow_class.json" echo "Backup created: $backup_dir/$flow_class.json"
echo "Proceeding with deletion..." echo "Proceeding with deletion..."
tg-delete-flow-class -n "$flow_class" tg-delete-flow-blueprint -n "$flow_class"
else else
echo "Backup failed. Aborting deletion." echo "Backup failed. Aborting deletion."
exit 1 exit 1
@ -174,22 +174,22 @@ fi
flow_class="$1" flow_class="$1"
if [ -z "$flow_class" ]; then if [ -z "$flow_class" ]; then
echo "Usage: $0 <flow-class-name>" echo "Usage: $0 <flow-blueprint-name>"
exit 1 exit 1
fi fi
echo "Safety checks for deleting flow class: $flow_class" echo "Safety checks for deleting flow blueprint: $flow_class"
# Check if flow class exists # Check if flow blueprint exists
if ! tg-show-flow-classes | grep -q "$flow_class"; then if ! tg-show-flow-blueprints | grep -q "$flow_class"; then
echo "ERROR: Flow class '$flow_class' not found" echo "ERROR: Flow blueprint '$flow_class' not found"
exit 1 exit 1
fi fi
# Check for active instances # Check for active instances
active_count=$(tg-show-flows | grep "$flow_class" | wc -l) active_count=$(tg-show-flows | grep "$flow_class" | wc -l)
if [ $active_count -gt 0 ]; then if [ $active_count -gt 0 ]; then
echo "ERROR: Found $active_count active instances using this flow class" echo "ERROR: Found $active_count active instances using this flow blueprint"
echo "Active instances:" echo "Active instances:"
tg-show-flows | grep "$flow_class" tg-show-flows | grep "$flow_class"
exit 1 exit 1
@ -198,7 +198,7 @@ fi
# Create backup # Create backup
backup_file="backup-$flow_class-$(date +%Y%m%d-%H%M%S).json" backup_file="backup-$flow_class-$(date +%Y%m%d-%H%M%S).json"
echo "Creating backup: $backup_file" echo "Creating backup: $backup_file"
tg-get-flow-class -n "$flow_class" > "$backup_file" tg-get-flow-blueprint -n "$flow_class" > "$backup_file"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "ERROR: Failed to create backup" echo "ERROR: Failed to create backup"
@ -206,19 +206,19 @@ if [ $? -ne 0 ]; then
fi fi
# Confirm deletion # Confirm deletion
echo "Ready to delete flow class: $flow_class" echo "Ready to delete flow blueprint: $flow_class"
echo "Backup saved as: $backup_file" echo "Backup saved as: $backup_file"
read -p "Are you sure you want to delete this flow class? (y/N): " confirm read -p "Are you sure you want to delete this flow blueprint? (y/N): " confirm
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
echo "Deleting flow class..." echo "Deleting flow blueprint..."
tg-delete-flow-class -n "$flow_class" tg-delete-flow-blueprint -n "$flow_class"
# Verify deletion # Verify deletion
if ! tg-show-flow-classes | grep -q "$flow_class"; then if ! tg-show-flow-blueprints | grep -q "$flow_class"; then
echo "Flow class deleted successfully" echo "Flow blueprint deleted successfully"
else else
echo "ERROR: Flow class still exists after deletion" echo "ERROR: Flow blueprint still exists after deletion"
exit 1 exit 1
fi fi
else else
@ -229,13 +229,13 @@ fi
## Integration with Other Commands ## Integration with Other Commands
### Complete Flow Class Lifecycle ### Complete Flow Blueprint Lifecycle
```bash ```bash
# 1. List existing flow classes # 1. List existing flow blueprintes
tg-show-flow-classes tg-show-flow-blueprints
# 2. Get flow class details # 2. Get flow blueprint details
tg-get-flow-class -n "target-flow" tg-get-flow-blueprint -n "target-flow"
# 3. Check for active instances # 3. Check for active instances
tg-show-flows | grep "target-flow" tg-show-flows | grep "target-flow"
@ -244,25 +244,25 @@ tg-show-flows | grep "target-flow"
tg-stop-flow -i "instance-id" tg-stop-flow -i "instance-id"
# 5. Create backup # 5. Create backup
tg-get-flow-class -n "target-flow" > backup.json tg-get-flow-blueprint -n "target-flow" > backup.json
# 6. Delete flow class # 6. Delete flow blueprint
tg-delete-flow-class -n "target-flow" tg-delete-flow-blueprint -n "target-flow"
# 7. Verify deletion # 7. Verify deletion
tg-show-flow-classes | grep "target-flow" tg-show-flow-blueprints | grep "target-flow"
``` ```
### Bulk Deletion with Validation ### Bulk Deletion with Validation
```bash ```bash
# Delete multiple flow classes safely # Delete multiple flow blueprintes safely
classes_to_delete=("old-flow1" "old-flow2" "test-flow") classes_to_delete=("old-flow1" "old-flow2" "test-flow")
for class in "${classes_to_delete[@]}"; do for class in "${classes_to_delete[@]}"; do
echo "Processing $class..." echo "Processing $class..."
# Check if exists # Check if exists
if ! tg-show-flow-classes | grep -q "$class"; then if ! tg-show-flow-blueprints | grep -q "$class"; then
echo " $class not found, skipping" echo " $class not found, skipping"
continue continue
fi fi
@ -274,8 +274,8 @@ for class in "${classes_to_delete[@]}"; do
fi fi
# Backup and delete # Backup and delete
tg-get-flow-class -n "$class" > "backup-$class.json" tg-get-flow-blueprint -n "$class" > "backup-$class.json"
tg-delete-flow-class -n "$class" tg-delete-flow-blueprint -n "$class"
echo " $class deleted" echo " $class deleted"
done done
``` ```
@ -286,15 +286,15 @@ done
## Related Commands ## Related Commands
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes - [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
- [`tg-get-flow-class`](tg-get-flow-class.md) - Retrieve flow class definitions - [`tg-get-flow-blueprint`](tg-get-flow-blueprint.md) - Retrieve flow blueprint definitions
- [`tg-put-flow-class`](tg-put-flow-class.md) - Create/update flow class definitions - [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Create/update flow blueprint definitions
- [`tg-show-flows`](tg-show-flows.md) - List active flow instances - [`tg-show-flows`](tg-show-flows.md) - List active flow instances
- [`tg-stop-flow`](tg-stop-flow.md) - Stop flow instances - [`tg-stop-flow`](tg-stop-flow.md) - Stop flow instances
## API Integration ## API Integration
This command uses the [Flow API](../apis/api-flow.md) with the `delete-class` operation to remove flow class definitions. This command uses the [Flow API](../apis/api-flow.md) with the `delete-class` operation to remove flow blueprint definitions.
## Best Practices ## Best Practices
@ -310,10 +310,10 @@ This command uses the [Flow API](../apis/api-flow.md) with the `delete-class` op
### Command Succeeds but Class Still Exists ### Command Succeeds but Class Still Exists
```bash ```bash
# Check if deletion actually occurred # Check if deletion actually occurred
tg-show-flow-classes | grep "deleted-class" tg-show-flow-blueprints | grep "deleted-class"
# Verify API connectivity # Verify API connectivity
tg-show-flow-classes > /dev/null && echo "API accessible" tg-show-flow-blueprints > /dev/null && echo "API accessible"
``` ```
### Permissions Issues ### Permissions Issues

View file

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

View file

@ -435,7 +435,7 @@ tg-invoke-mcp-tool -n tool-name -P '{}'
tg-show-flows | grep "flow-id" tg-show-flows | grep "flow-id"
# Verify flow supports MCP tools # Verify flow supports MCP tools
tg-get-flow-class -n "flow-class" | jq '.interfaces.mcp_tool' tg-get-flow-blueprint -n "flow-class" | jq '.interfaces.mcp_tool'
``` ```
### Connection Issues ### Connection Issues

View file

@ -426,5 +426,5 @@ echo "variable=value" | grep "="
tg-show-flows | grep "flow-id" tg-show-flows | grep "flow-id"
# Verify flow has prompt service # Verify flow has prompt service
tg-get-flow-class -n "flow-class" | jq '.interfaces.prompt' tg-get-flow-blueprint -n "flow-class" | jq '.interfaces.prompt'
``` ```

View file

@ -1,25 +1,25 @@
# tg-put-flow-class # tg-put-flow-blueprint
Uploads or updates a flow class definition in TrustGraph. Uploads or updates a flow blueprint definition in TrustGraph.
## Synopsis ## Synopsis
```bash ```bash
tg-put-flow-class -n CLASS_NAME -c CONFIG_JSON [options] tg-put-flow-blueprint -n CLASS_NAME -c CONFIG_JSON [options]
``` ```
## Description ## Description
The `tg-put-flow-class` command creates or updates a flow class definition in TrustGraph. Flow classes are templates that define processing pipeline configurations, service interfaces, and resource requirements. These classes are used by `tg-start-flow` to create running flow instances. The `tg-put-flow-blueprint` command creates or updates a flow blueprint definition in TrustGraph. Flow blueprintes are templates that define processing pipeline configurations, service interfaces, and resource requirements. These classes are used by `tg-start-flow` to create running flow instances.
Flow classes define the structure and capabilities of processing flows, including which services are available and how they connect to Pulsar queues. Flow blueprintes define the structure and capabilities of processing flows, including which services are available and how they connect to Pulsar queues.
## Options ## Options
### Required Arguments ### Required Arguments
- `-n, --class-name CLASS_NAME`: Name for the flow class - `-n, --blueprint-name CLASS_NAME`: Name for the flow blueprint
- `-c, --config CONFIG_JSON`: Flow class configuration as raw JSON string - `-c, --config CONFIG_JSON`: Flow blueprint configuration as raw JSON string
### Optional Arguments ### Optional Arguments
@ -27,16 +27,16 @@ Flow classes define the structure and capabilities of processing flows, includin
## Examples ## Examples
### Basic Flow Class Creation ### Basic Flow Blueprint Creation
```bash ```bash
tg-put-flow-class \ tg-put-flow-blueprint \
-n "simple-processing" \ -n "simple-processing" \
-c '{"description": "Simple text processing flow", "interfaces": {"text-completion": {"request": "non-persistent://tg/request/text-completion:simple", "response": "non-persistent://tg/response/text-completion:simple"}}}' -c '{"description": "Simple text processing flow", "interfaces": {"text-completion": {"request": "non-persistent://tg/request/text-completion:simple", "response": "non-persistent://tg/response/text-completion:simple"}}}'
``` ```
### Document Processing Flow Class ### Document Processing Flow Blueprint
```bash ```bash
tg-put-flow-class \ tg-put-flow-blueprint \
-n "document-analysis" \ -n "document-analysis" \
-c '{ -c '{
"description": "Document analysis and RAG processing", "description": "Document analysis and RAG processing",
@ -80,14 +80,14 @@ cat > research-flow.json << 'EOF'
} }
EOF EOF
# Upload the flow class # Upload the flow blueprint
tg-put-flow-class -n "research-analysis" -c "$(cat research-flow.json)" tg-put-flow-blueprint -n "research-analysis" -c "$(cat research-flow.json)"
``` ```
### Update Existing Flow Class ### Update Existing Flow Blueprint
```bash ```bash
# Modify existing flow class by adding new service # Modify existing flow blueprint by adding new service
tg-put-flow-class \ tg-put-flow-blueprint \
-n "existing-flow" \ -n "existing-flow" \
-c '{ -c '{
"description": "Updated flow with new capabilities", "description": "Updated flow with new capabilities",
@ -104,14 +104,14 @@ tg-put-flow-class \
}' }'
``` ```
## Flow Class Configuration Format ## Flow Blueprint Configuration Format
### Required Fields ### Required Fields
#### Description #### Description
```json ```json
{ {
"description": "Human-readable description of the flow class" "description": "Human-readable description of the flow blueprint"
} }
``` ```
@ -180,9 +180,9 @@ persistent://tg/flow/{service}:{flow-identifier}
## Complete Example ## Complete Example
### Comprehensive Flow Class ### Comprehensive Flow Blueprint
```bash ```bash
tg-put-flow-class \ tg-put-flow-blueprint \
-n "full-processing-pipeline" \ -n "full-processing-pipeline" \
-c '{ -c '{
"description": "Complete document processing and analysis pipeline", "description": "Complete document processing and analysis pipeline",
@ -234,11 +234,11 @@ tg-put-flow-class \
Successful upload typically produces no output: Successful upload typically produces no output:
```bash ```bash
# Upload flow class (no output expected) # Upload flow blueprint (no output expected)
tg-put-flow-class -n "my-flow" -c '{"description": "test", "interfaces": {}}' tg-put-flow-blueprint -n "my-flow" -c '{"description": "test", "interfaces": {}}'
# Verify upload # Verify upload
tg-show-flow-classes | grep "my-flow" tg-show-flow-blueprints | grep "my-flow"
``` ```
## Error Handling ## Error Handling
@ -276,27 +276,27 @@ config='{"description": "test flow", "interfaces": {}}'
echo "$config" | jq . > /dev/null && echo "Valid JSON" || echo "Invalid JSON" echo "$config" | jq . > /dev/null && echo "Valid JSON" || echo "Invalid JSON"
``` ```
### Flow Class Verification ### Flow Blueprint Verification
```bash ```bash
# After uploading, verify the flow class exists # After uploading, verify the flow blueprint exists
tg-show-flow-classes | grep "my-flow-class" tg-show-flow-blueprints | grep "my-flow-class"
# Get the flow class definition to verify content # Get the flow blueprint definition to verify content
tg-get-flow-class -n "my-flow-class" tg-get-flow-blueprint -n "my-flow-class"
``` ```
## Flow Class Lifecycle ## Flow Blueprint Lifecycle
### Development Workflow ### Development Workflow
```bash ```bash
# 1. Create flow class # 1. Create flow blueprint
tg-put-flow-class -n "dev-flow" -c "$dev_config" tg-put-flow-blueprint -n "dev-flow" -c "$dev_config"
# 2. Test with flow instance # 2. Test with flow instance
tg-start-flow -n "dev-flow" -i "test-instance" -d "Testing" tg-start-flow -n "dev-flow" -i "test-instance" -d "Testing"
# 3. Update flow class as needed # 3. Update flow blueprint as needed
tg-put-flow-class -n "dev-flow" -c "$updated_config" tg-put-flow-blueprint -n "dev-flow" -c "$updated_config"
# 4. Restart flow instance with updates # 4. Restart flow instance with updates
tg-stop-flow -i "test-instance" tg-stop-flow -i "test-instance"
@ -309,53 +309,53 @@ tg-start-flow -n "dev-flow" -i "test-instance" -d "Testing updated"
## Related Commands ## Related Commands
- [`tg-get-flow-class`](tg-get-flow-class.md) - Retrieve flow class definitions - [`tg-get-flow-blueprint`](tg-get-flow-blueprint.md) - Retrieve flow blueprint definitions
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes - [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
- [`tg-delete-flow-class`](tg-delete-flow-class.md) - Remove flow class definitions - [`tg-delete-flow-blueprint`](tg-delete-flow-blueprint.md) - Remove flow blueprint definitions
- [`tg-start-flow`](tg-start-flow.md) - Create flow instances from classes - [`tg-start-flow`](tg-start-flow.md) - Create flow instances from classes
## API Integration ## API Integration
This command uses the [Flow API](../apis/api-flow.md) with the `put-class` operation to store flow class definitions. This command uses the [Flow API](../apis/api-flow.md) with the `put-class` operation to store flow blueprint definitions.
## Use Cases ## Use Cases
### Custom Processing Pipelines ### Custom Processing Pipelines
```bash ```bash
# Create specialized medical analysis flow # Create specialized medical analysis flow
tg-put-flow-class -n "medical-nlp" -c "$medical_config" tg-put-flow-blueprint -n "medical-nlp" -c "$medical_config"
``` ```
### Development Environments ### Development Environments
```bash ```bash
# Create lightweight development flow # Create lightweight development flow
tg-put-flow-class -n "dev-minimal" -c "$minimal_config" tg-put-flow-blueprint -n "dev-minimal" -c "$minimal_config"
``` ```
### Production Deployments ### Production Deployments
```bash ```bash
# Create robust production flow with all services # Create robust production flow with all services
tg-put-flow-class -n "production-full" -c "$production_config" tg-put-flow-blueprint -n "production-full" -c "$production_config"
``` ```
### Domain-Specific Workflows ### Domain-Specific Workflows
```bash ```bash
# Create legal document analysis flow # Create legal document analysis flow
tg-put-flow-class -n "legal-analysis" -c "$legal_config" tg-put-flow-blueprint -n "legal-analysis" -c "$legal_config"
``` ```
## Best Practices ## Best Practices
1. **Descriptive Names**: Use clear, descriptive flow class names 1. **Descriptive Names**: Use clear, descriptive flow blueprint names
2. **Comprehensive Descriptions**: Include detailed descriptions of flow capabilities 2. **Comprehensive Descriptions**: Include detailed descriptions of flow capabilities
3. **Consistent Naming**: Follow consistent queue naming conventions 3. **Consistent Naming**: Follow consistent queue naming conventions
4. **Version Control**: Store flow class configurations in version control 4. **Version Control**: Store flow blueprint configurations in version control
5. **Testing**: Test flow classes thoroughly before production use 5. **Testing**: Test flow blueprintes thoroughly before production use
6. **Documentation**: Document flow class purposes and requirements 6. **Documentation**: Document flow blueprint purposes and requirements
## Template Examples ## Template Examples
### Minimal Flow Class ### Minimal Flow Blueprint
```json ```json
{ {
"description": "Minimal text processing flow", "description": "Minimal text processing flow",
@ -368,7 +368,7 @@ tg-put-flow-class -n "legal-analysis" -c "$legal_config"
} }
``` ```
### RAG-Focused Flow Class ### RAG-Focused Flow Blueprint
```json ```json
{ {
"description": "Retrieval Augmented Generation flow", "description": "Retrieval Augmented Generation flow",
@ -389,7 +389,7 @@ tg-put-flow-class -n "legal-analysis" -c "$legal_config"
} }
``` ```
### Document Processing Flow Class ### Document Processing Flow Blueprint
```json ```json
{ {
"description": "Document ingestion and processing flow", "description": "Document ingestion and processing flow",

View file

@ -43,7 +43,7 @@ Version: 42
{ {
"flows": { "flows": {
"default": { "default": {
"class-name": "document-rag+graph-rag", "blueprint-name": "document-rag+graph-rag",
"description": "Default processing flow", "description": "Default processing flow",
"interfaces": { "interfaces": {
"agent": { "agent": {
@ -77,7 +77,7 @@ Version: 42
### Flow Definitions ### Flow Definitions
Flow configurations showing: Flow configurations showing:
- **class-name**: The flow class being used - **blueprint-name**: The flow blueprint being used
- **description**: Human-readable flow description - **description**: Human-readable flow description
- **interfaces**: Pulsar queue names for each service - **interfaces**: Pulsar queue names for each service
@ -131,7 +131,7 @@ Exception: Unauthorized
## Related Commands ## Related Commands
- [`tg-put-flow-class`](tg-put-flow-class.md) - Update flow class definitions - [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Update flow blueprint definitions
- [`tg-show-flows`](tg-show-flows.md) - List active flows - [`tg-show-flows`](tg-show-flows.md) - List active flows
- [`tg-set-prompt`](tg-set-prompt.md) - Configure prompt templates - [`tg-set-prompt`](tg-set-prompt.md) - Configure prompt templates
- [`tg-set-token-costs`](tg-set-token-costs.md) - Configure token costs - [`tg-set-token-costs`](tg-set-token-costs.md) - Configure token costs

View file

@ -0,0 +1,330 @@
# tg-show-flow-blueprints
Lists all defined flow blueprintes in TrustGraph with their descriptions and tags.
## Synopsis
```bash
tg-show-flow-blueprints [options]
```
## Description
The `tg-show-flow-blueprints` command displays a formatted table of all flow blueprint definitions currently stored in TrustGraph. Each flow blueprint is shown with its name, description, and associated tags.
Flow blueprintes are templates that define the structure and services available for creating flow instances. This command helps you understand what flow blueprintes are available for use.
## Options
### Optional Arguments
- `-u, --api-url URL`: TrustGraph API URL (default: `$TRUSTGRAPH_URL` or `http://localhost:8088/`)
## Examples
### List All Flow Blueprintes
```bash
tg-show-flow-blueprints
```
Output:
```
+-----------------+----------------------------------+----------------------+
| flow blueprint | description | tags |
+-----------------+----------------------------------+----------------------+
| document-proc | Document processing pipeline | production, nlp |
| data-analysis | Data analysis and visualization | analytics, dev |
| web-scraper | Web content extraction flow | scraping, batch |
| chat-assistant | Conversational AI assistant | ai, interactive |
+-----------------+----------------------------------+----------------------+
```
### Using Custom API URL
```bash
tg-show-flow-blueprints -u http://production:8088/
```
### Filter Flow Blueprintes
```bash
# Show only production-tagged flow blueprintes
tg-show-flow-blueprints | grep "production"
# Count total flow blueprintes
tg-show-flow-blueprints | grep -c "^|"
# Show flow blueprintes with specific patterns
tg-show-flow-blueprints | grep -E "(document|text|nlp)"
```
## Output Format
The command displays results in a formatted table with columns:
- **flow blueprint**: The unique name/identifier of the flow blueprint
- **description**: Human-readable description of the flow blueprint purpose
- **tags**: Comma-separated list of categorization tags
### Empty Results
If no flow blueprintes exist:
```
No flows.
```
## Use Cases
### Flow Blueprint Discovery
```bash
# Find available flow blueprintes for document processing
tg-show-flow-blueprints | grep -i document
# List all AI-related flow blueprintes
tg-show-flow-blueprints | grep -i "ai\|nlp\|chat\|assistant"
# Find development vs production flow blueprintes
tg-show-flow-blueprints | grep -E "(dev|test|staging)"
tg-show-flow-blueprints | grep "production"
```
### Flow Blueprint Management
```bash
# Get list of flow blueprint names for scripting
tg-show-flow-blueprints | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); print $2}' | grep -v "^$"
# Check if specific flow blueprint exists
if tg-show-flow-blueprints | grep -q "target-flow"; then
echo "Flow blueprint 'target-flow' exists"
else
echo "Flow blueprint 'target-flow' not found"
fi
```
### Environment Comparison
```bash
# Compare flow blueprintes between environments
echo "Development environment:"
tg-show-flow-blueprints -u http://dev:8088/
echo "Production environment:"
tg-show-flow-blueprints -u http://prod:8088/
```
### Reporting and Documentation
```bash
# Generate flow blueprint inventory report
echo "Flow Blueprint Inventory - $(date)" > flow-inventory.txt
echo "=====================================" >> flow-inventory.txt
tg-show-flow-blueprints >> flow-inventory.txt
# Create CSV export
echo "flow_class,description,tags" > flow-classes.csv
tg-show-flow-blueprints | awk 'NR>3 && /^\|/ {
gsub(/^\| */, "", $0); gsub(/ *\|$/, "", $0);
gsub(/ *\| */, ",", $0); print $0
}' >> flow-classes.csv
```
## Error Handling
### Connection Errors
```bash
Exception: Connection refused
```
**Solution**: Check the API URL and ensure TrustGraph is running.
### Permission Errors
```bash
Exception: Access denied to list flow blueprintes
```
**Solution**: Verify user permissions for reading flow blueprint definitions.
### Network Timeouts
```bash
Exception: Request timeout
```
**Solution**: Check network connectivity and API server status.
## Integration with Other Commands
### Flow Blueprint Lifecycle
```bash
# 1. List available flow blueprintes
tg-show-flow-blueprints
# 2. Get details of specific flow blueprint
tg-get-flow-blueprint -n "interesting-flow"
# 3. Start flow instance from class
tg-start-flow -n "interesting-flow" -i "my-instance"
# 4. Monitor flow instance
tg-show-flows | grep "my-instance"
```
### Bulk Operations
```bash
# Process all flow blueprintes
tg-show-flow-blueprints | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
echo "Processing flow blueprint: $class_name"
tg-get-flow-blueprint -n "$class_name" > "backup-$class_name.json"
fi
done
```
### Automated Validation
```bash
# Check flow blueprint health
echo "Validating flow blueprintes..."
tg-show-flow-blueprints | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
echo -n "Checking $class_name... "
if tg-get-flow-blueprint -n "$class_name" > /dev/null 2>&1; then
echo "OK"
else
echo "ERROR"
fi
fi
done
```
## Advanced Usage
### Flow Blueprint Analysis
```bash
# Analyze flow blueprint distribution by tags
tg-show-flow-blueprints | awk 'NR>3 && /^\|/ {
# Extract tags column
split($0, parts, "|");
tags = parts[4];
gsub(/^ *| *$/, "", tags);
if (tags) {
split(tags, tag_array, ",");
for (i in tag_array) {
gsub(/^ *| *$/, "", tag_array[i]);
if (tag_array[i]) print tag_array[i];
}
}
}' | sort | uniq -c | sort -nr
```
### Environment Synchronization
```bash
# Sync flow blueprintes between environments
echo "Synchronizing flow blueprintes from dev to staging..."
# Get list from development
dev_classes=$(tg-show-flow-blueprints -u http://dev:8088/ | \
awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}')
# Check each class in staging
for class in $dev_classes; do
if tg-show-flow-blueprints -u http://staging:8088/ | grep -q "$class"; then
echo "$class: Already exists in staging"
else
echo "$class: Missing in staging - needs sync"
# Get from dev and put to staging
tg-get-flow-blueprint -n "$class" -u http://dev:8088/ > temp-class.json
tg-put-flow-blueprint -n "$class" -c "$(cat temp-class.json)" -u http://staging:8088/
rm temp-class.json
fi
done
```
### Monitoring Script
```bash
#!/bin/bash
# monitor-flow-classes.sh
api_url="${1:-http://localhost:8088/}"
echo "Flow Blueprint Monitoring Report - $(date)"
echo "API URL: $api_url"
echo "----------------------------------------"
# Total count
total=$(tg-show-flow-blueprints -u "$api_url" | grep -c "^|" 2>/dev/null || echo "0")
echo "Total flow blueprintes: $((total - 3))" # Subtract header rows
# Tag analysis
echo -e "\nTag distribution:"
tg-show-flow-blueprints -u "$api_url" | awk 'NR>3 && /^\|/ {
split($0, parts, "|");
tags = parts[4];
gsub(/^ *| *$/, "", tags);
if (tags) {
split(tags, tag_array, ",");
for (i in tag_array) {
gsub(/^ *| *$/, "", tag_array[i]);
if (tag_array[i]) print tag_array[i];
}
}
}' | sort | uniq -c | sort -nr
# Health check
echo -e "\nHealth check:"
healthy=0
unhealthy=0
tg-show-flow-blueprints -u "$api_url" | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
if tg-get-flow-blueprint -n "$class_name" -u "$api_url" > /dev/null 2>&1; then
healthy=$((healthy + 1))
else
unhealthy=$((unhealthy + 1))
echo " ERROR: $class_name"
fi
fi
done
echo "Healthy: $healthy, Unhealthy: $unhealthy"
```
## Environment Variables
- `TRUSTGRAPH_URL`: Default API URL
## Related Commands
- [`tg-get-flow-blueprint`](tg-get-flow-blueprint.md) - Retrieve specific flow blueprint definitions
- [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Create/update flow blueprint definitions
- [`tg-delete-flow-blueprint`](tg-delete-flow-blueprint.md) - Delete flow blueprint definitions
- [`tg-start-flow`](tg-start-flow.md) - Create flow instances from classes
- [`tg-show-flows`](tg-show-flows.md) - List active flow instances
## API Integration
This command uses the [Flow API](../apis/api-flow.md) with the `list-classes` operation to retrieve flow blueprint listings.
## Best Practices
1. **Regular Inventory**: Periodically review available flow blueprintes
2. **Documentation**: Ensure flow blueprintes have meaningful descriptions
3. **Tagging**: Use consistent tagging for better organization
4. **Cleanup**: Remove unused or deprecated flow blueprintes
5. **Monitoring**: Include flow blueprint health checks in monitoring
6. **Environment Parity**: Keep flow blueprintes synchronized across environments
## Troubleshooting
### No Output
```bash
# If command returns no output, check API connectivity
tg-show-flow-blueprints -u http://localhost:8088/
# Verify TrustGraph is running and accessible
```
### Formatting Issues
```bash
# If table formatting is broken, check terminal width
export COLUMNS=120
tg-show-flow-blueprints
```
### Missing Flow Blueprintes
```bash
# If expected flow blueprintes are missing, verify:
# 1. Correct API URL
# 2. Database connectivity
# 3. Flow blueprint definitions are properly stored
```

View file

@ -1,330 +0,0 @@
# tg-show-flow-classes
Lists all defined flow classes in TrustGraph with their descriptions and tags.
## Synopsis
```bash
tg-show-flow-classes [options]
```
## Description
The `tg-show-flow-classes` command displays a formatted table of all flow class definitions currently stored in TrustGraph. Each flow class is shown with its name, description, and associated tags.
Flow classes are templates that define the structure and services available for creating flow instances. This command helps you understand what flow classes are available for use.
## Options
### Optional Arguments
- `-u, --api-url URL`: TrustGraph API URL (default: `$TRUSTGRAPH_URL` or `http://localhost:8088/`)
## Examples
### List All Flow Classes
```bash
tg-show-flow-classes
```
Output:
```
+-----------------+----------------------------------+----------------------+
| flow class | description | tags |
+-----------------+----------------------------------+----------------------+
| document-proc | Document processing pipeline | production, nlp |
| data-analysis | Data analysis and visualization | analytics, dev |
| web-scraper | Web content extraction flow | scraping, batch |
| chat-assistant | Conversational AI assistant | ai, interactive |
+-----------------+----------------------------------+----------------------+
```
### Using Custom API URL
```bash
tg-show-flow-classes -u http://production:8088/
```
### Filter Flow Classes
```bash
# Show only production-tagged flow classes
tg-show-flow-classes | grep "production"
# Count total flow classes
tg-show-flow-classes | grep -c "^|"
# Show flow classes with specific patterns
tg-show-flow-classes | grep -E "(document|text|nlp)"
```
## Output Format
The command displays results in a formatted table with columns:
- **flow class**: The unique name/identifier of the flow class
- **description**: Human-readable description of the flow class purpose
- **tags**: Comma-separated list of categorization tags
### Empty Results
If no flow classes exist:
```
No flows.
```
## Use Cases
### Flow Class Discovery
```bash
# Find available flow classes for document processing
tg-show-flow-classes | grep -i document
# List all AI-related flow classes
tg-show-flow-classes | grep -i "ai\|nlp\|chat\|assistant"
# Find development vs production flow classes
tg-show-flow-classes | grep -E "(dev|test|staging)"
tg-show-flow-classes | grep "production"
```
### Flow Class Management
```bash
# Get list of flow class names for scripting
tg-show-flow-classes | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); print $2}' | grep -v "^$"
# Check if specific flow class exists
if tg-show-flow-classes | grep -q "target-flow"; then
echo "Flow class 'target-flow' exists"
else
echo "Flow class 'target-flow' not found"
fi
```
### Environment Comparison
```bash
# Compare flow classes between environments
echo "Development environment:"
tg-show-flow-classes -u http://dev:8088/
echo "Production environment:"
tg-show-flow-classes -u http://prod:8088/
```
### Reporting and Documentation
```bash
# Generate flow class inventory report
echo "Flow Class Inventory - $(date)" > flow-inventory.txt
echo "=====================================" >> flow-inventory.txt
tg-show-flow-classes >> flow-inventory.txt
# Create CSV export
echo "flow_class,description,tags" > flow-classes.csv
tg-show-flow-classes | awk 'NR>3 && /^\|/ {
gsub(/^\| */, "", $0); gsub(/ *\|$/, "", $0);
gsub(/ *\| */, ",", $0); print $0
}' >> flow-classes.csv
```
## Error Handling
### Connection Errors
```bash
Exception: Connection refused
```
**Solution**: Check the API URL and ensure TrustGraph is running.
### Permission Errors
```bash
Exception: Access denied to list flow classes
```
**Solution**: Verify user permissions for reading flow class definitions.
### Network Timeouts
```bash
Exception: Request timeout
```
**Solution**: Check network connectivity and API server status.
## Integration with Other Commands
### Flow Class Lifecycle
```bash
# 1. List available flow classes
tg-show-flow-classes
# 2. Get details of specific flow class
tg-get-flow-class -n "interesting-flow"
# 3. Start flow instance from class
tg-start-flow -n "interesting-flow" -i "my-instance"
# 4. Monitor flow instance
tg-show-flows | grep "my-instance"
```
### Bulk Operations
```bash
# Process all flow classes
tg-show-flow-classes | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
echo "Processing flow class: $class_name"
tg-get-flow-class -n "$class_name" > "backup-$class_name.json"
fi
done
```
### Automated Validation
```bash
# Check flow class health
echo "Validating flow classes..."
tg-show-flow-classes | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
echo -n "Checking $class_name... "
if tg-get-flow-class -n "$class_name" > /dev/null 2>&1; then
echo "OK"
else
echo "ERROR"
fi
fi
done
```
## Advanced Usage
### Flow Class Analysis
```bash
# Analyze flow class distribution by tags
tg-show-flow-classes | awk 'NR>3 && /^\|/ {
# Extract tags column
split($0, parts, "|");
tags = parts[4];
gsub(/^ *| *$/, "", tags);
if (tags) {
split(tags, tag_array, ",");
for (i in tag_array) {
gsub(/^ *| *$/, "", tag_array[i]);
if (tag_array[i]) print tag_array[i];
}
}
}' | sort | uniq -c | sort -nr
```
### Environment Synchronization
```bash
# Sync flow classes between environments
echo "Synchronizing flow classes from dev to staging..."
# Get list from development
dev_classes=$(tg-show-flow-classes -u http://dev:8088/ | \
awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}')
# Check each class in staging
for class in $dev_classes; do
if tg-show-flow-classes -u http://staging:8088/ | grep -q "$class"; then
echo "$class: Already exists in staging"
else
echo "$class: Missing in staging - needs sync"
# Get from dev and put to staging
tg-get-flow-class -n "$class" -u http://dev:8088/ > temp-class.json
tg-put-flow-class -n "$class" -c "$(cat temp-class.json)" -u http://staging:8088/
rm temp-class.json
fi
done
```
### Monitoring Script
```bash
#!/bin/bash
# monitor-flow-classes.sh
api_url="${1:-http://localhost:8088/}"
echo "Flow Class Monitoring Report - $(date)"
echo "API URL: $api_url"
echo "----------------------------------------"
# Total count
total=$(tg-show-flow-classes -u "$api_url" | grep -c "^|" 2>/dev/null || echo "0")
echo "Total flow classes: $((total - 3))" # Subtract header rows
# Tag analysis
echo -e "\nTag distribution:"
tg-show-flow-classes -u "$api_url" | awk 'NR>3 && /^\|/ {
split($0, parts, "|");
tags = parts[4];
gsub(/^ *| *$/, "", tags);
if (tags) {
split(tags, tag_array, ",");
for (i in tag_array) {
gsub(/^ *| *$/, "", tag_array[i]);
if (tag_array[i]) print tag_array[i];
}
}
}' | sort | uniq -c | sort -nr
# Health check
echo -e "\nHealth check:"
healthy=0
unhealthy=0
tg-show-flow-classes -u "$api_url" | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
if tg-get-flow-class -n "$class_name" -u "$api_url" > /dev/null 2>&1; then
healthy=$((healthy + 1))
else
unhealthy=$((unhealthy + 1))
echo " ERROR: $class_name"
fi
fi
done
echo "Healthy: $healthy, Unhealthy: $unhealthy"
```
## Environment Variables
- `TRUSTGRAPH_URL`: Default API URL
## Related Commands
- [`tg-get-flow-class`](tg-get-flow-class.md) - Retrieve specific flow class definitions
- [`tg-put-flow-class`](tg-put-flow-class.md) - Create/update flow class definitions
- [`tg-delete-flow-class`](tg-delete-flow-class.md) - Delete flow class definitions
- [`tg-start-flow`](tg-start-flow.md) - Create flow instances from classes
- [`tg-show-flows`](tg-show-flows.md) - List active flow instances
## API Integration
This command uses the [Flow API](../apis/api-flow.md) with the `list-classes` operation to retrieve flow class listings.
## Best Practices
1. **Regular Inventory**: Periodically review available flow classes
2. **Documentation**: Ensure flow classes have meaningful descriptions
3. **Tagging**: Use consistent tagging for better organization
4. **Cleanup**: Remove unused or deprecated flow classes
5. **Monitoring**: Include flow class health checks in monitoring
6. **Environment Parity**: Keep flow classes synchronized across environments
## Troubleshooting
### No Output
```bash
# If command returns no output, check API connectivity
tg-show-flow-classes -u http://localhost:8088/
# Verify TrustGraph is running and accessible
```
### Formatting Issues
```bash
# If table formatting is broken, check terminal width
export COLUMNS=120
tg-show-flow-classes
```
### Missing Flow Classes
```bash
# If expected flow classes are missing, verify:
# 1. Correct API URL
# 2. Database connectivity
# 3. Flow class definitions are properly stored
```

View file

@ -1,6 +1,6 @@
# tg-show-flow-state # tg-show-flow-state
Displays the processor states for a specific flow and its associated flow class. Displays the processor states for a specific flow and its associated flow blueprint.
## Synopsis ## Synopsis
@ -10,7 +10,7 @@ tg-show-flow-state [options]
## Description ## Description
The `tg-show-flow-state` command shows the current state of processors within a specific TrustGraph flow instance and its corresponding flow class. It queries the metrics system to determine which processing components are running and displays their status with visual indicators. The `tg-show-flow-state` command shows the current state of processors within a specific TrustGraph flow instance and its corresponding flow blueprint. It queries the metrics system to determine which processing components are running and displays their status with visual indicators.
This command is essential for monitoring flow health and debugging processing issues. This command is essential for monitoring flow health and debugging processing issues.
@ -51,7 +51,7 @@ tg-show-flow-state \
## Output Format ## Output Format
The command displays processor states for both the flow instance and its flow class: The command displays processor states for both the flow instance and its flow blueprint:
``` ```
Flow production-flow Flow production-flow
@ -75,7 +75,7 @@ Class document-processing-v2
### Information Displayed ### Information Displayed
- **Flow Section**: Shows the state of processors in the specific flow instance - **Flow Section**: Shows the state of processors in the specific flow instance
- **Class Section**: Shows the state of processors in the flow class template - **Class Section**: Shows the state of processors in the flow blueprint template
- **Processor Names**: Individual processing components within the flow - **Processor Names**: Individual processing components within the flow
## Use Cases ## Use Cases

View file

@ -135,7 +135,7 @@ Exception: Unauthorized
- [`tg-start-flow`](tg-start-flow.md) - Start a new flow instance - [`tg-start-flow`](tg-start-flow.md) - Start a new flow instance
- [`tg-stop-flow`](tg-stop-flow.md) - Stop a running flow - [`tg-stop-flow`](tg-stop-flow.md) - Stop a running flow
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes - [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
- [`tg-show-flow-state`](tg-show-flow-state.md) - Show detailed flow status - [`tg-show-flow-state`](tg-show-flow-state.md) - Show detailed flow status
- [`tg-show-config`](tg-show-config.md) - Show complete system configuration - [`tg-show-config`](tg-show-config.md) - Show complete system configuration
@ -186,7 +186,7 @@ tg-show-flows | grep "graph-rag request"
### Flow Information ### Flow Information
- **id**: Unique flow instance identifier - **id**: Unique flow instance identifier
- **class**: Flow class name used to create the instance - **class**: Flow blueprint name used to create the instance
- **desc**: Human-readable flow description - **desc**: Human-readable flow description
- **queue**: Service interfaces and their Pulsar queue names - **queue**: Service interfaces and their Pulsar queue names
@ -196,7 +196,7 @@ Queue names indicate:
- **Tenant**: Usually `tg` - **Tenant**: Usually `tg`
- **Namespace**: `request`, `response`, or `flow` - **Namespace**: `request`, `response`, or `flow`
- **Service**: The specific service name - **Service**: The specific service name
- **Flow Identifier**: Either flow class or flow ID - **Flow Identifier**: Either flow blueprint or flow ID
## Best Practices ## Best Practices

View file

@ -1,6 +1,6 @@
# tg-start-flow # tg-start-flow
Starts a processing flow using a defined flow class. Starts a processing flow using a defined flow blueprint.
## Synopsis ## Synopsis
@ -10,7 +10,7 @@ tg-start-flow -n CLASS_NAME -i FLOW_ID -d DESCRIPTION [options]
## Description ## Description
The `tg-start-flow` command creates and starts a new processing flow instance based on a predefined flow class. Flow classes define the processing pipeline configuration, while flow instances are running implementations of those classes with specific identifiers. The `tg-start-flow` command creates and starts a new processing flow instance based on a predefined flow blueprint. Flow blueprintes define the processing pipeline configuration, while flow instances are running implementations of those classes with specific identifiers.
Once started, a flow provides endpoints for document processing, knowledge queries, and other TrustGraph services through its configured interfaces. Once started, a flow provides endpoints for document processing, knowledge queries, and other TrustGraph services through its configured interfaces.
@ -18,7 +18,7 @@ Once started, a flow provides endpoints for document processing, knowledge queri
### Required Arguments ### Required Arguments
- `-n, --class-name CLASS_NAME`: Name of the flow class to instantiate - `-n, --blueprint-name CLASS_NAME`: Name of the flow blueprint to instantiate
- `-i, --flow-id FLOW_ID`: Unique identifier for the new flow instance - `-i, --flow-id FLOW_ID`: Unique identifier for the new flow instance
- `-d, --description DESCRIPTION`: Human-readable description of the flow - `-d, --description DESCRIPTION`: Human-readable description of the flow
@ -36,7 +36,7 @@ tg-start-flow \
-d "Research document processing pipeline" -d "Research document processing pipeline"
``` ```
### Start Custom Flow Class ### Start Custom Flow Blueprint
```bash ```bash
tg-start-flow \ tg-start-flow \
-n "medical-analysis" \ -n "medical-analysis" \
@ -55,15 +55,15 @@ tg-start-flow \
## Prerequisites ## Prerequisites
### Flow Class Must Exist ### Flow Blueprint Must Exist
Before starting a flow, the flow class must be available in the system: Before starting a flow, the flow blueprint must be available in the system:
```bash ```bash
# Check available flow classes # Check available flow blueprintes
tg-show-flow-classes tg-show-flow-blueprints
# Upload a flow class if needed # Upload a flow blueprint if needed
tg-put-flow-class -n "my-class" -f flow-definition.json tg-put-flow-blueprint -n "my-class" -f flow-definition.json
``` ```
### System Requirements ### System Requirements
@ -73,7 +73,7 @@ tg-put-flow-class -n "my-class" -f flow-definition.json
## Flow Lifecycle ## Flow Lifecycle
1. **Flow Class Definition**: Flow classes define processing pipelines 1. **Flow Blueprint Definition**: Flow blueprintes define processing pipelines
2. **Flow Instance Creation**: `tg-start-flow` creates a running instance 2. **Flow Instance Creation**: `tg-start-flow` creates a running instance
3. **Service Availability**: Flow provides configured service endpoints 3. **Service Availability**: Flow provides configured service endpoints
4. **Processing**: Documents and queries can be processed through the flow 4. **Processing**: Documents and queries can be processed through the flow
@ -81,11 +81,11 @@ tg-put-flow-class -n "my-class" -f flow-definition.json
## Error Handling ## Error Handling
### Flow Class Not Found ### Flow Blueprint Not Found
```bash ```bash
Exception: Flow class 'invalid-class' not found Exception: Flow blueprint 'invalid-class' not found
``` ```
**Solution**: Check available flow classes with `tg-show-flow-classes` and ensure the class name is correct. **Solution**: Check available flow blueprintes with `tg-show-flow-blueprints` and ensure the class name is correct.
### Flow ID Already Exists ### Flow ID Already Exists
```bash ```bash
@ -137,8 +137,8 @@ Once started, flows provide service interfaces based on their class definition.
- [`tg-stop-flow`](tg-stop-flow.md) - Stop a running flow - [`tg-stop-flow`](tg-stop-flow.md) - Stop a running flow
- [`tg-show-flows`](tg-show-flows.md) - List active flows and their interfaces - [`tg-show-flows`](tg-show-flows.md) - List active flows and their interfaces
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes - [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
- [`tg-put-flow-class`](tg-put-flow-class.md) - Upload/update flow class definitions - [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Upload/update flow blueprint definitions
- [`tg-show-flow-state`](tg-show-flow-state.md) - Check flow status - [`tg-show-flow-state`](tg-show-flow-state.md) - Check flow status
## API Integration ## API Integration

View file

@ -434,7 +434,7 @@ Exception: Processing ID already exists
```bash ```bash
Exception: Flow instance not found Exception: Flow instance not found
``` ```
**Solution**: Verify flow exists with `tg-show-flows` or `tg-show-flow-classes`. **Solution**: Verify flow exists with `tg-show-flows` or `tg-show-flow-blueprints`.
### Insufficient Resources ### Insufficient Resources
```bash ```bash

View file

@ -171,7 +171,7 @@ done
- [`tg-start-flow`](tg-start-flow.md) - Start a new flow instance - [`tg-start-flow`](tg-start-flow.md) - Start a new flow instance
- [`tg-show-flows`](tg-show-flows.md) - List active flows - [`tg-show-flows`](tg-show-flows.md) - List active flows
- [`tg-show-flow-state`](tg-show-flow-state.md) - Check detailed flow status - [`tg-show-flow-state`](tg-show-flow-state.md) - Check detailed flow status
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes - [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
## API Integration ## API Integration

View file

@ -1,15 +1,15 @@
# Flow Class Definition Specification # Flow Blueprint Definition Specification
## Overview ## Overview
A flow class defines a complete dataflow pattern template in the TrustGraph system. When instantiated, it creates an interconnected network of processors that handle data ingestion, processing, storage, and querying as a unified system. A flow blueprint defines a complete dataflow pattern template in the TrustGraph system. When instantiated, it creates an interconnected network of processors that handle data ingestion, processing, storage, and querying as a unified system.
## Structure ## Structure
A flow class definition consists of five main sections: A flow blueprint definition consists of five main sections:
### 1. Class Section ### 1. Class Section
Defines shared service processors that are instantiated once per flow class. These processors handle requests from all flow instances of this class. Defines shared service processors that are instantiated once per flow blueprint. These processors handle requests from all flow instances of this class.
```json ```json
"class": { "class": {
@ -100,7 +100,7 @@ Maps flow-specific parameter names to centrally-stored parameter definitions:
- Reduces duplication of parameter schemas - Reduces duplication of parameter schemas
### 5. Metadata ### 5. Metadata
Additional information about the flow class: Additional information about the flow blueprint:
```json ```json
"description": "Human-readable description", "description": "Human-readable description",
@ -117,7 +117,7 @@ Additional information about the flow class:
- Example: `flow-123`, `customer-A-flow` - Example: `flow-123`, `customer-A-flow`
#### {class} #### {class}
- Replaced with the flow class name - Replaced with the flow blueprint name
- Creates shared resources across flows of the same class - Creates shared resources across flows of the same class
- Example: `standard-rag`, `enterprise-rag` - Example: `standard-rag`, `enterprise-rag`
@ -203,14 +203,14 @@ Parameter names in settings correspond to keys in the flow's `parameters` sectio
## Queue Patterns (Pulsar) ## Queue Patterns (Pulsar)
Flow classes use Apache Pulsar for messaging. Queue names follow the Pulsar format: Flow blueprintes use Apache Pulsar for messaging. Queue names follow the Pulsar format:
``` ```
<persistence>://<tenant>/<namespace>/<topic> <persistence>://<tenant>/<namespace>/<topic>
``` ```
### Components: ### Components:
- **persistence**: `persistent` or `non-persistent` (Pulsar persistence mode) - **persistence**: `persistent` or `non-persistent` (Pulsar persistence mode)
- **tenant**: `tg` for TrustGraph-supplied flow class definitions - **tenant**: `tg` for TrustGraph-supplied flow blueprint definitions
- **namespace**: Indicates the messaging pattern - **namespace**: Indicates the messaging pattern
- `flow`: Fire-and-forget services - `flow`: Fire-and-forget services
- `request`: Request portion of request/response services - `request`: Request portion of request/response services
@ -232,7 +232,7 @@ Flow classes use Apache Pulsar for messaging. Queue names follow the Pulsar form
## Dataflow Architecture ## Dataflow Architecture
The flow class creates a unified dataflow where: The flow blueprint creates a unified dataflow where:
1. **Document Processing Pipeline**: Flows from ingestion through transformation to storage 1. **Document Processing Pipeline**: Flows from ingestion through transformation to storage
2. **Query Services**: Integrated processors that query the same data stores and services 2. **Query Services**: Integrated processors that query the same data stores and services
@ -245,7 +245,7 @@ All processors (both `{id}` and `{class}`) work together as a cohesive dataflow
Given: Given:
- Flow Instance ID: `customer-A-flow` - Flow Instance ID: `customer-A-flow`
- Flow Class: `standard-rag` - Flow Blueprint: `standard-rag`
- Flow parameter mappings: - Flow parameter mappings:
- `"model": "llm-model"` - `"model": "llm-model"`
- `"temp": "temperature"` - `"temp": "temperature"`

View file

@ -1,8 +1,8 @@
# Flow Class Configurable Parameters Technical Specification # Flow Blueprint Configurable Parameters Technical Specification
## Overview ## Overview
This specification describes the implementation of configurable parameters for flow classes in TrustGraph. Parameters enable users to customize processor parameters at flow launch time by providing values that replace parameter placeholders in the flow class definition. This specification describes the implementation of configurable parameters for flow blueprintes in TrustGraph. Parameters enable users to customize processor parameters at flow launch time by providing values that replace parameter placeholders in the flow blueprint definition.
Parameters work through template variable substitution in processor parameters, similar to how `{id}` and `{class}` variables work, but with user-provided values. Parameters work through template variable substitution in processor parameters, similar to how `{id}` and `{class}` variables work, but with user-provided values.
@ -21,25 +21,25 @@ The integration supports four primary use cases:
- **Template Substitution**: Seamlessly replace parameter placeholders in processor parameters - **Template Substitution**: Seamlessly replace parameter placeholders in processor parameters
- **UI Integration**: Enable parameter input through both API and UI interfaces - **UI Integration**: Enable parameter input through both API and UI interfaces
- **Type Safety**: Ensure parameter types match expected processor parameter types - **Type Safety**: Ensure parameter types match expected processor parameter types
- **Documentation**: Self-documenting parameter schemas within flow class definitions - **Documentation**: Self-documenting parameter schemas within flow blueprint definitions
- **Backward Compatibility**: Maintain compatibility with existing flow classes that don't use parameters - **Backward Compatibility**: Maintain compatibility with existing flow blueprintes that don't use parameters
## Background ## Background
Flow classes in TrustGraph now support processor parameters that can contain either fixed values or parameter placeholders. This creates an opportunity for runtime customization. Flow blueprintes in TrustGraph now support processor parameters that can contain either fixed values or parameter placeholders. This creates an opportunity for runtime customization.
Current processor parameters support: Current processor parameters support:
- Fixed values: `"model": "gemma3:12b"` - Fixed values: `"model": "gemma3:12b"`
- Parameter placeholders: `"model": "gemma3:{model-size}"` - Parameter placeholders: `"model": "gemma3:{model-size}"`
This specification defines how parameters are: This specification defines how parameters are:
- Declared in flow class definitions - Declared in flow blueprint definitions
- Validated when flows are launched - Validated when flows are launched
- Substituted in processor parameters - Substituted in processor parameters
- Exposed through APIs and UI - Exposed through APIs and UI
By leveraging parameterized processor parameters, TrustGraph can: By leveraging parameterized processor parameters, TrustGraph can:
- Reduce flow class duplication by using parameters for variations - Reduce flow blueprint duplication by using parameters for variations
- Enable users to tune processor behavior without modifying definitions - Enable users to tune processor behavior without modifying definitions
- Support environment-specific configurations through parameter values - Support environment-specific configurations through parameter values
- Maintain type safety through parameter schema validation - Maintain type safety through parameter schema validation
@ -51,7 +51,7 @@ By leveraging parameterized processor parameters, TrustGraph can:
The configurable parameters system requires the following technical components: The configurable parameters system requires the following technical components:
1. **Parameter Schema Definition** 1. **Parameter Schema Definition**
- JSON Schema-based parameter definitions within flow class metadata - JSON Schema-based parameter definitions within flow blueprint metadata
- Type definitions including string, number, boolean, enum, and object types - Type definitions including string, number, boolean, enum, and object types
- Validation rules including min/max values, patterns, and required fields - Validation rules including min/max values, patterns, and required fields
@ -92,7 +92,7 @@ The configurable parameters system requires the following technical components:
#### Parameter Definitions (Stored in Schema/Config) #### Parameter Definitions (Stored in Schema/Config)
Parameter definitions are stored centrally in the schema and config system with type "parameter-types": Parameter definitions are stored centrally in the schema and config system with type "parameter-type":
```json ```json
{ {
@ -146,9 +146,9 @@ Parameter definitions are stored centrally in the schema and config system with
} }
``` ```
#### Flow Class with Parameter References #### Flow Blueprint with Parameter References
Flow classes define parameter metadata with type references, descriptions, and ordering: Flow blueprintes define parameter metadata with type references, descriptions, and ordering:
```json ```json
{ {
@ -225,7 +225,7 @@ The `parameters` section maps flow-specific parameter names (keys) to parameter
- `controlled-by` (optional): Name of another parameter that controls this parameter's value when in simple mode. When specified, this parameter inherits its value from the controlling parameter unless explicitly overridden - `controlled-by` (optional): Name of another parameter that controls this parameter's value when in simple mode. When specified, this parameter inherits its value from the controlling parameter unless explicitly overridden
This approach allows: This approach allows:
- Reusable parameter type definitions across multiple flow classes - Reusable parameter type definitions across multiple flow blueprintes
- Centralized parameter type management and validation - Centralized parameter type management and validation
- Flow-specific parameter descriptions and ordering - Flow-specific parameter descriptions and ordering
- Enhanced UI experience with descriptive parameter forms - Enhanced UI experience with descriptive parameter forms
@ -253,7 +253,7 @@ The flow launch API accepts parameters using the flow's parameter names:
Note: In this example, `llm-rag-model` is not explicitly provided but will inherit the value "claude-3" from `llm-model` due to its `controlled-by` relationship. Similarly, `chunk-overlap` could inherit a calculated value based on `chunk-size`. Note: In this example, `llm-rag-model` is not explicitly provided but will inherit the value "claude-3" from `llm-model` due to its `controlled-by` relationship. Similarly, `chunk-overlap` could inherit a calculated value based on `chunk-size`.
The system will: The system will:
1. Extract parameter metadata from flow class definition 1. Extract parameter metadata from flow blueprint definition
2. Map flow parameter names to their type definitions (e.g., `llm-model``llm-model` type) 2. Map flow parameter names to their type definitions (e.g., `llm-model``llm-model` type)
3. Resolve controlled-by relationships (e.g., `llm-rag-model` inherits from `llm-model`) 3. Resolve controlled-by relationships (e.g., `llm-rag-model` inherits from `llm-model`)
4. Validate user-provided and inherited values against the parameter type definitions 4. Validate user-provided and inherited values against the parameter type definitions
@ -265,14 +265,14 @@ The system will:
When a flow is started, the system performs the following parameter resolution steps: When a flow is started, the system performs the following parameter resolution steps:
1. **Flow Class Loading**: Load flow class definition and extract parameter metadata 1. **Flow Blueprint Loading**: Load flow blueprint definition and extract parameter metadata
2. **Metadata Extraction**: Extract `type`, `description`, `order`, `advanced`, and `controlled-by` for each parameter defined in the flow class's `parameters` section 2. **Metadata Extraction**: Extract `type`, `description`, `order`, `advanced`, and `controlled-by` for each parameter defined in the flow blueprint's `parameters` section
3. **Type Definition Lookup**: For each parameter in the flow class: 3. **Type Definition Lookup**: For each parameter in the flow blueprint:
- Retrieve the parameter type definition from schema/config store using the `type` field - Retrieve the parameter type definition from schema/config store using the `type` field
- The type definitions are stored with type "parameter-types" in the config system - The type definitions are stored with type "parameter-type" in the config system
- Each type definition contains the parameter's schema, default value, and validation rules - Each type definition contains the parameter's schema, default value, and validation rules
4. **Default Value Resolution**: 4. **Default Value Resolution**:
- For each parameter defined in the flow class: - For each parameter defined in the flow blueprint:
- Check if the user provided a value for this parameter - Check if the user provided a value for this parameter
- If no user value provided, use the `default` value from the parameter type definition - If no user value provided, use the `default` value from the parameter type definition
- Build a complete parameter map containing both user-provided and default values - Build a complete parameter map containing both user-provided and default values
@ -361,7 +361,7 @@ The flow configuration service (`trustgraph-flow/trustgraph/config/service/flow.
Resolve parameters by merging user-provided values with defaults. Resolve parameters by merging user-provided values with defaults.
Args: Args:
flow_class: The flow class definition dict flow_class: The flow blueprint definition dict
user_params: User-provided parameters dict user_params: User-provided parameters dict
Returns: Returns:
@ -370,20 +370,20 @@ The flow configuration service (`trustgraph-flow/trustgraph/config/service/flow.
``` ```
This function should: This function should:
- Extract parameter metadata from the flow class's `parameters` section - Extract parameter metadata from the flow blueprint's `parameters` section
- For each parameter, fetch its type definition from config store - For each parameter, fetch its type definition from config store
- Apply defaults for any parameters not provided by the user - Apply defaults for any parameters not provided by the user
- Handle `controlled-by` inheritance relationships - Handle `controlled-by` inheritance relationships
- Return the complete parameter set - Return the complete parameter set
2. **Modified `handle_start_flow` Method** 2. **Modified `handle_start_flow` Method**
- Call `resolve_parameters` after loading the flow class - Call `resolve_parameters` after loading the flow blueprint
- Use the complete resolved parameter set for template substitution - Use the complete resolved parameter set for template substitution
- Store the complete parameter set (not just user-provided) with the flow - Store the complete parameter set (not just user-provided) with the flow
- Validate that all required parameters have values - Validate that all required parameters have values
3. **Parameter Type Fetching** 3. **Parameter Type Fetching**
- Parameter type definitions are stored in config with type "parameter-types" - Parameter type definitions are stored in config with type "parameter-type"
- Each type definition contains schema, default value, and validation rules - Each type definition contains schema, default value, and validation rules
- Cache frequently-used parameter types to reduce config lookups - Cache frequently-used parameter types to reduce config lookups
@ -400,12 +400,12 @@ The flow configuration service (`trustgraph-flow/trustgraph/config/service/flow.
4. **Library CLI Commands** 4. **Library CLI Commands**
- CLI commands that start flows need parameter support: - CLI commands that start flows need parameter support:
- Accept parameter values via command-line flags or configuration files - Accept parameter values via command-line flags or configuration files
- Validate parameters against flow class definitions before submission - Validate parameters against flow blueprint definitions before submission
- Support parameter file input (JSON/YAML) for complex parameter sets - Support parameter file input (JSON/YAML) for complex parameter sets
- CLI commands that show flows need to display parameter information: - CLI commands that show flows need to display parameter information:
- Show parameter values used when the flow was started - Show parameter values used when the flow was started
- Display available parameters for a flow class - Display available parameters for a flow blueprint
- Show parameter validation schemas and defaults - Show parameter validation schemas and defaults
#### Processor Base Class Integration #### Processor Base Class Integration
@ -456,7 +456,7 @@ Substituted in processor: "0.7" (string)
## Migration Plan ## Migration Plan
1. The system should continue to support flow classes with no parameters 1. The system should continue to support flow blueprintes with no parameters
declared. declared.
2. The system should continue to support flows no parameters specified: 2. The system should continue to support flows no parameters specified:
This works for flows with no parameters, and flows with parameters This works for flows with no parameters, and flows with parameters
@ -482,4 +482,4 @@ A: Just string substitution to remove strange injections and edge-cases.
## References ## References
- JSON Schema Specification: https://json-schema.org/ - JSON Schema Specification: https://json-schema.org/
- Flow Class Definition Spec: docs/tech-specs/flow-class-definition.md - Flow Blueprint Definition Spec: docs/tech-specs/flow-class-definition.md

View file

@ -180,7 +180,7 @@ class TestFlowProcessorSimple(IsolatedAsyncioTestCase):
'test-flow': {'config': 'test-config'} 'test-flow': {'config': 'test-config'}
} }
config_data = { config_data = {
'flows-active': { 'active-flow': {
'test-processor': '{"test-flow": {"config": "test-config"}}' 'test-processor': '{"test-flow": {"config": "test-config"}}'
} }
} }
@ -212,7 +212,7 @@ class TestFlowProcessorSimple(IsolatedAsyncioTestCase):
# Configuration without flows for this processor # Configuration without flows for this processor
config_data = { config_data = {
'flows-active': { 'active-flow': {
'other-processor': '{"other-flow": {"config": "other-config"}}' 'other-processor': '{"other-flow": {"config": "other-config"}}'
} }
} }
@ -241,7 +241,7 @@ class TestFlowProcessorSimple(IsolatedAsyncioTestCase):
processor = FlowProcessor(**config) processor = FlowProcessor(**config)
processor.id = 'test-processor' processor.id = 'test-processor'
# Configuration without flows-active key # Configuration without active-flow key
config_data = { config_data = {
'other-data': 'some-value' 'other-data': 'some-value'
} }
@ -276,16 +276,16 @@ class TestFlowProcessorSimple(IsolatedAsyncioTestCase):
# First configuration - start flow1 # First configuration - start flow1
config_data1 = { config_data1 = {
'flows-active': { 'active-flow': {
'test-processor': '{"flow1": {"config": "config1"}}' 'test-processor': '{"flow1": {"config": "config1"}}'
} }
} }
await processor.on_configure_flows(config_data1, version=1) await processor.on_configure_flows(config_data1, version=1)
# Second configuration - stop flow1, start flow2 # Second configuration - stop flow1, start flow2
config_data2 = { config_data2 = {
'flows-active': { 'active-flow': {
'test-processor': '{"flow2": {"config": "config2"}}' 'test-processor': '{"flow2": {"config": "config2"}}'
} }
} }

View file

@ -28,42 +28,42 @@ class Flow:
def id(self, id="default"): def id(self, id="default"):
return FlowInstance(api=self, id=id) return FlowInstance(api=self, id=id)
def list_classes(self): def list_blueprints(self):
# The input consists of system and prompt strings # The input consists of system and prompt strings
input = { input = {
"operation": "list-classes", "operation": "list-blueprints",
} }
return self.request(request = input)["class-names"] return self.request(request = input)["blueprint-names"]
def get_class(self, class_name): def get_blueprint(self, blueprint_name):
# The input consists of system and prompt strings # The input consists of system and prompt strings
input = { input = {
"operation": "get-class", "operation": "get-blueprint",
"class-name": class_name, "blueprint-name": blueprint_name,
} }
return json.loads(self.request(request = input)["class-definition"]) return json.loads(self.request(request = input)["blueprint-definition"])
def put_class(self, class_name, definition): def put_blueprint(self, blueprint_name, definition):
# The input consists of system and prompt strings # The input consists of system and prompt strings
input = { input = {
"operation": "put-class", "operation": "put-blueprint",
"class-name": class_name, "blueprint-name": blueprint_name,
"class-definition": json.dumps(definition), "blueprint-definition": json.dumps(definition),
} }
self.request(request = input) self.request(request = input)
def delete_class(self, class_name): def delete_blueprint(self, blueprint_name):
# The input consists of system and prompt strings # The input consists of system and prompt strings
input = { input = {
"operation": "delete-class", "operation": "delete-blueprint",
"class-name": class_name, "blueprint-name": blueprint_name,
} }
self.request(request = input) self.request(request = input)
@ -87,13 +87,13 @@ class Flow:
return json.loads(self.request(request = input)["flow"]) return json.loads(self.request(request = input)["flow"])
def start(self, class_name, id, description, parameters=None): def start(self, blueprint_name, id, description, parameters=None):
# The input consists of system and prompt strings # The input consists of system and prompt strings
input = { input = {
"operation": "start-flow", "operation": "start-flow",
"flow-id": id, "flow-id": id,
"class-name": class_name, "blueprint-name": blueprint_name,
"description": description, "description": description,
} }

View file

@ -63,13 +63,13 @@ class FlowProcessor(AsyncProcessor):
logger.info(f"Got config version {version}") logger.info(f"Got config version {version}")
# Skip over invalid data # Skip over invalid data
if "flows-active" not in config: return if "active-flow" not in config: return
# Check there's configuration information for me # Check there's configuration information for me
if self.id in config["flows-active"]: if self.id in config["active-flow"]:
# Get my flow config # Get my flow config
flow_config = json.loads(config["flows-active"][self.id]) flow_config = json.loads(config["active-flow"][self.id])
else: else:

View file

@ -9,8 +9,8 @@ class FlowRequestTranslator(MessageTranslator):
def to_pulsar(self, data: Dict[str, Any]) -> FlowRequest: def to_pulsar(self, data: Dict[str, Any]) -> FlowRequest:
return FlowRequest( return FlowRequest(
operation=data.get("operation"), operation=data.get("operation"),
class_name=data.get("class-name"), blueprint_name=data.get("blueprint-name"),
class_definition=data.get("class-definition"), blueprint_definition=data.get("blueprint-definition"),
description=data.get("description"), description=data.get("description"),
flow_id=data.get("flow-id"), flow_id=data.get("flow-id"),
parameters=data.get("parameters") parameters=data.get("parameters")
@ -21,10 +21,10 @@ class FlowRequestTranslator(MessageTranslator):
if obj.operation is not None: if obj.operation is not None:
result["operation"] = obj.operation result["operation"] = obj.operation
if obj.class_name is not None: if obj.blueprint_name is not None:
result["class-name"] = obj.class_name result["blueprint-name"] = obj.blueprint_name
if obj.class_definition is not None: if obj.blueprint_definition is not None:
result["class-definition"] = obj.class_definition result["blueprint-definition"] = obj.blueprint_definition
if obj.description is not None: if obj.description is not None:
result["description"] = obj.description result["description"] = obj.description
if obj.flow_id is not None: if obj.flow_id is not None:
@ -44,12 +44,12 @@ class FlowResponseTranslator(MessageTranslator):
def from_pulsar(self, obj: FlowResponse) -> Dict[str, Any]: def from_pulsar(self, obj: FlowResponse) -> Dict[str, Any]:
result = {} result = {}
if obj.class_names is not None: if obj.blueprint_names is not None:
result["class-names"] = obj.class_names result["blueprint-names"] = obj.blueprint_names
if obj.flow_ids is not None: if obj.flow_ids is not None:
result["flow-ids"] = obj.flow_ids result["flow-ids"] = obj.flow_ids
if obj.class_definition is not None: if obj.blueprint_definition is not None:
result["class-definition"] = obj.class_definition result["blueprint-definition"] = obj.blueprint_definition
if obj.flow is not None: if obj.flow is not None:
result["flow"] = obj.flow result["flow"] = obj.flow
if obj.description is not None: if obj.description is not None:

View file

@ -7,27 +7,27 @@ from ..core.primitives import Error
############################################################################ ############################################################################
# Flow service: # Flow service:
# list_classes() -> (classname[]) # list_blueprints() -> (blueprintname[])
# get_class(classname) -> (class) # get_blueprint(blueprintname) -> (blueprint)
# put_class(class) -> (class) # put_blueprint(blueprint) -> (blueprint)
# delete_class(classname) -> () # delete_blueprint(blueprintname) -> ()
# #
# list_flows() -> (flowid[]) # list_flows() -> (flowid[])
# get_flow(flowid) -> (flow) # get_flow(flowid) -> (flow)
# start_flow(flowid, classname) -> () # start_flow(flowid, blueprintname) -> ()
# stop_flow(flowid) -> () # stop_flow(flowid) -> ()
# Prompt services, abstract the prompt generation # Prompt services, abstract the prompt generation
@dataclass @dataclass
class FlowRequest: class FlowRequest:
operation: str = "" # list-classes, get-class, put-class, delete-class operation: str = "" # list-blueprints, get-blueprint, put-blueprint, delete-blueprint
# list-flows, get-flow, start-flow, stop-flow # list-flows, get-flow, start-flow, stop-flow
# get_class, put_class, delete_class, start_flow # get_blueprint, put_blueprint, delete_blueprint, start_flow
class_name: str = "" blueprint_name: str = ""
# put_class # put_blueprint
class_definition: str = "" blueprint_definition: str = ""
# start_flow # start_flow
description: str = "" description: str = ""
@ -40,14 +40,14 @@ class FlowRequest:
@dataclass @dataclass
class FlowResponse: class FlowResponse:
# list_classes # list_blueprints
class_names: list[str] = field(default_factory=list) blueprint_names: list[str] = field(default_factory=list)
# list_flows # list_flows
flow_ids: list[str] = field(default_factory=list) flow_ids: list[str] = field(default_factory=list)
# get_class # get_blueprint
class_definition: str = "" blueprint_definition: str = ""
# get_flow # get_flow
flow: str = "" flow: str = ""

View file

@ -29,13 +29,13 @@ Homepage = "https://github.com/trustgraph-ai/trustgraph"
[project.scripts] [project.scripts]
tg-add-library-document = "trustgraph.cli.add_library_document:main" tg-add-library-document = "trustgraph.cli.add_library_document:main"
tg-delete-flow-class = "trustgraph.cli.delete_flow_class:main" tg-delete-flow-blueprint = "trustgraph.cli.delete_flow_blueprint:main"
tg-delete-mcp-tool = "trustgraph.cli.delete_mcp_tool:main" tg-delete-mcp-tool = "trustgraph.cli.delete_mcp_tool:main"
tg-delete-kg-core = "trustgraph.cli.delete_kg_core:main" tg-delete-kg-core = "trustgraph.cli.delete_kg_core:main"
tg-delete-tool = "trustgraph.cli.delete_tool:main" tg-delete-tool = "trustgraph.cli.delete_tool:main"
tg-dump-msgpack = "trustgraph.cli.dump_msgpack:main" tg-dump-msgpack = "trustgraph.cli.dump_msgpack:main"
tg-dump-queues = "trustgraph.cli.dump_queues:main" tg-dump-queues = "trustgraph.cli.dump_queues:main"
tg-get-flow-class = "trustgraph.cli.get_flow_class:main" tg-get-flow-blueprint = "trustgraph.cli.get_flow_blueprint:main"
tg-get-kg-core = "trustgraph.cli.get_kg_core:main" tg-get-kg-core = "trustgraph.cli.get_kg_core:main"
tg-graph-to-turtle = "trustgraph.cli.graph_to_turtle:main" tg-graph-to-turtle = "trustgraph.cli.graph_to_turtle:main"
tg-init-trustgraph = "trustgraph.cli.init_trustgraph:main" tg-init-trustgraph = "trustgraph.cli.init_trustgraph:main"
@ -56,7 +56,7 @@ tg-load-text = "trustgraph.cli.load_text:main"
tg-load-turtle = "trustgraph.cli.load_turtle:main" tg-load-turtle = "trustgraph.cli.load_turtle:main"
tg-load-knowledge = "trustgraph.cli.load_knowledge:main" tg-load-knowledge = "trustgraph.cli.load_knowledge:main"
tg-load-structured-data = "trustgraph.cli.load_structured_data:main" tg-load-structured-data = "trustgraph.cli.load_structured_data:main"
tg-put-flow-class = "trustgraph.cli.put_flow_class:main" tg-put-flow-blueprint = "trustgraph.cli.put_flow_blueprint:main"
tg-put-kg-core = "trustgraph.cli.put_kg_core:main" tg-put-kg-core = "trustgraph.cli.put_kg_core:main"
tg-remove-library-document = "trustgraph.cli.remove_library_document:main" tg-remove-library-document = "trustgraph.cli.remove_library_document:main"
tg-save-doc-embeds = "trustgraph.cli.save_doc_embeds:main" tg-save-doc-embeds = "trustgraph.cli.save_doc_embeds:main"
@ -65,7 +65,7 @@ tg-set-prompt = "trustgraph.cli.set_prompt:main"
tg-set-token-costs = "trustgraph.cli.set_token_costs:main" tg-set-token-costs = "trustgraph.cli.set_token_costs:main"
tg-set-tool = "trustgraph.cli.set_tool:main" tg-set-tool = "trustgraph.cli.set_tool:main"
tg-show-config = "trustgraph.cli.show_config:main" tg-show-config = "trustgraph.cli.show_config:main"
tg-show-flow-classes = "trustgraph.cli.show_flow_classes:main" tg-show-flow-blueprints = "trustgraph.cli.show_flow_blueprints:main"
tg-show-flow-state = "trustgraph.cli.show_flow_state:main" tg-show-flow-state = "trustgraph.cli.show_flow_state:main"
tg-show-flows = "trustgraph.cli.show_flows:main" tg-show-flows = "trustgraph.cli.show_flows:main"
tg-show-graph = "trustgraph.cli.show_graph:main" tg-show-graph = "trustgraph.cli.show_graph:main"

View file

@ -1,5 +1,5 @@
""" """
Deletes a flow class Deletes a flow blueprint
""" """
import argparse import argparse
@ -10,16 +10,16 @@ import json
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/') default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
def delete_flow_class(url, class_name): def delete_flow_blueprint(url, blueprint_name):
api = Api(url).flow() api = Api(url).flow()
class_names = api.delete_class(class_name) blueprint_names = api.delete_blueprint(blueprint_name)
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog='tg-delete-flow-class', prog='tg-delete-flow-blueprint',
description=__doc__, description=__doc__,
) )
@ -30,17 +30,17 @@ def main():
) )
parser.add_argument( parser.add_argument(
'-n', '--class-name', '-n', '--blueprint-name',
help=f'Flow class name', help=f'Flow blueprint name',
) )
args = parser.parse_args() args = parser.parse_args()
try: try:
delete_flow_class( delete_flow_blueprint(
url=args.api_url, url=args.api_url,
class_name=args.class_name, blueprint_name=args.blueprint_name,
) )
except Exception as e: except Exception as e:
@ -48,4 +48,4 @@ def main():
print("Exception:", e, flush=True) print("Exception:", e, flush=True)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View file

@ -1,5 +1,5 @@
""" """
Outputs a flow class definition in JSON format. Outputs a flow blueprint definition in JSON format.
""" """
import argparse import argparse
@ -10,18 +10,18 @@ import json
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/') default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
def get_flow_class(url, class_name): def get_flow_blueprint(url, blueprint_name):
api = Api(url).flow() api = Api(url).flow()
cls = api.get_class(class_name) cls = api.get_blueprint(blueprint_name)
print(json.dumps(cls, indent=4)) print(json.dumps(cls, indent=4))
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog='tg-get-flow-class', prog='tg-get-flow-blueprint',
description=__doc__, description=__doc__,
) )
@ -32,18 +32,18 @@ def main():
) )
parser.add_argument( parser.add_argument(
'-n', '--class-name', '-n', '--blueprint-name',
required=True, required=True,
help=f'Flow class name', help=f'Flow blueprint name',
) )
args = parser.parse_args() args = parser.parse_args()
try: try:
get_flow_class( get_flow_blueprint(
url=args.api_url, url=args.api_url,
class_name=args.class_name, blueprint_name=args.blueprint_name,
) )
except Exception as e: except Exception as e:
@ -51,4 +51,4 @@ def main():
print("Exception:", e, flush=True) print("Exception:", e, flush=True)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View file

@ -1,6 +1,6 @@
""" """
Uploads a flow class definition. You can take the output of Uploads a flow blueprint definition. You can take the output of
tg-get-flow-class and load it back in using this utility. tg-get-flow-blueprint and load it back in using this utility.
""" """
import argparse import argparse
@ -11,16 +11,16 @@ import json
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/') default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
default_token = os.getenv("TRUSTGRAPH_TOKEN", None) default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
def put_flow_class(url, class_name, config, token=None): def put_flow_blueprint(url, blueprint_name, config, token=None):
api = Api(url, token=token) api = Api(url, token=token)
class_names = api.flow().put_class(class_name, config) blueprint_names = api.flow().put_blueprint(blueprint_name, config)
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog='tg-put-flow-class', prog='tg-put-flow-blueprint',
description=__doc__, description=__doc__,
) )
@ -37,8 +37,8 @@ def main():
) )
parser.add_argument( parser.add_argument(
'-n', '--class-name', '-n', '--blueprint-name',
help=f'Flow class name', help=f'Flow blueprint name',
) )
parser.add_argument( parser.add_argument(
@ -50,9 +50,9 @@ def main():
try: try:
put_flow_class( put_flow_blueprint(
url=args.api_url, url=args.api_url,
class_name=args.class_name, blueprint_name=args.blueprint_name,
config=json.loads(args.config), config=json.loads(args.config),
token=args.token, token=args.token,
) )
@ -62,4 +62,4 @@ def main():
print("Exception:", e, flush=True) print("Exception:", e, flush=True)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View file

@ -1,5 +1,5 @@
""" """
Shows all defined flow classes. Shows all defined flow blueprints.
""" """
import argparse import argparse
@ -16,7 +16,7 @@ def format_parameters(params_metadata, config_api):
Format parameter metadata for display Format parameter metadata for display
Args: Args:
params_metadata: Parameter definitions from flow class params_metadata: Parameter definitions from flow blueprint
config_api: API client to get parameter type information config_api: API client to get parameter type information
Returns: Returns:
@ -41,7 +41,7 @@ def format_parameters(params_metadata, config_api):
type_info = param_type type_info = param_type
if config_api: if config_api:
try: try:
key = ConfigKey("parameter-types", param_type) key = ConfigKey("parameter-type", param_type)
type_def_value = config_api.get([key])[0].value type_def_value = config_api.get([key])[0].value
param_type_def = json.loads(type_def_value) param_type_def = json.loads(type_def_value)
@ -58,23 +58,23 @@ def format_parameters(params_metadata, config_api):
return "\n".join(param_list) return "\n".join(param_list)
def show_flow_classes(url, token=None): def show_flow_blueprints(url, token=None):
api = Api(url, token=token) api = Api(url, token=token)
flow_api = api.flow() flow_api = api.flow()
config_api = api.config() config_api = api.config()
class_names = flow_api.list_classes() blueprint_names = flow_api.list_blueprints()
if len(class_names) == 0: if len(blueprint_names) == 0:
print("No flow classes.") print("No flow blueprints.")
return return
for class_name in class_names: for blueprint_name in blueprint_names:
cls = flow_api.get_class(class_name) cls = flow_api.get_blueprint(blueprint_name)
table = [] table = []
table.append(("name", class_name)) table.append(("name", blueprint_name))
table.append(("description", cls.get("description", ""))) table.append(("description", cls.get("description", "")))
tags = cls.get("tags", []) tags = cls.get("tags", [])
@ -97,7 +97,7 @@ def show_flow_classes(url, token=None):
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog='tg-show-flow-classes', prog='tg-show-flow-blueprints',
description=__doc__, description=__doc__,
) )
@ -117,7 +117,7 @@ def main():
try: try:
show_flow_classes( show_flow_blueprints(
url=args.api_url, url=args.api_url,
token=args.token, token=args.token,
) )
@ -127,4 +127,4 @@ def main():
print("Exception:", e, flush=True) print("Exception:", e, flush=True)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View file

@ -16,15 +16,15 @@ def dump_status(metrics_url, api_url, flow_id, token=None):
api = Api(api_url, token=token).flow() api = Api(api_url, token=token).flow()
flow = api.get(flow_id) flow = api.get(flow_id)
class_name = flow["class-name"] blueprint_name = flow["blueprint-name"]
print() print()
print(f"Flow {flow_id}") print(f"Flow {flow_id}")
show_processors(metrics_url, flow_id) show_processors(metrics_url, flow_id)
print() print()
print(f"Class {class_name}") print(f"Blueprint {blueprint_name}")
show_processors(metrics_url, class_name) show_processors(metrics_url, blueprint_name)
print() print()

View file

@ -13,7 +13,7 @@ default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
def get_interface(config_api, i): def get_interface(config_api, i):
key = ConfigKey("interface-descriptions", i) key = ConfigKey("interface-description", i)
value = config_api.get([key])[0].value value = config_api.get([key])[0].value
@ -70,13 +70,13 @@ def get_enum_description(param_value, param_type_def):
# If not found in enum, return original value # If not found in enum, return original value
return param_value return param_value
def format_parameters(flow_params, class_params_metadata, config_api): def format_parameters(flow_params, blueprint_params_metadata, config_api):
""" """
Format flow parameters with their human-readable descriptions Format flow parameters with their human-readable descriptions
Args: Args:
flow_params: The actual parameter values used in the flow flow_params: The actual parameter values used in the flow
class_params_metadata: The parameter metadata from the flow class definition blueprint_params_metadata: The parameter metadata from the flow blueprint definition
config_api: API client to retrieve parameter type definitions config_api: API client to retrieve parameter type definitions
Returns: Returns:
@ -89,7 +89,7 @@ def format_parameters(flow_params, class_params_metadata, config_api):
# Sort parameters by order if available # Sort parameters by order if available
sorted_params = sorted( sorted_params = sorted(
class_params_metadata.items(), blueprint_params_metadata.items(),
key=lambda x: x[1].get("order", 999) key=lambda x: x[1].get("order", 999)
) )
@ -105,7 +105,7 @@ def format_parameters(flow_params, class_params_metadata, config_api):
if param_type and config_api: if param_type and config_api:
try: try:
from trustgraph.api import ConfigKey from trustgraph.api import ConfigKey
key = ConfigKey("parameter-types", param_type) key = ConfigKey("parameter-type", param_type)
type_def_value = config_api.get([key])[0].value type_def_value = config_api.get([key])[0].value
param_type_def = json.loads(type_def_value) param_type_def = json.loads(type_def_value)
display_value = get_enum_description(value, param_type_def) display_value = get_enum_description(value, param_type_def)
@ -122,9 +122,9 @@ def format_parameters(flow_params, class_params_metadata, config_api):
param_list.append(line) param_list.append(line)
# Add any parameters that aren't in the class metadata (shouldn't happen normally) # Add any parameters that aren't in the blueprint metadata (shouldn't happen normally)
for param_name, value in flow_params.items(): for param_name, value in flow_params.items():
if param_name not in class_params_metadata: if param_name not in blueprint_params_metadata:
param_list.append(f"{param_name}: {value} (undefined)") param_list.append(f"{param_name}: {value} (undefined)")
return "\n".join(param_list) if param_list else "None" return "\n".join(param_list) if param_list else "None"
@ -135,7 +135,7 @@ def show_flows(url, token=None):
config_api = api.config() config_api = api.config()
flow_api = api.flow() flow_api = api.flow()
interface_names = config_api.list("interface-descriptions") interface_names = config_api.list("interface-description")
interface_defs = { interface_defs = {
i: get_interface(config_api, i) i: get_interface(config_api, i)
@ -156,24 +156,24 @@ def show_flows(url, token=None):
table = [] table = []
table.append(("id", id)) table.append(("id", id))
table.append(("class", flow.get("class-name", ""))) table.append(("blueprint", flow.get("blueprint-name", "")))
table.append(("desc", flow.get("description", ""))) table.append(("desc", flow.get("description", "")))
# Display parameters with human-readable descriptions # Display parameters with human-readable descriptions
parameters = flow.get("parameters", {}) parameters = flow.get("parameters", {})
if parameters: if parameters:
# Try to get the flow class definition for parameter metadata # Try to get the flow blueprint definition for parameter metadata
class_name = flow.get("class-name", "") blueprint_name = flow.get("blueprint-name", "")
if class_name: if blueprint_name:
try: try:
flow_class = flow_api.get_class(class_name) flow_blueprint = flow_api.get_blueprint(blueprint_name)
class_params_metadata = flow_class.get("parameters", {}) blueprint_params_metadata = flow_blueprint.get("parameters", {})
param_str = format_parameters(parameters, class_params_metadata, config_api) param_str = format_parameters(parameters, blueprint_params_metadata, config_api)
except Exception as e: except Exception as e:
# Fallback to JSON if we can't get the class definition # Fallback to JSON if we can't get the blueprint definition
param_str = json.dumps(parameters, indent=2) param_str = json.dumps(parameters, indent=2)
else: else:
# No class name, fallback to JSON # No blueprint name, fallback to JSON
param_str = json.dumps(parameters, indent=2) param_str = json.dumps(parameters, indent=2)
table.append(("parameters", param_str)) table.append(("parameters", param_str))

View file

@ -85,7 +85,7 @@ def show_parameter_types(url, token=None):
# Get list of all parameter types # Get list of all parameter types
try: try:
param_type_names = config_api.list("parameter-types") param_type_names = config_api.list("parameter-type")
except Exception as e: except Exception as e:
print(f"Error retrieving parameter types: {e}") print(f"Error retrieving parameter types: {e}")
return return
@ -97,7 +97,7 @@ def show_parameter_types(url, token=None):
for param_type_name in param_type_names: for param_type_name in param_type_names:
try: try:
# Get the parameter type definition # Get the parameter type definition
key = ConfigKey("parameter-types", param_type_name) key = ConfigKey("parameter-type", param_type_name)
type_def_value = config_api.get([key])[0].value type_def_value = config_api.get([key])[0].value
param_type_def = json.loads(type_def_value) param_type_def = json.loads(type_def_value)
@ -179,7 +179,7 @@ def show_specific_parameter_type(url, param_type_name, token=None):
try: try:
# Get the parameter type definition # Get the parameter type definition
key = ConfigKey("parameter-types", param_type_name) key = ConfigKey("parameter-type", param_type_name)
type_def_value = config_api.get([key])[0].value type_def_value = config_api.get([key])[0].value
param_type_def = json.loads(type_def_value) param_type_def = json.loads(type_def_value)

View file

@ -18,7 +18,7 @@ def show_config(url, token=None):
api = Api(url, token=token).config() api = Api(url, token=token).config()
models = api.list("token-costs") models = api.list("token-cost")
costs = [] costs = []
@ -29,7 +29,7 @@ def show_config(url, token=None):
try: try:
values = json.loads(api.get([ values = json.loads(api.get([
ConfigKey(type="token-costs", key=model), ConfigKey(type="token-cost", key=model),
])[0].value) ])[0].value)
costs.append(( costs.append((
model, model,

View file

@ -1,5 +1,5 @@
""" """
Starts a processing flow using a defined flow class. Starts a processing flow using a defined flow blueprint.
Parameters can be provided in three ways: Parameters can be provided in three ways:
1. As key=value pairs: --param model=gpt-4 --param temp=0.7 1. As key=value pairs: --param model=gpt-4 --param temp=0.7
@ -19,12 +19,12 @@ import json
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/') default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
default_token = os.getenv("TRUSTGRAPH_TOKEN", None) default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
def start_flow(url, class_name, flow_id, description, parameters=None, token=None): def start_flow(url, blueprint_name, flow_id, description, parameters=None, token=None):
api = Api(url, token=token).flow() api = Api(url, token=token).flow()
api.start( api.start(
class_name = class_name, blueprint_name = blueprint_name,
id = flow_id, id = flow_id,
description = description, description = description,
parameters = parameters, parameters = parameters,
@ -50,9 +50,9 @@ def main():
) )
parser.add_argument( parser.add_argument(
'-n', '--class-name', '-n', '--blueprint-name',
required=True, required=True,
help=f'Flow class name', help=f'Flow blueprint name',
) )
parser.add_argument( parser.add_argument(
@ -115,7 +115,7 @@ def main():
start_flow( start_flow(
url = args.api_url, url = args.api_url,
class_name = args.class_name, blueprint_name = args.blueprint_name,
flow_id = args.flow_id, flow_id = args.flow_id,
description = args.description, description = args.description,
parameters = parameters, parameters = parameters,

View file

@ -194,21 +194,21 @@ def check_processors(url: str, min_processors: int, timeout: int, token: Optiona
return False, f"Processor check error: {e}" return False, f"Processor check error: {e}"
def check_flow_classes(url: str, timeout: int, token: Optional[str] = None) -> Tuple[bool, str]: def check_flow_blueprints(url: str, timeout: int, token: Optional[str] = None) -> Tuple[bool, str]:
"""Check if flow classes are loaded.""" """Check if flow blueprints are loaded."""
try: try:
api = Api(url, token=token, timeout=timeout) api = Api(url, token=token, timeout=timeout)
flow_api = api.flow() flow_api = api.flow()
classes = flow_api.list_classes() blueprints = flow_api.list_blueprints()
if classes and len(classes) > 0: if blueprints and len(blueprints) > 0:
return True, f"Found {len(classes)} flow class(es)" return True, f"Found {len(blueprints)} flow blueprint(s)"
else: else:
return False, "No flow classes found" return False, "No flow blueprints found"
except Exception as e: except Exception as e:
return False, f"Flow classes check error: {e}" return False, f"Flow blueprints check error: {e}"
def check_flows(url: str, timeout: int, token: Optional[str] = None) -> Tuple[bool, str]: def check_flows(url: str, timeout: int, token: Optional[str] = None) -> Tuple[bool, str]:
@ -416,8 +416,8 @@ def main():
) )
checker.run_check( checker.run_check(
"Flow Classes", "Flow Blueprints",
check_flow_classes, check_flow_blueprints,
args.api_url, args.api_url,
args.check_timeout, args.check_timeout,
args.token args.token

View file

@ -32,7 +32,9 @@ class Service(ToolService):
logger.info(f"Got config version {version}") logger.info(f"Got config version {version}")
if "mcp" not in config: return if "mcp" not in config:
self.mcp_services = {}
return
self.mcp_services = { self.mcp_services = {
k: json.loads(v) k: json.loads(v)

View file

@ -13,26 +13,26 @@ class FlowConfig:
# Cache for parameter type definitions to avoid repeated lookups # Cache for parameter type definitions to avoid repeated lookups
self.param_type_cache = {} self.param_type_cache = {}
async def resolve_parameters(self, flow_class, user_params): async def resolve_parameters(self, flow_blueprint, user_params):
""" """
Resolve parameters by merging user-provided values with defaults. Resolve parameters by merging user-provided values with defaults.
Args: Args:
flow_class: The flow class definition dict flow_blueprint: The flow blueprint definition dict
user_params: User-provided parameters dict (may be None or empty) user_params: User-provided parameters dict (may be None or empty)
Returns: Returns:
Complete parameter dict with user values and defaults merged (all values as strings) Complete parameter dict with user values and defaults merged (all values as strings)
""" """
# If the flow class has no parameters section, return user params as-is (stringified) # If the flow blueprint has no parameters section, return user params as-is (stringified)
if "parameters" not in flow_class: if "parameters" not in flow_blueprint:
if not user_params: if not user_params:
return {} return {}
# Ensure all values are strings # Ensure all values are strings
return {k: str(v) for k, v in user_params.items()} return {k: str(v) for k, v in user_params.items()}
resolved = {} resolved = {}
flow_params = flow_class["parameters"] flow_params = flow_blueprint["parameters"]
user_params = user_params if user_params else {} user_params = user_params if user_params else {}
# First pass: resolve parameters with explicit values or defaults # First pass: resolve parameters with explicit values or defaults
@ -49,7 +49,7 @@ class FlowConfig:
if param_type not in self.param_type_cache: if param_type not in self.param_type_cache:
try: try:
# Fetch parameter type definition from config store # Fetch parameter type definition from config store
type_def = await self.config.get("parameter-types").get(param_type) type_def = await self.config.get("parameter-type").get(param_type)
if type_def: if type_def:
self.param_type_cache[param_type] = json.loads(type_def) self.param_type_cache[param_type] = json.loads(type_def)
else: else:
@ -92,7 +92,7 @@ class FlowConfig:
else: else:
resolved[param_name] = str(default_value) resolved[param_name] = str(default_value)
# Include any extra parameters from user that weren't in flow class definition # Include any extra parameters from user that weren't in flow blueprint definition
# This allows for forward compatibility (ensure they're strings) # This allows for forward compatibility (ensure they're strings)
for key, value in user_params.items(): for key, value in user_params.items():
if key not in resolved: if key not in resolved:
@ -100,28 +100,28 @@ class FlowConfig:
return resolved return resolved
async def handle_list_classes(self, msg): async def handle_list_blueprints(self, msg):
names = list(await self.config.get("flow-classes").keys()) names = list(await self.config.get("flow-blueprint").keys())
return FlowResponse( return FlowResponse(
error = None, error = None,
class_names = names, blueprint_names = names,
) )
async def handle_get_class(self, msg): async def handle_get_blueprint(self, msg):
return FlowResponse( return FlowResponse(
error = None, error = None,
class_definition = await self.config.get( blueprint_definition = await self.config.get(
"flow-classes" "flow-blueprint"
).get(msg.class_name), ).get(msg.blueprint_name),
) )
async def handle_put_class(self, msg): async def handle_put_blueprint(self, msg):
await self.config.get("flow-classes").put( await self.config.get("flow-blueprint").put(
msg.class_name, msg.class_definition msg.blueprint_name, msg.blueprint_definition
) )
await self.config.inc_version() await self.config.inc_version()
@ -132,11 +132,11 @@ class FlowConfig:
error = None, error = None,
) )
async def handle_delete_class(self, msg): async def handle_delete_blueprint(self, msg):
logger.debug(f"Flow config message: {msg}") logger.debug(f"Flow config message: {msg}")
await self.config.get("flow-classes").delete(msg.class_name) await self.config.get("flow-blueprint").delete(msg.blueprint_name)
await self.config.inc_version() await self.config.inc_version()
@ -148,7 +148,7 @@ class FlowConfig:
async def handle_list_flows(self, msg): async def handle_list_flows(self, msg):
names = list(await self.config.get("flows").keys()) names = list(await self.config.get("flow").keys())
return FlowResponse( return FlowResponse(
error = None, error = None,
@ -157,7 +157,7 @@ class FlowConfig:
async def handle_get_flow(self, msg): async def handle_get_flow(self, msg):
flow_data = await self.config.get("flows").get(msg.flow_id) flow_data = await self.config.get("flow").get(msg.flow_id)
flow = json.loads(flow_data) flow = json.loads(flow_data)
return FlowResponse( return FlowResponse(
@ -169,23 +169,23 @@ class FlowConfig:
async def handle_start_flow(self, msg): async def handle_start_flow(self, msg):
if msg.class_name is None: if msg.blueprint_name is None:
raise RuntimeError("No class name") raise RuntimeError("No blueprint name")
if msg.flow_id is None: if msg.flow_id is None:
raise RuntimeError("No flow ID") raise RuntimeError("No flow ID")
if msg.flow_id in await self.config.get("flows").keys(): if msg.flow_id in await self.config.get("flow").keys():
raise RuntimeError("Flow already exists") raise RuntimeError("Flow already exists")
if msg.description is None: if msg.description is None:
raise RuntimeError("No description") raise RuntimeError("No description")
if msg.class_name not in await self.config.get("flow-classes").keys(): if msg.blueprint_name not in await self.config.get("flow-blueprint").keys():
raise RuntimeError("Class does not exist") raise RuntimeError("Blueprint does not exist")
cls = json.loads( cls = json.loads(
await self.config.get("flow-classes").get(msg.class_name) await self.config.get("flow-blueprint").get(msg.blueprint_name)
) )
# Resolve parameters by merging user-provided values with defaults # Resolve parameters by merging user-provided values with defaults
@ -200,7 +200,7 @@ class FlowConfig:
def repl_template_with_params(tmp): def repl_template_with_params(tmp):
result = tmp.replace( result = tmp.replace(
"{class}", msg.class_name "{blueprint}", msg.blueprint_name
).replace( ).replace(
"{id}", msg.flow_id "{id}", msg.flow_id
) )
@ -210,7 +210,7 @@ class FlowConfig:
return result return result
for kind in ("class", "flow"): for kind in ("blueprint", "flow"):
for k, v in cls[kind].items(): for k, v in cls[kind].items():
@ -223,7 +223,7 @@ class FlowConfig:
for k2, v2 in v.items() for k2, v2 in v.items()
} }
flac = await self.config.get("flows-active").get(processor) flac = await self.config.get("active-flow").get(processor)
if flac is not None: if flac is not None:
target = json.loads(flac) target = json.loads(flac)
else: else:
@ -237,7 +237,7 @@ class FlowConfig:
if variant not in target: if variant not in target:
target[variant] = v target[variant] = v
await self.config.get("flows-active").put( await self.config.get("active-flow").put(
processor, json.dumps(target) processor, json.dumps(target)
) )
@ -258,11 +258,11 @@ class FlowConfig:
else: else:
interfaces = {} interfaces = {}
await self.config.get("flows").put( await self.config.get("flow").put(
msg.flow_id, msg.flow_id,
json.dumps({ json.dumps({
"description": msg.description, "description": msg.description,
"class-name": msg.class_name, "blueprint-name": msg.blueprint_name,
"interfaces": interfaces, "interfaces": interfaces,
"parameters": parameters, "parameters": parameters,
}) })
@ -281,22 +281,22 @@ class FlowConfig:
if msg.flow_id is None: if msg.flow_id is None:
raise RuntimeError("No flow ID") raise RuntimeError("No flow ID")
if msg.flow_id not in await self.config.get("flows").keys(): if msg.flow_id not in await self.config.get("flow").keys():
raise RuntimeError("Flow ID invalid") raise RuntimeError("Flow ID invalid")
flow = json.loads(await self.config.get("flows").get(msg.flow_id)) flow = json.loads(await self.config.get("flow").get(msg.flow_id))
if "class-name" not in flow: if "blueprint-name" not in flow:
raise RuntimeError("Internal error: flow has no flow class") raise RuntimeError("Internal error: flow has no flow blueprint")
class_name = flow["class-name"] blueprint_name = flow["blueprint-name"]
parameters = flow.get("parameters", {}) parameters = flow.get("parameters", {})
cls = json.loads(await self.config.get("flow-classes").get(class_name)) cls = json.loads(await self.config.get("flow-blueprint").get(blueprint_name))
def repl_template(tmp): def repl_template(tmp):
result = tmp.replace( result = tmp.replace(
"{class}", class_name "{blueprint}", blueprint_name
).replace( ).replace(
"{id}", msg.flow_id "{id}", msg.flow_id
) )
@ -313,7 +313,7 @@ class FlowConfig:
variant = repl_template(variant) variant = repl_template(variant)
flac = await self.config.get("flows-active").get(processor) flac = await self.config.get("active-flow").get(processor)
if flac is not None: if flac is not None:
target = json.loads(flac) target = json.loads(flac)
@ -323,12 +323,12 @@ class FlowConfig:
if variant in target: if variant in target:
del target[variant] del target[variant]
await self.config.get("flows-active").put( await self.config.get("active-flow").put(
processor, json.dumps(target) processor, json.dumps(target)
) )
if msg.flow_id in await self.config.get("flows").keys(): if msg.flow_id in await self.config.get("flow").keys():
await self.config.get("flows").delete(msg.flow_id) await self.config.get("flow").delete(msg.flow_id)
await self.config.inc_version() await self.config.inc_version()
@ -342,14 +342,14 @@ class FlowConfig:
logger.debug(f"Handling flow message: {msg.operation}") logger.debug(f"Handling flow message: {msg.operation}")
if msg.operation == "list-classes": if msg.operation == "list-blueprints":
resp = await self.handle_list_classes(msg) resp = await self.handle_list_blueprints(msg)
elif msg.operation == "get-class": elif msg.operation == "get-blueprint":
resp = await self.handle_get_class(msg) resp = await self.handle_get_blueprint(msg)
elif msg.operation == "put-class": elif msg.operation == "put-blueprint":
resp = await self.handle_put_class(msg) resp = await self.handle_put_blueprint(msg)
elif msg.operation == "delete-class": elif msg.operation == "delete-blueprint":
resp = await self.handle_delete_class(msg) resp = await self.handle_delete_blueprint(msg)
elif msg.operation == "list-flows": elif msg.operation == "list-flows":
resp = await self.handle_list_flows(msg) resp = await self.handle_list_flows(msg)
elif msg.operation == "get-flow": elif msg.operation == "get-flow":

View file

@ -52,7 +52,7 @@ class Processor(FlowProcessor):
self.prices = {} self.prices = {}
self.config_key = "token-costs" self.config_key = "token-cost"
# Load token costs from the config service # Load token costs from the config service
async def on_cost_config(self, config, version): async def on_cost_config(self, config, version):