Skip to content

Commit e5bcb8d

Browse files
author
Mark Pollack
committed
Add setSessionModel() to client API and acp-agent-support README
- Add setSessionModel() method to AcpAsyncClient and AcpSyncClient - Add @SetSessionModel test in AcpAgentSupportTest - Add comprehensive README.md for acp-agent-support module - Update main README.md to reference annotation-based agents
1 parent 7187b18 commit e5bcb8d

File tree

5 files changed

+627
-3
lines changed

5 files changed

+627
-3
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The Agent Client Protocol (ACP) standardizes communication between code editors
1414
- Async and sync APIs
1515
- Stdio and WebSocket transports
1616
- Capability negotiation and structured error handling
17+
- **[Annotation-based agents](acp-agent-support/README.md)** - Spring MVC-style `@AcpAgent`, `@Prompt` annotations
1718

1819
## Installation
1920

@@ -27,6 +28,15 @@ The Agent Client Protocol (ACP) standardizes communication between code editors
2728
</dependency>
2829
```
2930

31+
For annotation-based agent development:
32+
```xml
33+
<dependency>
34+
<groupId>com.agentclientprotocol</groupId>
35+
<artifactId>acp-agent-support</artifactId>
36+
<version>0.9.0</version>
37+
</dependency>
38+
```
39+
3040
For WebSocket server support (agents accepting WebSocket connections):
3141
```xml
3242
<dependency>
@@ -132,6 +142,44 @@ AcpAsyncAgent agent = AcpAgent.async(transport)
132142
agent.start().then(agent.awaitTermination()).block();
133143
```
134144

145+
### 2c. Hello World Agent (Annotation-Based)
146+
147+
For the simplest agent development experience, use annotations (see [full documentation](acp-agent-support/README.md)):
148+
149+
```java
150+
import com.agentclientprotocol.sdk.annotation.*;
151+
import com.agentclientprotocol.sdk.agent.SyncPromptContext;
152+
import com.agentclientprotocol.sdk.agent.support.AcpAgentSupport;
153+
import com.agentclientprotocol.sdk.spec.AcpSchema.*;
154+
155+
@AcpAgent
156+
class HelloAgent {
157+
158+
@Initialize
159+
InitializeResponse init() {
160+
return InitializeResponse.ok();
161+
}
162+
163+
@NewSession
164+
NewSessionResponse newSession() {
165+
return new NewSessionResponse(UUID.randomUUID().toString(), null, null);
166+
}
167+
168+
@Prompt
169+
PromptResponse prompt(PromptRequest req, SyncPromptContext ctx) {
170+
ctx.sendMessage("Hello from the agent!");
171+
return PromptResponse.endTurn();
172+
}
173+
}
174+
175+
// Bootstrap and run
176+
AcpAgentSupport.create(new HelloAgent())
177+
.transport(new StdioAcpAgentTransport())
178+
.run();
179+
```
180+
181+
This approach reduces boilerplate by ~50% compared to the builder API while producing identical runtime behavior.
182+
135183
---
136184

137185
## Progressive Examples
@@ -316,6 +364,8 @@ agent.start().block(); // Starts WebSocket server on port 8080
316364
| `com.agentclientprotocol.sdk.spec` | Protocol types (`AcpSchema.*`) |
317365
| `com.agentclientprotocol.sdk.client` | Client SDK (`AcpClient`, `AcpAsyncClient`, `AcpSyncClient`) |
318366
| `com.agentclientprotocol.sdk.agent` | Agent SDK (`AcpAgent`, `AcpAsyncAgent`, `AcpSyncAgent`) |
367+
| `com.agentclientprotocol.sdk.agent.support` | Annotation-based agent runtime (`AcpAgentSupport`) |
368+
| `com.agentclientprotocol.sdk.annotation` | Agent annotations (`@AcpAgent`, `@Prompt`, etc.) |
319369
| `com.agentclientprotocol.sdk.capabilities` | Capability negotiation (`NegotiatedCapabilities`) |
320370
| `com.agentclientprotocol.sdk.error` | Exceptions (`AcpProtocolException`, `AcpCapabilityException`) |
321371

0 commit comments

Comments
 (0)