Roles, Contracts, and Handoffs

The last lesson showed why a team can help. This lesson covers how to split the work without creating a messy crowd.

The rule is simple: every agent needs a precise job and a clear interface.

Intuition

Four reasons to split

Reason What it buys in the Paris trip
Specialisation The flight agent thinks only about fares and routes.
Parallelism Flight and hotel searches can run at the same time.
Context isolation The policy agent sees only the relevant clauses, not the whole chat.
Verification A budget agent checks numbers before anyone books.

If none of these four apply, keep one agent.

Precise roles

Hard to delegate:

travel_agent: handle the trip

Problems:

Easy to delegate:

flight_agent: find economy flights BOM→CDG under the remaining budget

This version:

What is an agent?

In this chapter, an agent is not "a clever model." It is a small package with five parts:

Part Meaning
Role What it is responsible for
Model The language model that reasons for it
Tools The only functions it may call
State What it keeps between its own steps
Contract What it accepts, returns, and promises
{
  "role": "Find flights to Paris",
  "model": "small-llm",
  "tools": ["search_flights"],
  "state": {"shortlist": []},
  "contract": {
    "input": {"date": "date", "max_price": "number"},
    "output": "ranked_flights (top 3)",
    "limits": ["economy", "read-only"]
  }
}

Read that file as a job description:

The contract is the important part. It is the interface other agents rely on.

Handoffs

A handoff is the message that starts a specialist's work. It should carry only what that specialist needs.

{
  "task_id": "paris_17",
  "goal": "Find a compliant flight",
  "constraints": {
    "date": "2026-10-15",
    "remaining_budget": 50000
  },
  "return_format": "ranked_flights"
}

Three design rules:

Rule Why it matters
Only what is needed Send the goal, constraints, and inputs — not the whole conversation.
Structured output Ask for a fixed shape the coordinator can compare and check.
Clear ownership Say who may change a decision, and who may only recommend.
flowchart LR C[Coordinator] -->|small handoff| F[flight_agent] F -->|ranked_flights| C C -->|small handoff| H[hotel_agent] H -->|ranked_hotels| C

If the flight agent also received the user's jokes, the full policy PDF, and yesterday's hotel debate, two things happen: cost rises, and the specialist is more likely to wander.

What goes wrong

One-line summary

Split work only when a specialist, a parallel search, a smaller context, or a checker helps; then give each agent a role, a contract, and a small structured handoff.

Key terms