Multi-Agent Orchestration
NANDA's orchestration layer enables you to compose multi-agent workflows as directed acyclic graphs (DAGs) — routing tasks to the best agents, delegating sub-tasks, streaming results, and resolving conflicts automatically.
draft status and must be set to active before runs can be executed.Creating a Workflow
curl -X POST https://nanda.nexartis.com/api/orchestration \
-H "Content-Type: application/json" \
-d '{
"name": "Research & Summarize",
"ownerId": "my-app",
"dag": {
"nodes": [
{ "id": "search", "type": "task", "data": {
"stepType": "agent_call", "agentId": "search-agent"
}},
{ "id": "summarize", "type": "task", "data": {
"stepType": "agent_call", "agentId": "summarize-agent"
}}
],
"edges": [
{ "source": "search", "target": "summarize" }
]
}
}' DAG Validation
All workflow DAGs are validated using Kahn's algorithm for topological sorting. The validator checks for:
- No cycles — topological sort must include all nodes
- No duplicate node IDs
- All edge references exist — source and target must be valid node IDs
- At least one root node — nodes with no incoming edges
The validation result includes the executionOrder (topological sort), rootNodes, and leafNodes.
Workflow Lifecycle
draft
Created, not yet runnable
active
Ready for execution
running
Run in progress
completed / failed / cancelled
Terminal states
Runs can be cancelled externally — the engine checks the run status before each step and at finalization to respect concurrent cancellation.
Step Execution
Steps are executed via a pluggable StepExecutor interface. Each step receives the workflow run input and a map of outputs from completed predecessor steps. Step configuration:
| Field | Description |
|---|---|
stepType | Execution type (e.g. agent_call) |
agentId | Target agent for this step |
action | Action to invoke on the agent |
timeoutMs | Step timeout (default: 30000ms) |
retryCount | Number of retries on failure (default: 0) |
retryDelayMs | Delay between retries (default: 1000ms) |
condition | Optional conditional execution rules |
Workflow Features
DAG Engine
Kahn's algorithm for cycle detection and topological ordering. Parallel branches execute
concurrently via Promise.all. All state persisted in D1.
A2A Routing
Multi-strategy agent selection using trust scores, latency, capability match, and geographic
proximity. POST /api/orchestration/route
Sub-Agent Delegation
Delegate tasks to specialized sub-agents with progress tracking and result aggregation. POST /api/orchestration/delegate
Conflict Resolution
Automatic and manual conflict resolution when agents produce conflicting results. Strategies: first-wins, majority-vote, highest-trust, manual.
Patterns & Templates
Pre-built orchestration patterns: fan-out, pipeline, consensus, map-reduce. Create custom
patterns via POST /api/orchestration/patterns.
API Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /api/orchestration | Create workflow |
| GET | /api/orchestration | List workflows |
| GET | /api/orchestration/:id | Get workflow details |
| PATCH | /api/orchestration/:id | Update workflow |
| DELETE | /api/orchestration/:id | Delete workflow |
| POST | /api/orchestration/:id/runs | Start run |
| GET | /api/orchestration/:id/runs | List runs |
| GET | /api/orchestration/runs/:runId | Run details |
| POST | /api/orchestration/route | Route to best agent |
| POST | /api/orchestration/delegate | Delegate task |
| POST | /api/orchestration/conflicts | Raise conflict |
| GET | /api/orchestration/patterns | List patterns |
MCP Integration
Orchestration is available via MCP tools: nanda_create_workflow and nanda_run_workflow. Connect your AI assistant directly to the orchestration engine.