Module 24: Spring Boot Client
Use the autoconfigured ACP client in a Spring Boot application. Connect to agents with just properties — no manual transport or client construction.Prerequisites
- Java 21+ (Spring Boot 4.x requirement)
- Module 23: Spring Boot Agent built and available
What You’ll Learn
- Injecting
AcpSyncClientfrom autoconfiguration - Configuring the client transport via
application.properties - Property-driven transport selection (stdio vs WebSocket)
Dependencies
Same starter as the agent side:As of 0.80.0, the starter is a module of the ACP Java SDK itself (
com.agentclientprotocol, replacing
org.springaicommunity); see the 0.80.0 migration guide. The
downloadable module builds against the released starter (SDK 0.18.0) by default; build with
-Psdk-candidate to use the SDK’s own starter at the coordinates shown above.The Client
The autoconfiguredAcpSyncClient is injected like any Spring bean:
Configuration
application.properties:stdio.command property and creates a StdioAcpClientTransport that launches the agent as a subprocess.
The explicit request-timeout=60s above now just restates the default (it used to raise it from 30s); it’s harmless to leave in, and makes the intent explicit regardless of what the default happens to be.
What the Autoconfiguration Does
- Detects transport properties:
stdio.commandtriggers stdio transport;websocket.uritriggers WebSocket;http.uritriggers Streamable HTTP - Creates
AcpSyncClientandAcpAsyncClient: configured with timeout and client capabilities - Manages shutdown: the client, transport, and agent beans are closed once by the autoconfiguration’s own lifecycle, not left to Spring’s inferred
close()
Transport Selection
The autoconfiguration picks the transport based on which properties are set:Build & Run
Client Configuration Properties
View on GitHub