-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Summary
Type Client and AgentSideConnection are not the same, while on_connect params is a Client, it is a AgentSideConnection at runtime (
Line 59 in 4cc2dfd
| conn = AgentSideConnection( |
There is a cast forced here
https://github.com/agentclientprotocol/python-sdk/blob/main/src/acp/agent/connection.py#L64
When using Client, there are method such as create_terminal that does not return the same values nor property
I really like the move to snake case, but I think it added a lot of breaking changes, especially to load the Agent. Shouldn't this release have been a major ?
Reproduction steps
class ExampleAgent(Agent)
#...
@override
def on_connect(self, conn: Client) -> None:
self.client = conn
# ^ this is AgentSideConnection at runtime terminal_handle = await client.create_terminal(...)
print(terminal_handle.terminal_id)
# ^ this break because terminal_handle is not `CreateTerminalResponse` with `terminal_id` but `TerminalHandle` with `id`Also, having Client and AgentSideConnection being different type with no inheritence + AgenceSideConnection being now final make the test harder to write, especially when you need to stub AgentSideConnection
Expected result
Client and AgentSideConnection should have similar property so that the types expected at runtime are the same. I'd expect on_connect to receive an AgentSideConnection instead of Client which is a protocol
Actual result
class ExampleAgent(Agent)
#...
@override
def on_connect(self, conn: Client) -> None:
self.client = conn
# ^ this is AgentSideConnection at runtime terminal_handle = await client.create_terminal(...)
print(terminal_handle.terminal_id)
# ^ this break because terminal_handle is not `CreateTerminalResponse` with `terminal_id` but `TerminalHandle` with `id`Versions / environment
sdk 0.7.0, Python 3.12, macOS 15.7.3
Quick fix for now is to force cast Client into AgentSideConnection