Workflow Development
This guide teaches you how to develop workflows in Solace Agent Mesh that orchestrate multiple agents to accomplish complex, multi-step tasks.Understanding Workflows
Workflows in Solace Agent Mesh:- Coordinate multiple agents to accomplish complex tasks
- Support sequential, parallel, and conditional execution
- Handle errors and retries automatically
- Maintain state across multiple steps
- Can be invoked by other agents like any other agent
- Are themselves discoverable agents in the mesh
Workflow Concepts
Workflow Structure
Node Types
- agent: Delegate a task to an agent
- switch: Conditional branching
- map: Iterate over arrays
Execution Flow
- Nodes execute when their dependencies complete
- Use
depends_onto define execution order - Parallel execution happens automatically when possible
Creating Your First Workflow
log:
stdout_log_level: INFO
log_file_level: DEBUG
log_file: simple_workflow.log
!include shared_config.yaml
apps:
- name: simple_workflow_app
app_base_path: .
app_module: solace_agent_mesh.workflow.app
broker:
<<: *broker_connection
app_config:
namespace: ${NAMESPACE}
name: "SimpleWorkflow"
display_name: "Simple Data Processing Workflow"
# Timeout configurations
max_workflow_execution_time_seconds: 300 # 5 minutes total
default_node_timeout_seconds: 60 # 1 minute per node
workflow:
version: "1.0.0"
description: |
A simple workflow that processes data through multiple steps:
1. Fetches data from a source
2. Processes the data
3. Generates a report
workflow:
input_schema:
type: object
properties:
data_source:
type: string
description: "URL or path to data source"
report_format:
type: string
enum: ["pdf", "html", "excel"]
description: "Desired report format"
required: ["data_source"]
output_schema:
type: object
properties:
report_file:
type: string
description: "Name of the generated report"
summary:
type: string
description: "Executive summary"
record_count:
type: integer
description: "Number of records processed"
required: ["report_file", "summary"]
workflow:
nodes:
# Step 1: Fetch data
- id: fetch_data
type: agent
agent_name: "DataFetcherAgent"
instruction: "Fetch data from the specified source and save as CSV."
input:
source: "{{workflow.input.data_source}}"
# Step 2: Process data
- id: process_data
type: agent
agent_name: "DataProcessorAgent"
depends_on: [fetch_data] # Wait for fetch to complete
instruction: "Clean and process the data, remove duplicates, and validate."
input:
data_file: "{{fetch_data.output.filename}}"
# Step 3: Generate report
- id: generate_report
type: agent
agent_name: "ReportGeneratorAgent"
depends_on: [process_data] # Wait for processing
instruction: "Generate a report in the requested format with visualizations."
input:
data_file: "{{process_data.output.filename}}"
format: "{{workflow.input.report_format}}"
workflow:
output_mapping:
report_file: "{{generate_report.output.report_filename}}"
summary: "{{generate_report.output.summary}}"
record_count: "{{process_data.output.total_records}}"
workflow:
skills:
- id: "data_processing_workflow"
name: "Data Processing Workflow"
description: "Fetch, process, and report on data from various sources"
examples:
- "Process the sales data and generate a report"
- "Fetch customer data from the API and create an analysis"
tags: ["data", "reporting", "etl"]
session_service:
<<: *default_session_service
artifact_service:
<<: *default_artifact_service
agent_card_publishing: { interval_seconds: 10 }
agent_discovery: { enabled: true }
Workflow Patterns
Sequential Processing
Steps execute one after another:Parallel Execution
Independent steps run simultaneously:Conditional Branching
Route execution based on conditions:Map Iteration
Process arrays in parallel:Complete Example: Customer Onboarding Workflow
Here’s a complete workflow for customer onboarding:customer_onboarding_workflow.yaml
Template Variables
Workflows support powerful template expressions:Workflow Inputs
Node Outputs
Map Variables
Coalesce
Get first non-null value:Error Handling
Workflows automatically handle errors:Exit Handlers
Run cleanup or notifications regardless of success/failure:Best Practices
Testing Workflows
curl -X POST http://localhost:8080/api/v1/tasks \
-H "Content-Type: application/json" \
-d '{
"agent_name": "MyWorkflow",
"message": "Process the test data"
}'
Troubleshooting
Debug Logging
Validate Configuration
Next Steps
- Creating Custom Agents - Build workflow-compatible agents
- Creating Custom Tools - Add specialized tools to agents
- Building Gateways - Trigger workflows from external systems
- MCP Integration - Enhance agents with MCP tools
Real-World Examples
Explore workflow examples in the source:examples/workflows/level1_simple_sequential.yaml- Basic sequential workflowexamples/workflows/level2_parallel_execution.yaml- Parallel processingexamples/workflows/level3_conditional_branching.yaml- Conditional logicexamples/workflows/level4_map_iteration.yaml- Array processingexamples/workflows/level7_error_handling.yaml- Error handling patterns