AgentSideConnection
Base classes¶
| Name | Children | Inherits |
|---|---|---|
| Client aclientp.client.protocol Base client interface for ACP. |
⋔ Inheritance diagram¶
graph TD
95970862967696["connection.AgentSideConnection"]
95970858218656["protocol.Client"]
95970836711072["typing.Protocol"]
95970835676112["typing.Generic"]
125067848591872["builtins.object"]
95970858218656 --> 95970862967696
95970836711072 --> 95970858218656
95970835676112 --> 95970836711072
125067848591872 --> 95970835676112
🛈 DocStrings¶
Bases: Client
Agent-side connection.
Use when you implement the Agent and need to talk to a Client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_agent
|
Callable[[AgentSideConnection], Agent] | Agent
|
factory that receives this connection and returns your Agent |
required |
input
|
ByteSendStream (local -> peer) |
required | |
output
|
ByteReceiveStream (peer -> local) |
required |
Source code in src/aclientp/agent/connection.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
__aenter__
async
¶
__aexit__
async
¶
__init__
¶
__init__(
to_agent: Callable[[AgentSideConnection], Agent] | Agent,
input_stream: ByteSendStream,
output_stream: ByteReceiveStream,
observers: list[StreamObserver] | None = None,
*,
debug_file: str | None = None,
) -> None
Initialize the agent-side connection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_agent
|
Callable[[AgentSideConnection], Agent] | Agent
|
factory that receives this connection and returns your Agent |
required |
input_stream
|
ByteSendStream
|
ByteSendStream (local -> peer) |
required |
output_stream
|
ByteReceiveStream
|
ByteReceiveStream (peer -> local) |
required |
observers
|
list[StreamObserver] | None
|
list of StreamObserver instances to observe the connection |
None
|
debug_file
|
str | None
|
path to a file to write debug information to |
None
|
Source code in src/aclientp/agent/connection.py
auth_status_update
async
¶
auth_status_update(params: AuthStatusUpdateNotification) -> None
UNSTABLE: Notify the client that the authentication state changed.
Source code in src/aclientp/agent/connection.py
close
async
¶
create_terminal
async
¶
create_terminal(params: CreateTerminalRequest) -> CreateTerminalResponse
Create a terminal on the client.
Source code in src/aclientp/agent/connection.py
elicitation
async
¶
elicitation(params: ElicitationRequest) -> ElicitationResponse
Request structured user input from the client.
Source code in src/aclientp/agent/connection.py
elicitation_complete
async
¶
elicitation_complete(params: ElicitationCompleteNotification) -> None
Notify the client that a URL-based elicitation has completed.
Source code in src/aclientp/agent/connection.py
ext_method
async
¶
ext_notification
async
¶
kill_terminal
async
¶
kill_terminal(params: KillTerminalRequest) -> KillTerminalResponse
Kill a terminal on the client.
Source code in src/aclientp/agent/connection.py
mcp_message
async
¶
mcp_message(params: MessageMcpRequest) -> MessageMcpResponse
UNSTABLE: Send an inner MCP request to an acp MCP server the client declared.
Source code in src/aclientp/agent/connection.py
mcp_notification
async
¶
mcp_notification(params: MessageMcpNotification) -> None
UNSTABLE: Send an inner MCP notification over mcp/message.
Source code in src/aclientp/agent/connection.py
on_connection
classmethod
¶
on_connection(
connection: Connection, to_agent: Callable[[AgentSideConnection], Agent] | Agent
) -> tuple[AgentSideConnection, MethodHandler]
Serve v1 on an existing connection, returning the side and its handler.
Used by the version router (:mod:aclientp.router), which owns the connection
until initialize and then delegates incoming messages to the handler.
Source code in src/aclientp/agent/connection.py
read_text_file
async
¶
read_text_file(params: ReadTextFileRequest) -> ReadTextFileResponse
Read text file from the client.
Source code in src/aclientp/agent/connection.py
release_terminal
async
¶
release_terminal(params: ReleaseTerminalRequest) -> ReleaseTerminalResponse
Release a terminal on the client.
Source code in src/aclientp/agent/connection.py
request_permission
async
¶
request_permission(params: RequestPermissionRequest) -> RequestPermissionResponse
Request permission from the client.
Source code in src/aclientp/agent/connection.py
session_update
async
¶
session_update(params: SessionNotification) -> None
Send session update notification.
Source code in src/aclientp/agent/connection.py
terminal_output
async
¶
terminal_output(params: TerminalOutputRequest) -> TerminalOutputResponse
Show terminal output on the client.
Source code in src/aclientp/agent/connection.py
wait_closed
async
¶
wait_for_terminal_exit
async
¶
wait_for_terminal_exit(params: WaitForTerminalExitRequest) -> WaitForTerminalExitResponse
Wait for a terminal to exit on the client.
Source code in src/aclientp/agent/connection.py
write_text_file
async
¶
write_text_file(params: WriteTextFileRequest) -> WriteTextFileResponse
Write text file to the client.