Project Structure
Step 1: Specialist Agents
Each specialist handles a specific domain with its own tools and instructions.Sales Agent
agents/sales.ts
Support Agent
agents/support.ts
Billing Agent
agents/billing.ts
Step 2: Supervisor Agent
The supervisor uses the built-inagents config to automatically route to specialists:
supervisor.ts
Step 3: Tools
Shared tools used by multiple specialists:tools/search-orders.ts
tools/check-invoice.ts
tools/create-ticket.ts
tools/index.ts
Step 4: Main Entry Point
main.ts
How It Works
Key Patterns
Cheap Supervisor, Quality Specialists
The supervisor only needs to classify intent — usegpt-4o-mini (fast, cheap). Specialists do the real work — use gpt-4o for quality responses.
Built-in agents Config
Runflow’s agents config handles routing automatically. You define specialists inline and the supervisor routes based on its instructions:
Shared Tools Across Specialists
Some tools (likecreate-ticket) are used by multiple specialists. Define them once in tools/ and assign to each agent that needs them.
Conversation Continuity
Memory is shared across the supervisor session. If a customer starts with a support question and then asks about billing, the context carries over — the billing agent knows what was discussed before.When to Use Multi-Agent
| Scenario | Use |
|---|---|
| Single-purpose bot (FAQ, scheduling) | Single agent |
| Multiple domains with different tools/knowledge | Multi-agent |
| Complex routing with fallbacks | Multi-agent |
| Different response styles per department | Multi-agent |
Next Steps
Agents
Supervisor pattern details
Customer Support
Single-agent support example
Sales Automation
Sales workflow example
Best Practices
Tips for effective agents