Skip to main content
Multi-agent orchestration lets one agent act as a coordinator agent that delegates tasks to one or more child threads within the same session. The coordinator agent receives user input and organizes the work, while each child thread runs its subtask under a designated agent configuration and returns the result. The workflow covered on this page is: configure delegatable agents, create a session, send a task, observe the child threads spawned by the model, and read each thread’s status and events.

When to use multi-agent orchestration

Use multi-agent orchestration when a task breaks cleanly into well-bounded subtasks, or when different subtasks require different agent configurations. Common use cases include:
  • Processing independent sources or subtasks in parallel and having the coordinator agent synthesize the final output.
  • Delegating specialized work such as code review or source retrieval to agents equipped with dedicated tools or skills.
  • Running multiple instances of the same agent configuration to handle separate inputs concurrently.
  • Inspecting or auditing the execution trace of each subtask independently.
If a task does not need to be split up, use a single agent and session directly. Multi-agent orchestration adds overhead in agent configuration, thread management, and event observation—avoid splitting simple tasks just to involve multiple agents.

Coordinator agent and child threads

When you create a session, the platform creates a coordinator thread. It serves as the session’s default entry point and handles user input submitted through session-level endpoints. When the coordinator agent decides to delegate work, the platform creates child threads inside the same session. Each child thread executes the subtask assigned by the coordinator agent and returns its result to the coordinator agent.
Agents, sessions, and threads have distinct responsibilities: The coordinator thread and child threads belong to the same session, but each thread maintains its own status, event history, and live event stream. Sharing an execution environment does not mean sharing the full model context. A coordinator agent can spawn child threads, whereas child threads cannot spawn further nested threads.

Configure delegatable agents

When creating or updating a coordinator agent, declare the agents it can delegate to in multiagent.agents. Use type to specify the reference source:
  • type: "agent": References another existing agent. Set id to that agent’s ID; version is optional, and if omitted, the platform pins its latest version at write time.
  • type: "self": References the coordinator agent itself so child threads reuse the coordinator agent’s currently pinned version and configuration; id is not required.
On creation, agents must contain 1–20 entries. On update, pass agents: [] to clear the delegation roster. Referencing the same agent more than once, using duplicate display names, referencing an archived agent, or referencing an agent that itself has multiagent configured fails at write time. Updating a referenced agent afterward does not alter an already saved delegation configuration. To have the coordinator agent use a newer version of a referenced agent, update the coordinator agent to generate a new immutable version.

Create a coordinator agent

The example below creates a coordinator agent and pins its roster of delegatable agents at creation time. This request neither spawns child threads nor creates the referenced agents: replace agent_researcher with an agent ID that already exists in your project. The self entry in the roster allows the coordinator agent to spawn child threads that reuse its own pinned version and configuration.
Once created, id in the response is the coordinator agent’s ID, which you pass when creating a session. multiagent.agents in the response shows the pinned agent versions; because self resolves to the coordinator agent itself at write time, the list also includes an entry pointing to the coordinator agent’s own ID and version. The snippet below shows only the fields needed for the rest of this guide—refer to the OpenAPI specification for the full response schema:
Save the coordinator agent’s id for creating a session next:

Create and run a session

Create a session

Create a session with the coordinator agent from the previous step and an execution environment. Replace env_xxx with the ID of an actual execution environment.
Once created, id in the response is the session ID used to send tasks and query threads:

Send a task

Send a user.message event through the session events endpoint. Pass message content as a content array where each content block declares its own type.
Clients submit user messages only to the session. When the request succeeds, the platform wakes the coordinator thread. Based on the task and its configured delegation roster, the coordinator agent’s model decides whether to delegate, which agent to select, and how many child threads to spawn. When the model calls spawn_subagent, the platform creates the child thread in the same session and starts execution.

Synchronous and asynchronous delegation

You guide delegation through agent configuration and instructions rather than supplying tool arguments directly. spawn_subagent is a runtime tool invoked by the model, not a REST API endpoint called by clients. If your client needs deterministic control over subtask inputs and execution order, orchestrate multiple session calls from your client instead of using multi-agent delegation. An example spawn_subagent tool input looks like this:
Field descriptions:
  • agent_type is required with no default value—it specifies the display name of an agent in the delegation roster.
  • description is a short label identifying the subtask.
  • prompt provides the full instructions needed for the child thread to carry out the subtask.
  • run_in_background: false runs the child thread synchronously and is the default behavior.
  • run_in_background: true runs the child thread asynchronously.

Synchronous delegation

Synchronous delegation waits until the child thread returns a report, enters idle, or terminates before the coordinator agent resumes execution. Use synchronous delegation when subsequent steps depend directly on the child thread’s output.

Asynchronous delegation

Asynchronous delegation returns immediately once the child thread is created and starts running. When the child thread finishes a turn, it delivers its report back to the coordinator agent, which can continue doing other work in the meantime or wait for messages. The tool result for asynchronous delegation is a text message containing the child thread ID and follow-up instructions:
The text above illustrates the model-side tool result; exact wording is determined at runtime. After finishing its work, a child thread remains idle and is not deleted automatically; the coordinator agent can call delete_subagent to terminate it, transitioning the thread status to terminated. If follow-up work is needed on the same subtask, the coordinator agent can reuse the child thread by sending further messages with send_message. Clients cannot send messages directly to child threads.

Send messages between agents

All inter-agent messages in Kimi Hosted Agents are routed through the coordinator thread. The coordinator thread can send a message to a specific child thread or broadcast to all child threads, whereas child threads can only send results or questions back to the coordinator thread. Child threads cannot communicate directly with each other or send messages across sessions.

Send messages: send_message

The coordinator agent can message a specific child thread or broadcast to all child threads:
To broadcast to all child threads, set agent_id to all:

Wait for messages: wait_for_message

The coordinator agent—or an asynchronous child thread participating in message-based collaboration—can call wait_for_message to wait for incoming messages:
When a child thread report arrives, the tool result text includes the message count, source thread, and body:
The snippet above illustrates the model-side message result. On the client side, you can read the source thread (from_session_thread_id) and source agent display name (from_agent_name) from the agent.thread_message_received event payload. To inspect the child thread’s full execution trace, read the thread’s event history rather than relying on the wait_for_message return text.

Shared resources and context isolation

Agents, sessions, and threads manage configuration at different scopes: Each child thread runs with the pinned version and configuration of its selected agent. Session-bound resources such as files, vaults, and memory stores are managed through session configuration; see Create a Session for how to bind them. Session-level agent_overrides apply only to the current session and do not modify any stored agent resource. Setting agent_overrides.roster when creating a session replaces the delegation roster and pins the referenced versions for this session. Other agent_overrides fields (such as model, system, tools, mcp_servers, skills, and plugins) take effect only on the coordinator thread and are not propagated to child threads, including self entries. Each child thread runs the agent version pinned in the effective roster for the session.

Observe threads and events

After sending a task, you can observe overall progress on the coordinator thread through the session-level event stream. To inspect detailed activity on a child thread, first list the threads in the session and then query the target thread using its id.

List threads in a session

Threads are returned with the coordinator thread first, followed by child threads in creation order:
Use id from the list response for subsequent thread queries. The coordinator thread has no parent_thread_id, whereas child threads point to their parent thread via parent_thread_id. If the response includes next_page_token, fetch subsequent pages rather than assuming the current page contains all threads.

Get thread details

Set $THREAD_ID to the id of the target thread from the thread list:
The status field in the response indicates whether the thread is still running:

Read thread event history

The event history shows the thread’s status transitions and message exchanges:
The thread creation event session.thread_created is recorded only in the coordinator thread’s history—observe it through the session-level event stream (coordinator thread), as it does not appear in the child thread’s own event history. The response above highlights only the event fields relevant to multi-agent orchestration. For the full set of event types, fields, and pagination rules, see Event Stream.

Subscribe to live thread events

Live thread events include status transitions such as:
The frame above illustrates how to observe events; actual event fields and ordering follow runtime behavior. The id: line in each SSE frame is a numeric resume cursor that lets you resume streaming after a disconnect; see Event Stream for details. Use session_thread_id in the event payload to identify which thread an event belongs to. A thread cursor is valid only for that specific thread’s event stream and cannot be used across other threads or sessions.

Archive a child thread

You can archive a child thread to terminate it and cancel any in-flight execution without waiting for it to become idle. The coordinator thread cannot be archived separately; archive the session instead.
The endpoint responds with 204 No Content on success. Archiving a thread does not delete its event history.

Event sequence of a delegation

A typical asynchronous delegation produces events in roughly the following order:
Exact event ordering varies with synchronous vs. asynchronous delegation, task execution behavior, and error handling. Use this sequence as a guide to what to look for rather than assuming every run emits an identical sequence.

Best practices

Define clear task boundaries for child threads

In prompt, state the inputs, expected outputs, success criteria, and what supporting evidence to retain. For example:

Configure only the agents you need

Only add agents to the roster if the coordinator agent genuinely needs to delegate to them. Adding unnecessary agents gives the model more candidates to choose from and increases the effort required to maintain the roster.

Standardize the report format

Instruct child threads to return reports using a consistent structure:
A consistent report structure reduces formatting variance and extraneous text when the coordinator agent synthesizes results.

Audit with thread-level event streams

Do not rely solely on the coordinator agent’s final summary. When debugging or auditing, list the threads in the session and inspect each target child thread’s event history and live event stream independently.

Next steps

Configure agents and delegation

Configure agents, tools, and multi-agent delegation rosters.

Start a multi-agent session

Create a session and submit task inputs.

Inspect thread events

Read event history, subscribe to SSE streams, and resume from cursors.

Explore the investment research team design

See the full design of the official multi-agent investment research team.