Skip to content

Commit 4441d37

Browse files
committed
Basic implementation of ACP agent interface using Amazon Q CLI agent
The following features are supported: - New Session setup ("session/new") - Basic chat ("session/prompt" & "session/update") - Using built-in tool like fs_read and fs_write ("tool_call") - Request tool call permission ("session/request_permission") We use Symposium ACP as it provides a nicer interface to write non-blocking ACP agent The main method is handle_prompt_request: - submit the request to the agent - poll agent update events, convert them to ACP events, and send them back to ACP client - tell ACP client that the request is completed You can test this implementation using acp_client: cargo run -p agent -- acp-client ./target/debug/agent
1 parent 846669f commit 4441d37

File tree

11 files changed

+756
-0
lines changed

11 files changed

+756
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ book/
5050

5151
run-build.sh
5252
.amazonq/
53+
54+
chat.log

Cargo.lock

Lines changed: 142 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/agent/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ version.workspace = true
88
license.workspace = true
99

1010
[dependencies]
11+
agent-client-protocol = "0.7.0"
1112
amzn-codewhisperer-client.workspace = true
1213
amzn-codewhisperer-streaming-client.workspace = true
1314
amzn-consolas-client.workspace = true
@@ -55,6 +56,7 @@ rmcp = { version = "0.8.0", features = ["client", "transport-async-rw", "transpo
5556
rusqlite.workspace = true
5657
rustls.workspace = true
5758
rustls-native-certs.workspace = true
59+
sacp = "0.1"
5860
schemars = "1.0.4"
5961
semver.workspace = true
6062
serde.workspace = true

crates/agent/src/acp/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Agent-Client-Protocol (ACP)
2+
3+
This is an implementation of ACP agent interface using Amazon Q CLI agent
4+
5+
## Features
6+
7+
### Supported
8+
- New Session setup ("session/new")
9+
- Basic chat ("session/prompt" & "session/update")
10+
- Using built-in tool like fs_read and fs_write ("tool_call")
11+
- Request tool call permission ("session/request_permission")
12+
13+
### Not Supported
14+
- Tool call update ("tool_call_update" as part of "session/update")
15+
- Auth
16+
- Slash commands
17+
- MCP
18+
- Cancel
19+
- Session reload
20+
21+
## Usage
22+
23+
### Run ACP Agent (Standalone)
24+
```bash
25+
cargo run -p agent -- acp
26+
27+
# Test it with:
28+
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":1}}
29+
```
30+
31+
### Run ACP Client (for testing)
32+
```bash
33+
# Build agent first
34+
cargo build -p agent
35+
36+
# Run interactive test client
37+
cargo run -p agent -- acp-client ./target/debug/agent
38+
```
39+
40+
The test client automatically launch the ACP Agent. It provides a REPL interface for sending prompts to the agent and automatically approves tool permissions.

0 commit comments

Comments
 (0)