Fleet mode is Copilot's parallel orchestration pattern for work that can be split across independent sub-agents. In the runtime research notes, fleet mode is described as "the runtime's built-in pattern for dispatching multiple sub-agents in parallel via the task tool, with SQL todos as the shared coordination state." Use it when one parent session should coordinate several workers, collect their results, and continue the conversation with the combined context.
Fleet mode is useful when the work can be decomposed before execution and each unit can run without waiting for the others.
Good fits include:
Avoid fleet mode for:
Fleet mode works best when the parent session can create clear units of work, assign one owner per unit, and define what each worker must return.
The SDK exposes fleet mode through the session RPC namespace in several languages. The binding is experimental in the generated RPC surface; pin both the SDK and the Copilot runtime if your application depends on it.
The wire method is session.fleet.start. The optional prompt is combined with the runtime's fleet orchestration instructions.
const result = await session.rpc.fleet.start({
prompt: "Refactor each SDK package independently, then summarize the changes.",
});
if (result.started) {
console.log("Fleet mode started");
}
from copilot import CopilotClient
from copilot.rpc import FleetStartRequest
from copilot.session import PermissionHandler
client = CopilotClient(mode="coding-agent")
session = await client.create_session(
permissions={"on_request": PermissionHandler.approve_all}
)
result = await session.rpc.fleet.start(
FleetStartRequest(
prompt="Review each service independently, then summarize the risks."
)
)
if result.started:
print("Fleet mode started")
package main
import (
"context"
"fmt"
copilot "github.com/microsoft/copilot-sdk/go/v2"
"github.com/microsoft/copilot-sdk/go/v2/rpc"
)
func main() {
_ = run(context.Background())
}
func run(ctx context.Context) error {
client := copilot.NewClient(&copilot.ClientOptions{Mode: copilot.ModeCodingAgent})
session, err := client.CreateSession(ctx, &copilot.CreateSessionOptions{})
if err != nil {
return err
}
prompt := "Update each package independently, then report validation results."
result, err := session.RPC.Fleet.Start(ctx, &rpc.FleetStartRequest{
Prompt: &prompt,
})
if err != nil {
return err
}
if result.Started {
fmt.Println("Fleet mode started")
}
return nil
}
prompt := "Update each package independently, then report validation results."
result, err := session.RPC.Fleet.Start(ctx, &rpc.FleetStartRequest{
Prompt: &prompt,
})
if err != nil {
return err
}
if result.Started {
fmt.Println("Fleet mode started")
}
using Microsoft.Copilot;
await using var client = new CopilotClient(new CopilotClientOptions { Mode = CopilotClientMode.CodingAgent });
await using var session = await client.CreateSessionAsync(new CreateSessionOptions());
var result = await session.Rpc.Fleet.StartAsync("Audit each project independently, then summarize the findings.");
if (result.Started)
{
Console.WriteLine("Fleet mode started");
}
var result = await session.Rpc.Fleet.StartAsync("Audit each project independently, then summarize the findings.");
if (result.Started)
{
Console.WriteLine("Fleet mode started");
}
use copilot_sdk::rpc::FleetStartRequest;
let mut request = FleetStartRequest::default();
request.prompt = Some("Research each crate independently, then summarize the plan.".into());
let result = session.rpc().fleet().start(request).await?;
if result.started {
println!("Fleet mode started");
}
Java exposes the same binding as session.getRpc().fleet.start(...). The method and its SessionFleetStartParams and SessionFleetStartResult types are @CopilotExperimental, so the consuming class or method must opt in with @AllowCopilotExperimental. See Using experimental APIs.
Plan-mode UIs can start fleet deployment by returning the autopilot_fleet exit action. The generated session event types describe it as:
type ExitPlanModeAction =
| "exit_only"
| "interactive"
| "autopilot"
/** Exit plan mode and continue with parallel autonomous workers. */
| "autopilot_fleet";
Use this when a user approves a plan that already contains independent work items. Use autopilot for a single autonomous worker and interactive when the user should stay in the loop.
Fleet mode relies on explicit coordination state instead of implicit shared memory. The parent agent decomposes the work into todos, each sub-agent owns one todo, and the orchestrator dispatches workers whose dependencies are already complete.
The runtime creates these tables in the session database on first use:
CREATE TABLE IF NOT EXISTS todos (
id TEXT PRIMARY KEY,
title TEXT NOT NULL,
description TEXT,
status TEXT DEFAULT 'pending' CHECK(status IN ('pending', 'in_progress', 'done', 'blocked')),
created_at TEXT DEFAULT (datetime('now')),
updated_at TEXT DEFAULT (datetime('now'))
);
CREATE TABLE IF NOT EXISTS todo_deps (
todo_id TEXT NOT NULL,
depends_on TEXT NOT NULL,
PRIMARY KEY (todo_id, depends_on),
FOREIGN KEY (todo_id) REFERENCES todos(id),
FOREIGN KEY (depends_on) REFERENCES todos(id)
);
Each todo moves through a small state machine:
pending -> in_progress -> done
\-> blocked
A sub-agent should:
status = 'in_progress'.status = 'done' when complete.status = 'blocked' when it cannot proceed, and include the reason.The orchestrator can find work whose dependencies are satisfied with a query like:
SELECT t.*
FROM todos t
WHERE t.status = 'pending'
AND NOT EXISTS (
SELECT 1
FROM todo_deps td
JOIN todos dep ON td.depends_on = dep.id
WHERE td.todo_id = t.id
AND dep.status != 'done'
);
This pattern gives every worker a clear owner and lets the parent session reason about what is ready, running, complete, or blocked.
Fleet mode invokes sub-agents through the runtime's task mechanism. The runtime emits hook activity for sub-agent tool calls: the runtime 1.0.49 changelog notes that preToolUse, postToolUse, subagentStart, and subagentStop fire correctly for sub-agent tool calls.
All six SDKs expose typed sub-agent lifecycle hooks: Node.js uses onSubagentStart and onSubagentStop, Python and Rust use on_subagent_start and on_subagent_stop, Go and .NET use OnSubagentStart and OnSubagentStop, and Java uses setOnSubagentStart and setOnSubagentStop. Register them when creating or resuming a session. The start hook can prepend additionalContext to the child's first prompt; the stop hook can request another child turn with a block reason or replace the response reported to the parent.
For passive status updates, subscribe to the generic session event stream. It includes subagent.started, subagent.completed, subagent.failed, subagent.selected, and subagent.deselected:
session.on((event) => {
if (event.type === "subagent.started") {
console.log(`Started ${event.data.agentDisplayName}`);
}
if (event.type === "subagent.completed") {
console.log(`Completed ${event.data.agentDisplayName}`);
}
});
import asyncio
from copilot import CopilotClient
from copilot.session import PermissionHandler
from copilot.session_events import SessionEventType
async def main():
client = CopilotClient(mode="coding-agent")
await client.start()
session = await client.create_session(
permissions={"on_request": PermissionHandler.approve_all}
)
def handle_event(event):
if event.type == SessionEventType.SUBAGENT_STARTED:
print(f"Started {event.data.agent_display_name}")
elif event.type == SessionEventType.SUBAGENT_COMPLETED:
print(f"Completed {event.data.agent_display_name}")
unsubscribe = session.on(handle_event)
asyncio.run(main())
from copilot.session_events import SessionEventType
def handle_event(event):
if event.type == SessionEventType.SUBAGENT_STARTED:
print(f"Started {event.data.agent_display_name}")
elif event.type == SessionEventType.SUBAGENT_COMPLETED:
print(f"Completed {event.data.agent_display_name}")
unsubscribe = session.on(handle_event)
For hook configuration that is already exposed at the SDK layer, see Hooks. For sub-agent event payloads, see Custom agents and sub-agent orchestration.
Load plugin agents through the SDK's plugin directory options: --plugin-dir for a shared runtime process, plugins.directories for session-specific additions, or plugins.builtinDirectories for trusted host-bundled plugins. Active plugin agents are available as task(agent_type=...) sub-agent types, so fleet mode can dispatch to those workers.
Conceptually, a fleet prompt can then ask for a specific worker type:
Use task(agent_type="security-review") for each independent package.
Run the workers in parallel and summarize only high-confidence findings.
Keep plugin-provided sub-agent types narrow and descriptive so the orchestrator can choose them reliably.
subagent.* events.Can you improve this documentation? These fine people already did:
copilot-cli-release-app[bot], copilot-sdk-mirror-writer[bot], examon, Sunbrye Ly, Steve Sanderson & Patrick NikoletichEdit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |