Skip to main content
A multi-agent system where a supervisor agent analyzes incoming messages and routes them to specialized agents — sales, support, or billing. Each specialist has its own tools, knowledge base, and personality. This pattern is ideal when a single agent can’t handle all scenarios well.

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-in agents 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 — use gpt-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 (like create-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

Next Steps

Agents

Supervisor pattern details

Customer Support

Single-agent support example

Sales Automation

Sales workflow example

Best Practices

Tips for effective agents