_meta, and an agent that is the client of another agent passes both on. Breaking changes are
marked Breaking; pre-1.0, they come without compatibility shims. The source of every statement
here is the v0.83.0 changelog.
The caller in _meta
A client names the person a request or response is for in its _meta, under
"agentclientprotocol.com/java-sdk/caller" (AcpCaller.META_KEY), as
{"id":...,"name":...,"attributes":{...}}; name and attributes are left out when empty. The wire
format beyond _meta does not change. AcpCaller is in acp-core, package
com.agentclientprotocol.sdk.spec:
caller.addToMeta(meta)returns a new_metawith the caller added, andAcpCaller.fromMeta(meta)reads one back, leniently: a missing or malformed caller is empty, never an error.- A prompt turn passes its caller on. During a turn whose
PromptRequestnames a caller, every permission request (askPermission,askChoice,client().requestPermission) and elicitation (client().createElicitation) the agent sends through itsPromptContextorSyncPromptContextcarries that caller, unless the request names one itself. File, terminal and extension requests go as given. - The answerer may be someone else. The answerâs
_metais the clientâs: read who answered withAcpCaller.fromMeta(response.meta()). PromptContext.getCaller()andSyncPromptContext.getCaller()return the turnâs caller, or null.- The caller is derived from the signed-in user. A client that sends with an identity adds
AcpCaller.of(identity),{"id": subject, "attributes": {"issuer": ...}}and nothing else of the identity, to the_metaofsession/new,session/load,session/resume,session/forkandsession/prompt, and of a permission or elicitation answer, unless the message names a caller. So the user reaches a downstream agent or an agentic CLI, whose processes the identity cannot enter.
The signed-in user reaches @AcpAgent handlers
An AcpIdentity (acp-core, com.agentclientprotocol.sdk.identity) is a subject, a nullable issuer,
the userâs authorities, and the security frameworkâs own object for the user. The SDK carries it
beside each message inside the JVM, never on the wire: the in-memory transport and the HTTP endpoint
hand each inbound message to the agent with its own identity, notifications included. Over stdio,
and for an unauthenticated request, there is none and nothing changes.
A handler method of an @AcpAgent can take:
- an
AcpIdentityorjava.security.Principalparameter: the messageâs signed-in user, or null (thePrincipalis the frameworkâs own object when it is one); - an
AcpCallerparameter: the requestâs declared caller, or null. The SDK does not reconcile the caller with the identity.
PromptContext.getIdentity() or SyncPromptContext.getIdentity(),
from its Reactor context (AcpIdentityContext.read(ctx)), or on a synchronous handlerâs thread from
AcpIdentityContext.current().
In process, the client captures the user when it sends (
AcpClient.sync(..).identityCapture(capture),
or async): one client connection serves every user of the application, and each message goes as
the user of the request that sent it.
With identities, sessions belong to their creator. The default AcpSessionAccess.ownerOnly()
answers -32002 (Resource not found) to a session-scoped request on another userâs session and
drops such a session/cancel; session/list lists only the sessions the caller may use. An
application whose users share sessions sets sessionAccess(AcpSessionAccess.anyone()), or a
membership check of its own. See the breaking changes below.
Queued turns: acp-turn-queue
A new optional module, com.agentclientprotocol:acp-turn-queue, for applications where several
people share one session. AcpTurnQueue (com.agentclientprotocol.sdk.client.queue) queues prompt
turns per session over an AcpSyncClient or AcpAsyncClient:
submit(PromptRequest)returns aQueuedTurnwhoseresponse()is aCompletableFuture<PromptResponse>. A sessionâs turns are sent one at a time, in submission order, each once the agent has answered the one before; sessions do not wait for each other, and the queue starts no thread.- Each turn is sent as the request that was submitted, so its
_metaand caller reach the agent unchanged, and as the user who submitted it, however long it waited. - A prompt that should reflect what happened while it waited is submitted as a supplier,
submit(sessionId, caller, () -> request), called once when the turn starts. - At most
maxWaitingTurns(default 32) wait per session; one more is refused withTurnQueueFullExceptionbefore anything is sent. QueuedTurn.cancel()removes a waiting turn, or stops the running one withsession/cancel;cancelAll(sessionId)andclose()do the same for a session and for the whole queue.- For chat UIs:
waitingTurns(sessionId),turns(sessionId), and aTurnListenerwithturnStarted(turn)andturnFinished(turn, response, error), called after the turnâsresponse()has completed and before the sessionâs next turn starts.
The forwarder: an agent that is the client of another agent
AcpForwarder (acp-core, com.agentclientprotocol.sdk.forward) forwards an upstream turn to a
downstream agent. Build the downstream client with forwarder.sessionUpdateHandler() and
forwarder.requestPermissionHandler() (or syncSessionUpdateHandler() and
syncRequestPermissionHandler()), and prompt it from the upstream prompt handler with
forwarder.forward(context, downstream, request), for a PromptContext and an AcpAsyncClient, or a
SyncPromptContext and an AcpSyncClient, from a builder agent or an @AcpAgent alike. For that call:
- the downstream sessionâs updates go to the upstream client through the upstream turn, in order;
- its permission requests go through the upstream context, with the upstream session ID and the upstream turnâs caller, and the answer, with the answererâs caller, goes back down unchanged;
- the downstream prompt is sent as the upstream turnâs user (an in-process downstream agent sees the identity; any downstream gets the derived caller);
- cancelling the upstream turn sends the downstream agent
session/cancel.
AcpForwarder.create(Consumer, Audit) takes an audit hook
that hears of each forwarded prompt and permission answer (AcpForwarder.Event: kind, the upstream
and downstream session IDs, the identity and the caller). Choosing the downstream process,
credentials and workspace per user stays the applicationâs: use context.getIdentity() to pick the
downstream client.
userResponseTimeout: a separate timeout for requests that wait for a person
userResponseTimeout bounds how long the agent waits for an answer to session/request_permission
and elicitation/create, so a person can take minutes while a file read, a terminal call or an
extension request still fails at requestTimeout. Unset, these requests wait for requestTimeout, as
before; 0 waits without a limit. This limit is Java SDK policy; ACP defines none.
Once set on the synchronous builder,
AcpSyncAgent.requestPermission and createElicitation are no
longer also cut off by that agentâs 5-minute block timeout.
Breaking changes, and what to do
Also changed, without an upgrade step:
- In process, messages are handed over on a thread of the SDKâs own, one delivery thread per
direction, in the order sent, inheriting no
InheritableThreadLocal; on JDK 21 and later they are virtual threads. A handler no longer runs with the MDC, locale or request context of the thread that sent its message. A send now returns before the message is delivered. - Quarkus: a handler never joins its callerâs JTA transaction. A handler that needs a transaction
starts its own (
@Transactional). - A notification without a handler is logged at WARN once per method, then at DEBUG.
- Fixed: a
CancellationSignalcancelled the moment the promptâs answer arrives sends nothing.prompt(request, stop)stopped watching the signal only after it had passed the answer on, so cancelling the signal on the answer could still send asession/cancelfor a finished turn. The client now stops watching the signal first.
Known issues
- Spring WebFlux on Jetty: Jettyâs connection idle timeout still closes an ACP WebSocket after 30
seconds without traffic. Set
server.jetty.connection-idle-timeout(for example30m), or use Reactor Netty, the default for WebFlux. - The outbound queues of the stdio transports and the WebSocket client are still unbounded. Bounded outbound queues are planned for a later release.
- Session ownership:
AcpSessionOwnerskeeps each owner in memory untilsession/delete; a session loaded but never created by this agent admits any user unless the application records its owner (AcpSessionOwners.record); in process, where one connection serves every user,$/cancel_requestis not checked against the user of the request it cancels (over HTTP a connection belongs to one user).