Skip to main content
On main, not yet released — 0.32.1-SNAPSHOT, checked against agent-client main f89fc6b5. This tutorial uses the asynchronous lifecycle API built from main (at or after commit 4de205db). None of it is in 0.32.0. Snapshot content changes as main moves, so name the main commit you built against.
Resolve 0.32.1-SNAPSHOT from the Central snapshot repository, with snapshots enabled:
agent-client-claude supplies ClaudeClientProvider, the Claude Code lifecycle provider these examples run against. See Using development snapshots from main for pinning one build and reading its provenance.

Source on GitHub main

docs/examples/tutorials/ConversationServer.java, compiled and run offline by the agent-client build
A server process creates one AgentClient at startup and closes it at shutdown. HTTP requests never build their own client. Each conversation is a retained AgentSession. The application keeps the map from its own conversation id to the session, so a later request can find the conversation and continue it.
The Client runs each execution on its own virtual thread, so there is no executor to configure. Start a conversation in its workspace and remember its id:
A later HTTP request names the conversation. Look it up and continue it with runAsync(); the turn joins the same history. An id the server does not know is an error, never a silent new conversation:
At shutdown, closing the Client closes every conversation it still owns:
runAsync() returns at once with an AgentExecution. Call result() to wait for the answer, or hand the execution to whatever streams the reply back. One conversation runs one turn at a time; for several users in one conversation, see the shared conversation tutorial. The full class is ConversationServer.java. Its main runs it against Claude Code with ClaudeClientProvider. The build compiles this tutorial from docs/examples/tutorials and runs it against OfflineProvider, an offline stand-in that makes no model call (agent-client-tutorials, ConversationServerTest). A live Claude Code run is not part of the build.