Skip to content

Conversation

@erbenmo
Copy link
Contributor

@erbenmo erbenmo commented Nov 2, 2025

Description of changes:
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

Testing:

~/Documents/Work/2025/Project/UI/amazon-q-developer-cli $ cargo run -p agent -- acp-client ./target/debug/agent
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.43s
     Running `target/debug/agent acp-client ./target/debug/agent`
ACP Test Client - Type messages to send to agent (Ctrl+C to exit)
> hey how are you doing?
Agent: I
Agent: 'm doing well, thanks for asking! I'm
Agent:  here and ready to help you with AWS
Agent:  services, development tasks, or anything
Agent:  else you need assistance with. What
Agent:  can I help you with today?
> can you reverse a linked list and write it to reverse_list.py
Agent: I'll create
Agent:  a minimal
Agent:  linked list rever
Agent: sal implementation
Agent:  for you.
🔧 Tool Call: ToolCall {
    id: ToolCallId(
        "tooluse_qV0FLzMtS4qi7MAJerLlyQ",
    ),
    title: "fsWrite",
    kind: Other,
    status: Pending,
    content: [],
    locations: [],
    raw_input: Some(
        Object {
            "__tool_use_purpose": String("Creating a Python file with minimal linked list reversal code"),
            "command": String("create"),
            "path": String("reverse_list.py"),
            "content": String("class ListNode:\n    def __init__(self, val=0, next=None):\n        self.val = val\n        self.next = next\n\ndef reverse_list(head):\n    prev = None\n    current = head\n    while current:\n        next_temp = current.next\n        current.next = prev\n        prev = current\n        current = next_temp\n    return prev"),
        },
    ),
    raw_output: None,
    meta: None,
}
Permission request from server: RequestPermissionRequest { session_id: SessionId("1c1f81d3-c2ce-464d-86b8-496403ad4da5"), tool_call: ToolCallUpdate { id: ToolCallId("tooluse_qV0FLzMtS4qi7MAJerLlyQ"), fields: ToolCallUpdateFields { kind: None, status: Some(Pending), title: Some("fsWrite"), content: None, locations: None, raw_input: Some(Object {"__tool_use_purpose": String("Creating a Python file with minimal linked list reversal code"), "command": String("create"), "path": String("reverse_list.py"), "content": String("class ListNode:\n    def __init__(self, val=0, next=None):\n        self.val = val\n        self.next = next\n\ndef reverse_list(head):\n    prev = None\n    current = head\n    while current:\n        next_temp = current.next\n        current.next = prev\n        prev = current\n        current = next_temp\n    return prev")}), raw_output: None }, meta: None }, options: [PermissionOption { id: PermissionOptionId("allow"), name: "Allow", kind: AllowOnce, meta: None }, PermissionOption { id: PermissionOptionId("deny"), name: "Deny", kind: RejectOnce, meta: None }], meta: None }
Agent: Done
Agent: ! I've created `reverse_list.py
Agent: ` with a minimal linked list reversal implementation.
Agent:  The `reverse_list` function takes
Agent:  the head of a linked list and returns the new
Agent:  head after reversing it using the standar
Agent: d three-pointer approach.
> ^C
~/Documents/Work/2025/Project/UI/amazon-q-developer-cli $ cat reverse_list.py 
class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

def reverse_list(head):
    prev = None
    current = head
    while current:
        next_temp = current.next
        current.next = prev
        prev = current
        current = next_temp
    return prev~/Documents/Work/2025/Project/UI/amazon-q-developer-cli $ 

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

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
@erbenmo erbenmo changed the title Support ACP interface Basic implementation of ACP agent interface using Amazon Q CLI agent Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant