We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking "Accept", you agree to our use of cookies.
Learn more.

Multi-Agent

Multi-agent orchestration uses a coordinating agent that delegates work to specialist agents. Unlike routing (which classifies once and calls one handler), the orchestrator runs a reasoning loop: it may call multiple specialists across multiple iterations, passing results between them, until the overall goal is met.

Each specialist is a separate durable task with its own prompt, tools, timeout, and retry settings. The orchestrator’s LLM decides which specialist to call next based on the accumulated context.

When to use

ScenarioFit
Complex tasks needing different expertise (research + code + writing)Good: each specialist focuses on one domain
Customer service with support, sales, and billing specialistsGood: orchestrator picks the right expert per turn
Tasks where output from one specialist feeds the nextGood: orchestrator passes context between calls
Simple tasks a single agent can handle end-to-endSkip: orchestration overhead isn’t worth it
Specialists always run in a fixed sequenceUse LLM Pipelines instead

How it maps to Hatchet

The orchestrator is a durable task running a reasoning loop via child spawning. Each specialist is a standalone durable task spawned as a child run. The orchestrator’s LLM returns structured tool calls, and each tool name maps to a specialist task.

Because each specialist call is a child run, the orchestrator’s slot is freed while specialists execute. If the orchestrator dies mid-loop, it resumes from the last checkpoint without re-running completed specialist calls.

Step-by-step walkthrough

Define the specialist tasks

Each specialist is a standalone durable task with its own prompt and timeout. They run independently and can be reused across different orchestrators.

Orchestrator loop

The orchestrator runs a reasoning loop: call LLM, parse tool choice, spawn specialist, observe result, repeat. Context accumulates across iterations so later specialist calls have full history.

Run the worker

Register all specialists and the orchestrator, then start the worker.

⚠️

Always set a max iteration count and execution timeout on the orchestrator. Without bounds, the loop can call specialists indefinitely.

Multi-agent vs. routing

Multi-agentRouting
Specialist callsMultiple, across loop iterationsOne per request
OrchestrationReasoning loop, LLM decides next step dynamicallyClassify once, route once
Use whenTask needs multiple types of expertiseTask fits a single specialist

Next Steps