Agent Dispatch
Agent Dispatch is Agent Layer's multi-agent orchestration interface. It lets an agent in a client with working MCP support delegate a bounded coding task to a headless Claude, Codex, Grok, Muse, or Antigravity conversation—without blocking the calling agent while that work runs. People and scripts can target the same providers through the CLI.
Agent Layer writes the built-in MCP server into Antigravity's generated configuration, but the current agy probe baseline does not expose MCP tools at runtime. Antigravity is therefore available as a dispatch target, while using it as the calling client depends on the installed agy version. Run al probe agy to check that capability.
Use it to get an independent code review, send research to a model with different strengths, preserve a specialist conversation across follow-ups, or run several independent tasks in parallel. A person or script can drive the same lifecycle without holding open an interactive session.
It has two ways to use the same backend:
- Agents use tools from Agent Layer's built-in MCP server.
- Humans and scripts use
al dispatchcommands.
Both use the same conversation handles, states, result files, continuation behavior, and cancellation semantics.
Why Agent Dispatch
Most coding-agent subagents are tied to one provider and one interactive session. Agent Dispatch adds a provider-neutral boundary around external agent conversations:
- Delegate across providers. A Claude session can dispatch Codex, a Codex session can dispatch Claude, and any supported caller can choose Grok, Muse, or Antigravity when those targets are enabled.
- Keep the coordinator responsive. Starting work returns a handle immediately. The caller can make progress elsewhere and wait only when it needs the result.
- Continue real conversations. Follow-up prompts preserve the target provider, model, reasoning effort, and conversation context.
- Use the same contract everywhere. Agents call seven MCP tools; people and CI call matching
al dispatchcommands over the same backend. - Retain durable evidence. Every completed invocation has an immutable Markdown result, while explicit failure states prevent missing output from looking successful.
- Route through reusable skills. A dispatch can invoke a projected user-managed or Git-imported Agent Skill on the target.
Quick start for agents
After al sync, an enabled agent can discover the available targets and start work with the built-in agent-layer MCP server. Tool calls use JSON arguments; skill is optional and must name an installed Agent Layer skill.
Call agent-layer.dispatch_options with an empty JSON object:
{}
Then call agent-layer.dispatch_start with:
{
"agent": "codex",
"skill": "audit-tests",
"prompt": "Audit the existing tests for the authentication package."
}
The start result includes {"handle":"abc123","state":"running"}. Call agent-layer.dispatch_wait with {"handle":"abc123"}. It may return running; call it again with the same handle until it returns completed, failed, or cancelled. A completed result includes an absolute result_path to the immutable Markdown output.
Start independent conversations for parallel work. When a completed specialist needs a follow-up, use dispatch_continue with the same handle and then wait again.
In this page
- Why Agent Dispatch
- Quick start for agents
- How dispatch works
- MCP tools
- CLI commands
- Session-scoped MCP servers
- Subscription quota
- Conversation lifecycle
- Results and errors
- Waiting and cancellation
- Configuration
How dispatch works
Starting a dispatch creates a conversation and its first invocation, then immediately returns an opaque handle. Use that handle to wait for completion, continue the same provider conversation with another prompt, or cancel active work.
Each conversation has at most one running invocation. Parallel work uses independent conversations and handles; there is no fanout operation.
Dispatch distinguishes callers from targets. Any enabled client that exposes Agent Layer's generated MCP server can call the tools, but only codex, claude, antigravity, grok, and muse are valid targets for agent or --agent. VS Code and Copilot CLI can call dispatch but cannot be dispatched to. A target must be enabled in .agent-layer/config.toml; use dispatch_options or al dispatch options to see what is currently available.
The public lifecycle is intentionally small:
start -> wait -> completed | failed | cancelled
|
+-> continue -> wait -> ...
options is a separate, read-only discovery operation. It reports which providers are available and which model and reasoning-effort overrides each one accepts.
MCP tools
al sync projects a built-in MCP server named agent-layer into every enabled Codex, Claude, Antigravity, VS Code, Copilot CLI, Grok, and Muse client. The server is derived from Agent Layer configuration, not declared as a [[mcp.servers]] entry. Its ID is reserved and cannot be used by a custom server. Muse shares the project .mcp.json with Claude while preserving client filters; see the reference.
The launcher follows normal CLI pin/AL_VERSION selection, so updating the global
al preserves older project pins. Source Make workflows explicitly project the
stable source executable for their configuration root, even when the client
parent has no development environment. Inherited source environment from another
repository does not persist MCP source selection; ordinary release sync restores
release selection.
GUI and background clients, such as the Codex app, may start the server with a
shorter PATH than your terminal. The release launcher records the al that
al sync resolved, runs it directly, and appends its directory to the server
PATH. After moving or reinstalling al, re-run al sync and reconnect the
agent-layer server; a running server keeps recording the entry it started
from. Provider CLIs must be on the client's PATH or in that al directory. Projects pinned to an older
release keep generating the older launcher until you run al update, then
al upgrade in the project.
Running servers keep their code until reconnected. A server whose project pin
or AL_VERSION selects the running release runs from an immutable, verified copy
of its own image in the content-addressed image cache
(<cache root>/images/<sha256>/al), never in the version cache. Entries are not
pruned yet (#525); with no agent-layer MCP server running, deleting
<cache root>/images/ is safe. It therefore keeps
accepting work after al update or brew upgrade replaces the global al. If
the copy fails, the server runs in place after one warning. After a pin change,
pin removal or corrupt pin, or a replaced executable in an unpinned project or
a source rebuild, options, start and continue refuse new provider work. They also
refuse it when selected code differs or freshness cannot be verified. Wait,
inspect, output and cancel remain available. Admitted work keeps its original
image. Even a same-byte atomic replacement requires reconnecting; source
wrappers keep an unchanged rebuild's existing executable. Changing the
launch environment or switching source/release mode also needs a reconnect;
running servers cannot detect those projection changes.
Run al update, then al upgrade in each repository, and reconnect agent-layer
once, because the upgrade changes the pin. Servers started by v1.2.0 or earlier
ran from the install path and refuse new work once after the update that
installs a newer release. In Claude Code use /mcp; in a persistent Codex app restart the app or
reload MCP configuration. A new chat may reuse the running server. Pre-guard
servers need one reconnect after upgrade to acquire the guard. For development,
use make al-sync to project source despite an older pin, or make al-upgrade after completing the v1.0.0 transition,
then reconnect when a rebuild replaces the executable; no manual pin edits are needed. Sync updates
launch configuration without replacing servers. Timeout changes also require a
reconnect and a reload of projected client timeouts.
The server exposes seven Agent Dispatch tools:
| Tool | Purpose |
|---|---|
dispatch_options | List dispatchable providers and their allowed overrides. |
dispatch_start | Start a conversation and return its handle and invocation ID. |
dispatch_wait | Wait for the configured interval, then report the current state. |
dispatch_continue | Start the next invocation in a terminal conversation. |
dispatch_cancel | Request that provider work stop. |
dispatch_inspect | Observe invocation state and termination confirmation. |
dispatch_output | Read bounded final-answer or event text. |
dispatch_start accepts an agent, optional model, reasoning_effort, role, skill, and max_depth, plus exactly one of prompt or prompt_file. role is caller-defined workflow evidence retained on the run record; it does not change provider selection or prompt text. max_depth is an optional positive integer that tightens the nested dispatch depth cap for the conversation and its descendants. dispatch_continue accepts a handle and exactly one prompt source. Wait, cancel, inspect, and output accept exactly one of handle or invocation_id. An old invocation ID never follows a later continuation. Inspect does not return prompt text.
The MCP server returns structured results and a serialized text fallback for clients that do not yet consume structured MCP output.
CLI commands
The CLI exposes the same backend for people and scripts:
al dispatch options
al dispatch quota --agent codex --agent grok
al dispatch reserve [--continue <handle>]
al dispatch start --agent codex \
[--model <model>] \
[--reasoning-effort <effort>] \
[--role <role>] \
[--skill <skill>] \
[--max-depth <N>] \
[--reservation <handle>] \
[--mcp-config <path>]... \
(--prompt <text> | --prompt-file <path>)
al dispatch wait <handle-or-invocation-id>
al dispatch inspect <handle-or-invocation-id>
al dispatch output <handle-or-invocation-id> --artifact final_answer
al dispatch continue [--reservation <invocation-id>] [<handle>] \
(--prompt <text> | --prompt-file <path>)
al dispatch cancel <handle-or-invocation-id>
start requires --agent and exactly one prompt source. When model or reasoning effort is omitted, Agent Layer uses the configured value; if there is no configured value, the provider uses its own default.
--prompt-file avoids shell escaping and command-length limits for substantial prompts. Prompt sources are limited to 10 MiB, a named pipe is read until its writer closes, and interrupting the command (or ending the MCP request) before the prompt is read cancels the start or continuation without contacting the provider. --skill names a known user-managed or imported Agent Layer skill. Dispatch prepends the target's native skill invocation to the prompt—for example $review for Codex or /review for another target. The skill must already be projected for that target; run al sync if start reports it missing. dispatch_continue does not accept a skill.
continue retains the conversation's provider, model, reasoning effort, effective max_depth cap, and provider context. It accepts a new prompt only after the current invocation reaches a terminal state.
Every successful CLI command writes exactly one JSON object to standard output. Diagnostics go to standard error.
A typical CLI flow looks like this:
al dispatch start --agent codex --prompt "Summarize docs/AGENT-DISPATCH.md"
# {"handle":"abc123","invocation_id":"...","state":"running","termination_confirmed":false}
al dispatch wait abc123
# If the state is still running, wait again with the same handle.
Session-scoped MCP servers
Use repeatable --mcp-config <path> flags on al dispatch start to attach stdio MCP servers to a conversation with any dispatch provider. Each path names a JSON file containing an mcpServers object. Agent Layer stores the definitions privately and reattaches them on continuation. This flag is available through the CLI.
Tools from explicitly attached servers run without interactive approval prompts in every approvals.mode. Attach only server definitions you trust. See the session MCP configuration and permission rules.
Subscription quota
al dispatch quota returns current subscription usage for Codex, Claude, Grok, Antigravity, and Muse. Run it from the target project to query the subscriptions its enabled dispatch agents would use. Use repeatable --agent flags to select project agents. The subscription_quota.supported field in al dispatch options describes reader availability independently of the selected login.
al dispatch quota --format summary
al dispatch quota --format full
al dispatch quota --format summary --agent codex --agent claude --timeout 8s --retries 1
al dispatch quota \
--profile work=codex:/private/work/auth.json \
--profile personal=codex:/private/personal/auth.json \
--expect-account work=KNOWN_WORKSPACE_ID \
--model personal=gpt-5.5
The repeatable --profile LABEL=AGENT:FILE flag opens a caller-owned native credential file for a detached account. A profile-only query works outside an Agent Layer project. Combine --agent and --profile to query project agents alongside detached accounts. Labels are unique, case-sensitive, and at most 64 characters. Relative profile paths are resolved from the caller’s working directory.
| Agent | Native credential file for --profile |
|---|---|
| Codex | auth.json or secrets/codex_auth.age in the intended Codex home. The vault requires the corresponding key in the current user's OS credential store. |
| Claude | .credentials.json containing a claudeAiOauth subscription login. |
| Grok | auth.json with a single first-party OAuth login. |
| Antigravity | antigravity-oauth-token containing the consumer OAuth profile. |
| Muse | A file-backed muse/auth.json from the native XDG configuration directory. Query the project agent for a macOS Keychain-backed login. |
Use repeatable --expect-account SELECTOR=ID to require an account for each named agent or profile. A verified subscription.id works across projects and profile labels. You can also match these verified identifiers.
| Agent | Other identifiers accepted by --expect-account |
|---|---|
| Codex | For personal subscriptions, ChatGPT account ID, user ID, or email. For shared workspaces, use workspace ID/user ID or subscription.id. |
| Claude | organization UUID/account UUID. For a verified personal organization, the account UUID or email also works. |
| Grok | Personal user or principal ID, or email when available. For a team subscription use team ID/principal ID or subscription.id. |
| Antigravity | Google user ID or verified email. |
| Muse | The email returned by the authenticated subscription endpoint. |
Use repeatable --model SELECTOR=MODEL for a model from al dispatch options or a custom override. Configured and provider-reported models appear automatically. models[].pools names applicable pools and coverage indicates whether that mapping is complete, partial, or unknown. A pool with scope all covers the subscription's dispatch models. Scope models identifies specific model IDs or a documented family, other_surface covers a separate feature, and unknown indicates an unresolved association. A model-specific alternate credential can appear as models[].auth_status.
The command emits one JSON object. --format full is the default and returns the complete telemetry fields below. --format summary uses the same provider reads and exit codes and returns a smaller JSON response for agent calls. Either format accepts --json.
schema_versionis1. Consumers can ignore additional fields and use the result status to classify unfamiliar reasons.statusiscomplete,partial, orno_readings, based on the number ofokreadings.resultshas one result per selected account in selection order.missing_readingslists theselector,agent,status, andreasonof each result whose status is other thanok. It is an empty array on a complete response.
The summary adds "format": "summary" to the response. Each row includes its status, observation time, and known sign-in, retry, account check, and admission information. highest_usage, when available, identifies the window with the highest reported utilization across the account's quota pools, excluding disabled windows and pools for separate features. It includes the pool, scope, window, percent used, and reset time. Use the scope and the admission fields to interpret that reading. Summary model entries cover the configured model and models requested with --model and show their coverage and admission. Use full output for subscription identifiers, all pools and windows, the full model list, and supplemental diagnostics.
Each full result contains:
selector,agent,status, and a machine-readablereasonfor a missing reading. Result statuses areok,non_subscription,unsupported,credentials_unavailable,login_expired,account_mismatch, andunavailable.account_checkreports whether an optional account expectation was met.reauth_requiredis true when the login needs user action, false when a sign-in is unnecessary or a renewal credential has a known future expiration, and null when the need to sign in is unknown.login_expiredindicates that a new sign-in is required, with reasonexpired_credentialsorrevoked_credentials.credentials_unavailablewith reasonaccess_token_expiredmeans the access token has expired and the query has insufficient evidence to require a new sign-in. A generic authentication rejection has reasoncredentials_rejected.retryableis true for a known transient reason a later identical invocation might recover from.retriescounts additional attempts started by the quota retry policy for this selector, including supplemental reads. A reread after credential rotation does not itself incrementretries.retry_atis an optional UTC timestamp from the governing HTTPRetry-Afterheader when its future delay is within 24 hours.attempted_atand nullableobserved_atare absolute UTC timestamps.observed_atis the earliest successful primary quota read in that result. A successful response that omits utilization can still establish an observation and reportsno_usage.missinglists unavailable supplemental components on results with utilization. Every invocation reads current provider state and retains no quota cache.- A nullable
subscriptionwith an opaque ID, verification flag, and provider tier when known. Use verified IDs to aggregate shared subscriptions. An unverified reading cannot satisfy an account expectation. poolswith a provider ID and an optional displaylabel.pools[].windowscontains nullableused_percent,duration_seconds,resets_at, andstarts_at. Afixedwindow starts at its reset minus its duration when both are known.rolling,not_started, andunknowndescribe windows for which that formula does not apply or the provider does not establish the window type. A provider can explicitly mark a quota windowdisabled.- Nullable
blockedandlockout_clears_atat agent, model, pool, and window level. The agent-level fields describe common subscription gates. Use the model fields for additional model-specific gates. The clear time is the latest reset of the known blockers and is null when any blocker has an unknown clear time. Providers can allow overage or credits even when included utilization reaches 100 percent. Codex can also supply ablock_reasonfor ordinary exhaustion or a workspace billing restriction.
| Exit | Status |
|---|---|
0 | complete. Every selected account has a valid utilization reading and satisfies any account expectation. |
84 | partial. At least one valid reading and at least one missing reading. |
85 | no_readings. No valid readings. |
64, 65 | Invalid arguments or invalid project configuration, respectively. |
130, 143 | Interrupted by SIGINT or SIGTERM, respectively. The JSON retains completed reads when possible. |
The overall timeout defaults to 15 seconds and accepts durations up to one minute. A timed-out query can return partial results. Setting AL_NO_NETWORK in the effective launch environment disables quota network requests. Project queries include the project's .agent-layer/.env with the same precedence as dispatch. The query runs in the invoking Agent Layer binary so it can complete without fetching a pinned release.
Use --retries N to allow up to N additional attempts per HTTP read. The default is three, and values from zero through five are accepted. Transient network failures, timeouts, and HTTP 408, 429, 500, 502, 503, and 504 can trigger retries. Retries use jittered backoff, respect Retry-After on HTTP 429 and 503, and share the overall timeout. A successful read, a response without usage, an authentication failure, or a malformed response does not trigger a network retry.
Quota queries use first-party subscription endpoints and read credentials from the native stores. For a project login with a usable refresh grant and an expired or rejected access token, the query can run the installed provider's account or discovery command once. This sends no model prompt. The provider owns the refresh and can update its credential store. The query rereads the selected store and uses the replacement for quota calls. Allow at least 10 seconds of the timeout to remain when renewal starts so the provider can save its new credential. Quota processes sharing that store serialize their renewal attempts. Detached --profile files are read-only.
Providers expose different levels of detail. Claude can report a counter without confirming turn admission, and Antigravity can report per-model utilization without a window duration or an admission decision. Grok reports included weekly usage for unified accounts and preserves uncertainty about paid admission when its billing response omits the necessary credit or spending controls. Explicit API billing returns non_subscription. Custom auth helpers, enterprise endpoints, and credential stores the reader cannot safely resolve return unsupported.
On macOS, run the query as the desktop user who signed in to the native clients, with the login Keychain unlocked. If macOS asks whether to give the system security utility access to the item, choose Allow for that read. Use --timeout 45s if authorization prompts consume the time needed for renewal. Claude can read its Keychain entry. Codex can read auth.json, the direct Keychain login, or the encrypted secrets/codex_auth.age vault selected by cli_auth_credentials_store and features.secret_auth_storage. The vault's decryption key stays in the OS credential store and the query decrypts the login in memory. On Linux, Codex reads its Secret Service entry over D-Bus (matching target=default or a unique entry in the default collection). If a vault exists but its key cannot be read, the result reports codex_vault_key_unavailable. A vault whose encryption requires more than the query's scrypt work limit reports codex_vault_work_factor_unsupported.
Muse reads its native auth.json to select the Meta login and resolves a Keychain reference on macOS. A file-backed login works with TBH_CREDENTIAL_BACKEND=file. Grok uses its native OAuth file and Antigravity uses its native credential file or Keychain entry. muse_keychain_entry_unavailable means the file references a Keychain login the query could not find in the current session.
For the supported Codex release, an active CODEX_API_KEY conflicts with a forced ChatGPT login and reports codex_login_method_conflict.
Reserve before starting or continuing
Programmatic callers can reserve a conversation name before starting an agent, or reserve the next invocation of an existing conversation before continuing it. Launch each reservation once, and stop retrying before the configured retention period ends. These commands are CLI only; agents using MCP use dispatch_start and dispatch_continue. al dispatch options advertises support under "reservations": {"start": true, "continue": true}.
al dispatch reserve
# {"handle":"small-blue-relay","invocation_id":"...","state":"reserved","termination_confirmed":false,"reservation_expires_at":"..."}
al dispatch start --reservation <handle> --agent codex --prompt "Summarize docs/AGENT-DISPATCH.md"
al dispatch wait <handle> --condition termination_confirmed
# Proceed when the result has "state":"completed" and "condition_met":true.
al dispatch reserve --continue <handle>
# {"handle":"small-blue-relay","invocation_id":"22222222-...","state":"reserved","termination_confirmed":false,"reservation_expires_at":"..."}
al dispatch continue --reservation <invocation-id> --prompt "Follow up on the summary"
reserve creates a start reservation with an Agent Layer generated three-word handle and ID and launches nothing. Pass the returned handle to start --reservation. reserve --continue <handle> checks continuation eligibility and creates a continuation reservation for an existing conversation, returning any existing unexpired pending continuation reservation idempotently. Pass its invocation_id to continue --reservation (optionally alongside <handle>). While a continuation reservation is pending, handle-based wait, inspect, and output keep reporting the latest launched invocation, and competing continue calls are refused.
A claimed reservation launches at most once. A crash after claiming resolves to a failed invocation once termination is provable. Another continuation requires a usable provider session ID or proof that the invocation failed before contacting the provider. Crashes between provider launch intent and process identity publication leave termination uncertain and the launch fenced, as in ordinary dispatch.
inspect, wait, output, and cancel accept the reserved invocation ID (and for start reservations, its handle). A bounded wait that ends before launch returns reserved. Cancelling an unstarted reservation or letting it expire after dispatch.reservation_expiry_days (default 7) retires it without launching and lets the caller reserve the continuation again. At reservation lookup, exit 80 means unknown, 81 means expired, 82 means already claimed, and 83 means cancelled before launch. start --reservation reads the prompt before reservation lookup. continue --reservation can report exit 82 for a retained claim even if the original prompt file is gone. See the full reservation contract.
wait is bounded rather than “wait until finished.” The CLI returns in at most eight minutes, and the MCP tool returns after dispatch.mcp_wait_timeout_minutes (30 by default). If the state is running, call wait again. Waiting on an already-terminal invocation returns immediately.
Conversation lifecycle
An invocation has exactly one public state:
running -> completed | failed | cancelled
A start reservation moves from reserved to running when start --reservation <handle> launches it. A continuation reservation moves from reserved to running when continue --reservation <invocation-id> launches it. Cancelling or expiring either reservation before launch moves that invocation to cancelled. If it was a continuation reservation, the caller can still continue the conversation or reserve another invocation.
Terminal states are immutable. Continuing a terminal conversation creates a new invocation in running; it does not rewrite the previous invocation.
| Operation | running | completed | failed | cancelled |
|---|---|---|---|---|
wait | Waits for the bounded interval, then returns running. | Returns result_path. | Returns the failure. | Returns cancelled. |
continue | Errors. | Starts the next invocation. | Starts the next invocation. | Starts the next invocation. |
cancel | Requests cancellation. | Errors: already completed. | Retries stopping unconfirmed execution, preserving failed. | Retries an unconfirmed stop; confirmed cancellation succeeds immediately. |
Only one invocation can run for a conversation at a time. Concurrent continuation attempts cannot start duplicate provider work.
Results and errors
start and continue return the handle and initial state:
{
"handle": "abc123",
"invocation_id": "11111111-1111-4111-8111-111111111111",
"state": "running",
"termination_confirmed": false
}
A completed wait returns an absolute path to the result:
{
"handle": "abc123",
"state": "completed",
"result_path": "/absolute/path/to/result.md"
}
Each invocation has its own immutable Markdown result file. Agent Layer writes that file atomically before reporting completed. A completed invocation without a readable result is reported as an error rather than as a false success.
A failed wait includes an actionable error:
{
"handle": "abc123",
"state": "failed",
"error": "Provider authentication failed"
}
Failure does not invalidate the conversation. Continuation requires confirmed termination and sufficient provider conversation or pre-start recovery evidence.
On the CLI, a failed wait writes this JSON object before exiting non-zero. MCP dispatch_wait returns the same failed object as a normal tool result, allowing an agent to inspect the failure and decide what to do next.
Waiting and cancellation
Waiting is bounded. al dispatch wait waits up to eight minutes; dispatch_wait uses the configured MCP wait timeout. If work is still active when the interval ends, the operation returns running without changing the invocation. Wait again with the same handle.
Abandoning a wait because of a client timeout, disconnect, cancelled tool call, or Ctrl-C during al dispatch wait stops only that wait. Provider work continues. Only dispatch_cancel or al dispatch cancel terminates the active invocation.
Cancellation is idempotent after termination is confirmed. It can retry stopping an unconfirmed failed invocation while preserving the failed outcome. A cancelled result alone does not establish that execution stopped.
Use --condition termination_confirmed on the CLI, or condition="termination_confirmed" with dispatch_wait, to wait for durable stop confirmation. The default condition is a terminal outcome. A bounded wait reports condition_met=false when its condition has not been reached. Use the immutable invocation ID to keep tracking the same invocation after a continuation.
Confirmation establishes that no owning launcher or worker can submit the invocation and that its owned provider process and group have stopped. It does not mean edits were reverted or external jobs have finished. A timeout, dead worker alone, or failed termination attempt leaves uncertainty explicit.
dispatch_options, dispatch_wait, dispatch_inspect, and dispatch_output are marked read-only. dispatch_start, dispatch_continue, and dispatch_cancel are marked destructive because dispatched work can change the environment. An MCP client may require approval before calling them. Cancelled is not proof of termination; inspect termination_confirmed.
An MCP start or continue call acknowledges work that runs independently. If the transport disconnects after provider work starts but before the caller receives the response, the work remains active and the caller may not know its handle. Recovery evidence remains in the run directory listed under project-local storage. Upgraded CLIs also read older records from .agent-layer/tmp/runs/. If you roll the CLI back to a release that predates the layout change, use the upgraded CLI to recover records created in the new directory.
dispatch_inspect and dispatch_output are the supported evidence surfaces for a known invocation ID. Prefer the CLI when a human needs to retain the handle and invocation ID directly.
Inspection returns state, activity timestamps, and termination confirmation without waiting for execution. Process identities and proof details remain private. Output accepts final_answer or events; events retain available partial answers, including failed or cancelled runs. Use offset with the returned next_offset to paginate, or tail: true to read late evidence. The CLI equivalents are --offset and --tail; they cannot be combined. Each page contains at most 64 KiB of UTF-8 text and reports byte positions (offset, next_offset, size_bytes), invocation state, and termination confirmation. Continue while next_offset < size_bytes, keeping the returned invocation_id and artifact; a handle can select a later invocation after continuation. Join page content before parsing JSONL records, which can span pages. Fetching another page does not require continuing the provider. Reaching the current end of live events does not establish completion; use wait or inspect for state. Captured failed-run text remains partial evidence; final_answer requires a completed invocation.
Muse can complete a text-bearing turn and then announce a background continuation in the same invocation. Dispatch retracts that turn's provisional completion when an authenticated announcement arrives and waits for the background result. Before resume launches, a read-only Muse session snapshot and retained ownership evidence supply the turn/cursor baseline. If a resumed stream omits its new root link, its earlier task linkage must agree with an independent terminal snapshot at an advanced cursor. Foreign roots and sessions still fail validation. Sanitized lifecycle events record shutdown/protocol observations and executing Agent Layer build identity; retrieve them with events pagination or tail.
truncated indicates a remaining suffix, or an omitted prefix on a tail read. Missing, unreadable, invalid, or unavailable output fails explicitly.
Configuration
The optional [dispatch] section controls nesting, retention, reservation expiry, and MCP timeouts:
[dispatch]
max_depth = 3
session_retention_days = 30
reservation_expiry_days = 7
mcp_wait_timeout_minutes = 30
mcp_tool_timeout_minutes = 40
max_depthlimits nested dispatch and defaults to 3.session_retention_daysbounds inactive conversation mappings and confirmed terminal evidence. It defaults to 30. Unconfirmed execution evidence is never expired.reservation_expiry_daysbounds how long an unstartedal dispatch reservereservation stays startable. It defaults to 7.mcp_wait_timeout_minutescontrols how long onedispatch_waitcall blocks before returningrunning. It defaults to 30.mcp_tool_timeout_minutesis the server-side hard limit for every dispatch MCP tool call. It defaults to 40 and must be greater than the wait timeout.
Records written by this version are not readable by older binaries that reject unknown run-record fields.
Inside an already-dispatched conversation, prefer the client's built-in subagent for further delegation. A blocked nested call fails rather than queuing. max_depth counts the initial start, so the default of 3 permits that start and two nested starts.
Callers can tighten that ceiling per conversation with --max-depth <N> on al dispatch start (including --reservation) or max_depth on dispatch_start. The effective cap enforced on each operation is the minimum of the repository's dispatch.max_depth, any inherited parent cap, any persisted conversation cap, and the requested max_depth, so it can only tighten—never relax—configured or inherited limits. When an explicit cap is requested or inherited, it persists on the conversation record across every continue and propagates to descendants across repositories via AL_DISPATCH_MAX_DEPTH; omitting --max-depth with no inherited cap preserves existing repo-local dispatch.max_depth behavior. Tool and skill definitions remain fixed; once a worker is at or above its effective cap, all state-changing operations (reserve, start, continue, and cancel via CLI or MCP) fail immediately with exit 75 while read-only operations (options, wait, inspect, output, quota) remain allowed.
Codex and Grok also receive the hard tool timeout as per-server tool_timeout_sec. Agent Layer does not set Claude Code's client-wide MCP_TOOL_TIMEOUT, because doing so would affect unrelated MCP servers. Antigravity has no per-server timeout key, so the Agent Layer server-side bound remains its recovery limit.
Dispatch honors the repository's configured agents, models, reasoning effort, approvals, environment isolation, and pinned Agent Layer version. Use al dispatch options to inspect the resolved provider choices before starting work.
Model suggestions come only from the installed harnesses. Options queries run
concurrently and do not sync; discovery failures return an empty list and an
explicit discovery_error, never bundled or fallback models. Start and continue
do not repeat model discovery.
For exact configuration fields and CLI summaries, see Reference. For internal implementation details, see docs/AGENT-DISPATCH.md.