Outcomes and multi-agent
Built.
Outcomes
An outcome tells the agent what "done" means and lets a separate grader check the work against it. Use one when a session produces a single checkable thing: a report, a set of changes, a dataset.
Send user.define_outcome with a rubric, as text or as a file:
await client.beta.sessions.events.send(session.id, {
events: [{
type: "user.define_outcome",
description: "A sourced analysis of the company at https://example.com",
rubric: { type: "text", content: "- Covers offer, market, competitors and risks\n- Every claim has a source\n- Ends with three recommendations" },
}],
});
The agent works, the grader evaluates, and the agent revises until the grader returns one of:
| Result | Meaning |
|---|---|
satisfied |
The rubric is met |
needs_revision |
The agent goes round again |
max_iterations_reached |
It stopped without passing |
Each grader run appears as span.outcome_evaluation_start and span.outcome_evaluation_end. Write five to ten concrete criteria that can each be checked on their own.
For conversation and question-answering, use user.message and no outcome.
Multi-agent
A coordinator is an agent that can hand work to other agents.
const researcher = await client.beta.agents.create({ name: "Researcher", model: "claude-opus-5-5", description: "Finds facts" });
const lead = await client.beta.agents.create({
name: "Lead",
model: "claude-opus-5-5",
multiagent: { type: "coordinator", agents: [researcher.id] },
});
- The coordinator gets one tool per callable agent, named
call_agent__<name>. - Each call runs as a thread: a child session with its own conversation, sharing the coordinator's sandbox and files.
- The coordinator's stream shows
session.thread_createdandsession.thread_idle. - List threads with
GET /v1/sessions/{id}/threads; read a thread's events at/v1/sessions/{thread_id}/events. - One level only. A coordinator cannot call another coordinator; creating one that tries is a 400.
- Deleting the coordinator's session deletes its threads, and the certificate lists each one.
Difference from Claude Managed Agents
MAA v1 uses multiagent: {type: "coordinator", agents: [...]}. The current upstream API has a newer shape with rosters and background workflow runs. MAA does not implement that yet; see Compatibility.