What we’re building
A two-tier agent:- Tier 1 — handles common questions. Cheap model, narrow tools, fast.
- Tier 2 — handles escalations. Strong model, full tool access, HITL when uncertain.
Step 1 — Configure the agents
catalog/agents/support-classifier/agent.json:
catalog/agents/support-tier-1/agent.json:
catalog/agents/support-tier-2/agent.json:
stripe.issue_refund, escalate_to_human — should always
require permission.
Step 2 — Connect MCP servers
Step 3 — Build the routing flow
In your application code:Step 4 — Tier 1 in action
A tier-1 ticket: “How do I reset my password?”Step 5 — Tier 2 in action
A tier-2 ticket: “I was charged twice for last month’s subscription. Refund the duplicate.”Step 6 — Feedback into the loop
When a support agent (the human) reviews the AI’s response, they can submit feedback:Step 7 — Add evals
stripe.issue_refund.
Improvements worth making
Customer context loading
At task start, fetch customer state (subscription tier, recent issues, support history) and prepend to context. The agent’s first turn is better when it already knows who it’s talking to.Sentiment-aware escalation
Add a sentiment-detection step in the classifier. Angry customers go to tier 2 even for tier-1-classified categories.Multi-channel support
Connect Slack, email, and in-app chat as MCP servers. Thesend_response tool routes by channel. The same agent handles all
channels.
Continuous learning
The Learning Centre processes trajectories everyLC_BATCH_INTERVAL_HOURS. After a few weeks, the knowledge store has
hundreds of facts: “When user X reports Y, the answer is Z.”
Surface stats in your dashboard so you can see the learning curve.
Pitfalls
- The agent issues a refund without HITL. Audit catalog —
stripe.issue_refundshould haverequires_permission: true. - The agent escalates everything. Tighten the classifier’s tier-1 category. Add eval cases for borderline tickets.
- The agent loops on knowledge search. Cap retrieval depth in the system prompt: “If knowledge_search returns no relevant results, escalate to a human.”
- The agent leaks one customer’s data to another. Each Engine instance is single-user; multi-tenant isolation is upstream. Make sure your routing layer never lets a tier-2 agent for user A see data from user B.
See also
- Build a coding agent — same pattern, different tools.
- Build a research agent — uses structured outputs.
- MCP connectors — Linear, Stripe, etc.
- Multi-agent patterns — the classifier-routes-to-tier pattern.
- Permissions — gating refunds.

