In plain terms
A team is several AI agents working together — like a department instead of a single employee. One agent researches, another writes, a third reviews. A team coordinates them so the customer gets one polished answer. You choose how they cooperate:- Coordinate — a manager splits the work and merges the results (“you research, you draft, you edit”).
- Route — a receptionist sends each request to the right specialist (“billing question → billing agent”).
- Broadcast — ask everyone at once and combine their answers (good for second opinions).
- Collaborate — the agents discuss until they agree (for high-stakes decisions).
The analogy: one agent is an employee; a team is the org chart. You use a team when a job is too big or too varied for one specialist.Teams enable multiple agents to work together. Choose how tasks are distributed: an orchestrator can pick agents, route to the best one, broadcast to all, or run iterative collaboration rounds.
Read usage and cost
Setcost: true in the constructor and read result.costs after run(). Child Agents use the same accounting context. The parent snapshot includes its descendants once. Use cost: { budget: { maxCostPerRun: 0.50 } } for a simple USD threshold, or pass a shared costTracker for durable history and shared budgets. Set either cost or costTracker.
Close the component after its work has finished to drain its owned tracker. Supplied trackers and stores remain caller-owned. See cost accounting.
Multi-Agent Collaboration
Coordinate
An orchestrator model picks which member agent handles the task.
Route
Routes to the single best agent based on input.
Broadcast
Sends input to ALL agents and merges results.
Collaborate
Iterative rounds between agents (maxRounds configurable).
TeamMode
TeamConfig
Member agents. Remote A2A agents are allowed — the team treats them like local ones.
Put this team in the global registry (HTTP transport discovers it).
false for tests.Shared memory. A member that has no
memory of its own uses this, so Researcher and Writer can see the same facts.Methods
SameRunOpts as agent.run() (sessionId, userId, tenantId, metadata, apiKey, signal, dependencies).
Getters:
name, mode, members, eventBus.
Basic Example
Next Steps
Coordinate Mode
Orchestrator picks which agent handles each task.
Route Mode
Route to the single best agent.
Broadcast Mode
All agents process; merge results.
Collaborate Mode
Iterative rounds between agents.