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). - Each message is a single JSON-RPC request, notification, or response object.
- 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.
Shutdown
To end the connection, the Client closes the Agent’sstdin. The Agent treats end of input as the end of the connection: its sessions stop being active, and it SHOULD exit once it has finished or stopped its work. If the Agent does not exit within a reasonable time, the Client MAY terminate the process, for example with SIGTERM and then SIGKILL.
When the connection ends, either side treats requests it sent that have no response as failed.
Message timing
After theinitialize exchange completes successfully, Agents MAY send
requests and notifications at any time: between Client requests, before a
pending response, or after a 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.
Message order
Transports MUST deliver messages in the order they were sent. Receivers MUST apply a session’ssession/update notifications in the order they are
received.
No batches
ACP does not use JSON-RPC 2.0 batches. Senders MUST NOT send a JSON array of messages, and receivers reject one with a single-32600 (Invalid Request) response with id: null.