Skip to content

Multi-Agent Patterns

Delegate work to another agent by reference. The parent flow pauses while the sub-agent executes, then resumes with the result.

{
"type": "agent_ref",
"data": {
"type": "agent_ref",
"agentRef": "research-assistant",
"refType": "slug",
"inputMapping": { "message": "{{input.query}}" },
"outputVariable": "research_result",
"inheritContext": true,
"timeout": 60000
}
}

Map parent variables to sub-agent inputs using {{variable}} interpolation.

When inheritContext is true, the sub-agent receives the parent’s user context (userId, session, etc.).

Run multiple agents and combine their outputs using a strategy.

StrategyBehavior
best_ofRun all agents, use an evaluator LLM to pick the best response
aggregateConcatenate all responses
voteReturn the most common response
fastestReturn the first response that completes
{
"type": "agent_pool",
"data": {
"type": "agent_pool",
"agents": [
{ "ref": "writer-agent", "refType": "slug" },
{ "ref": "editor-agent", "refType": "slug" }
],
"strategy": "best_of",
"evaluationPrompt": "Pick the response with the best writing quality.",
"evaluatorModelId": "openai/gpt-4o",
"maxConcurrency": 3,
"agentTimeout": 30000
}
}

Process an array of items in parallel, then combine results.

  1. Map: For each item in the input array, run a sub-agent
  2. Reduce: Combine all results using a strategy
{
"type": "map_reduce",
"data": {
"type": "map_reduce",
"inputVariable": "articles",
"mapAgentRef": "summarizer",
"mapAgentRefType": "slug",
"itemTemplate": "Summarize this article: {{item.title}}\n\n{{item.content}}",
"reduceStrategy": "concatenate",
"maxConcurrency": 5
}
}
StrategyBehavior
concatenateJoin all results with newlines
mergeDeep merge JSON results
customUse reduceExpression to combine