- stdio, communication over standard in and standard out
- Streamable HTTP (draft proposal in progress)
stdio
In the stdio transport:- The client launches the agent as a subprocess.
- The agent reads JSON-RPC messages from its standard input (
stdin) and sends messages to its standard output (stdout). - Messages are individual JSON-RPC requests, notifications, responses, or batch arrays.
- Messages are delimited by newlines (
\n), and MUST NOT contain embedded newlines. - The agent MAY write UTF-8 strings to its standard error (
stderr) for logging purposes. Clients MAY capture, forward, or ignore this logging. - The agent MUST NOT write anything to its
stdoutthat is not a valid ACP message. - The client MUST NOT write anything to the agent’s
stdinthat is not a valid ACP message.
Message Timing
After theinitialize exchange completes successfully, Agents MAY send
requests and notifications at any time: between Client requests, before a
pending response, or before or after a batch response. Clients MUST be
prepared to handle these messages independently of the responses they are
awaiting, including when no Client request is pending.
This permission does not override capability requirements or method-specific
lifecycle and ordering rules. For example, session-scoped messages still
require a valid session.
JSON-RPC Batch Messages
JSON-RPC 2.0 allows a sender to combine multiple request and notification objects in a single batch array. ACP follows the JSON-RPC 2.0 batch rules. A client or agent MAY send an array filled with Request objects. A Notification is a Request object without anid, so notification-only and mixed
request/notification batches are valid.
When receiving a batch call:
- If the batch itself is invalid JSON, return a single
Parse errorresponse (code: -32700) withid: null. - The batch MUST be an array with at least one value. An empty array
receives a single
Invalid Requestresponse (code: -32600) withid: null, not a response array. - The receiver MAY process batch entries as concurrent tasks, in any order, and with any degree of parallelism.
- The receiver SHOULD respond with an array containing the corresponding Response objects after all batch Request objects have been processed.
- A Response object SHOULD exist for each Request object, except that there SHOULD NOT be any Response object for Notifications.
- The receiver MUST NOT reply to a Notification, including a Notification within a batch.
- Response objects MAY appear in any order within the response array. The
sender SHOULD match responses to requests by
id. - If there are no Response objects to send, such as for an all-notification batch, the receiver MUST NOT return an empty array and should return nothing.
- Invalid entries in a non-empty batch produce their own
Invalid Requestresponses (code: -32600) withid: null; they do not make the entire batch fail.
initialize, auth/login, session/new, session/resume, and
session/prompt. These messages are easier to reason about as individual
transport messages and can change which later messages are valid.