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.

Key concepts: Workflows → Steps → Runs → Step Runs. Each step targets an agent and action, with optional dependencies forming the DAG. Workflows start in 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:

FieldDescription
stepTypeExecution type (e.g. agent_call)
agentIdTarget agent for this step
actionAction to invoke on the agent
timeoutMsStep timeout (default: 30000ms)
retryCountNumber of retries on failure (default: 0)
retryDelayMsDelay between retries (default: 1000ms)
conditionOptional 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

MethodPathDescription
POST/api/orchestrationCreate workflow
GET/api/orchestrationList workflows
GET/api/orchestration/:idGet workflow details
PATCH/api/orchestration/:idUpdate workflow
DELETE/api/orchestration/:idDelete workflow
POST/api/orchestration/:id/runsStart run
GET/api/orchestration/:id/runsList runs
GET/api/orchestration/runs/:runIdRun details
POST/api/orchestration/routeRoute to best agent
POST/api/orchestration/delegateDelegate task
POST/api/orchestration/conflictsRaise conflict
GET/api/orchestration/patternsList 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.

See also Resolution & Discovery for adaptive agent routing · MCP Tools for programmatic access · Trust & Security for agent trust scores used in routing
Related reading Self-Improving Agents — autonomous optimization through multi-agent workflows · A New Architecture — the infrastructure vision powering agent orchestration

Coming Soon

By Invitation Only