Skip to content

feat: major Python-style refactoring underway, preparing to release version 0.7.x. - #39

Merged
PsiACE merged 10 commits into
mainfrom
0.7.x
Dec 4, 2025
Merged

feat: major Python-style refactoring underway, preparing to release version 0.7.x.#39
PsiACE merged 10 commits into
mainfrom
0.7.x

Conversation

@PsiACE

@PsiACEPsiACE commented Nov 20, 2025

Copy link
Copy Markdown
Member

Summary

Bring in the 0.7.x changes, which resolve most points raised in #30.
Includes major refactoring and compatibility-preserving improvements — with special thanks to @frostming for the exceptional contributions.

Related issues

Closes#30

Testing

  • Ran make check
  • Ran make test
  • Manual verification of example flows on 0.7.x
  • Confirmed backward compatibility for existing import paths and common execution paths

Checklist

  • Conventional Commit title (chore: for DNM aggregation work)
  • Tests cover the change or are not required (covered by existing 0.7.x refactor tests)
  • Docs/examples updated when behaviour is user-facing (planned for release)
  • Schema regenerations (make gen-all) not applicable at this stage

frostmingand others added 5 commits November 19, 2025 15:10
* feat: change field names to snake case
Signed-off-by: Frost Ming <me@frostming.com>
* fix lint errors
Signed-off-by: Frost Ming <me@frostming.com>
---------
Signed-off-by: Frost Ming <me@frostming.com>
* feat: Auto-generate agent/client methods based on the schema
Signed-off-by: Frost Ming <me@frostming.com>
* fix: overrides in gen_schema.py
Signed-off-by: Frost Ming <me@frostming.com>
---------
Signed-off-by: Frost Ming <me@frostming.com>
…compatible (#37)
* feat: Expose new APIs for running agent and connect with client
Signed-off-by: Frost Ming <me@frostming.com>
* fix: allow camelCase for accessing
Signed-off-by: Frost Ming <me@frostming.com>
* fix: make the docs clearer
Signed-off-by: Frost Ming <me@frostming.com>
* doc: add a migration guide
Signed-off-by: Frost Ming <me@frostming.com>
---------
Signed-off-by: Frost Ming <me@frostming.com>
…ection (#38)
* fix: backward compatibility for the default behavior of AgentSideConnection
Signed-off-by: Frost Ming <me@frostming.com>
* fix: add 0.7 Migration Guide to navigation
Signed-off-by: Frost Ming <me@frostming.com>
---------
Signed-off-by: Frost Ming <me@frostming.com>
* fix: use classmethod for error factory methods
Signed-off-by: Frost Ming <me@frostming.com>
* fix: update return type hints for RequestError factory methods
Signed-off-by: Frost Ming <me@frostming.com>
---------
Signed-off-by: Frost Ming <me@frostming.com>
@frostming

frostming commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

I’m considering whether we need to add a helper function that allows the agent to serve on a TCP host port pair and also make client connect to it. Is there a real use case for it? AFAIK it seems Zed only supports stdio streams.

@PsiACE

Copy link
Copy Markdown
MemberAuthor

I’m considering whether we need to add a helper function that allows the agent to serve on a TCP host port pair and also make client connect to it. Is there a real use case for it? AFAIK it seems Zed only supports stdio streams.

I believe this is useful. Having observed several instances of acp being utilised on SaaS platforms, I support it.

Additionally, we may need to consider how to address the changes introduced by this PR agentclientprotocol/agent-client-protocol#252

@frostming

Copy link
Copy Markdown
Contributor

Additionally, we may need to consider how to address the changes introduced by this PR agentclientprotocol/agent-client-protocol#252

Hmm, the schema generation failed on the new json schema. Not sure whether it is an issue with the schema or generator.

@PsiACE

Copy link
Copy Markdown
MemberAuthor

Additionally, we may need to consider how to address the changes introduced by this PR agentclientprotocol/agent-client-protocol#252

Hmm, the schema generation failed on the new json schema. Not sure whether it is an issue with the schema or generator.

Just need to add a small guard in scripts/gen_schema.py that rewrites bare booleans under anyOf/allOf/oneOf to {}/{"not":{}} so datamodel-code-generator doesn’t choke. And I only checked the main schema so far — for the "unstable schema" parts, probably need to add a few small handlers as well.

@benbrandt

Copy link
Copy Markdown
Member

@PsiACE I found a transform on my end that can rewrite these bools. will push it up

@PsiACE

Copy link
Copy Markdown
MemberAuthor

@PsiACE I found a transform on my end that can rewrite these bools. will push it up

Thanks, @benbrandt . That will make things a lot smoother for the Python generator.

Also, if it makes sense, I’d like to suggest adding @frostming to the Python team in the org . He’s done an exceptional amount of work — essentially a full rewrite of the SDK — and would be a great fit for long-term maintenance and reviews.

* feat: update to unstable schema and metadata
Signed-off-by: Frost Ming <me@frostming.com>
* feat: adapt to the 0.7.0 schema
Signed-off-by: Frost Ming <me@frostming.com>
---------
Signed-off-by: Frost Ming <me@frostming.com>
Signed-off-by: Frost Ming <me@frostming.com>
- LInt and fix examples/*
- Switch to pdm.backend
- Exclude .uv-cache and .github from sdist build
Signed-off-by: Frost Ming <me@frostming.com>
@PsiACE

Copy link
Copy Markdown
MemberAuthor

We've been on this branch for a while, and agentclientprotocol is now at version 0.9. Given the relatively short interval, I'd prefer to skip the intermediate versions and release a 0.9.x.

@benbrandt

Copy link
Copy Markdown
Member

Don't feel your sdk needs to match the Json schema version

We don't for any other SDK

@benbrandt

Copy link
Copy Markdown
Member

I am aiming to get the JSON schema representation to a 1.0, but this already doesn't match the protocol version, and it is likely you'll want to have a breaking change at some point to make things nicer for your user that won't be aligned with a release of a breaking change in the schema representation or the protocol itself

@benbrandt

Copy link
Copy Markdown
Member

Tldr; feel free to release as 0.7 which is likely more intuitive to your users. The schema representation changed but the wire format has remained uncuanged

@PsiACE

Copy link
Copy Markdown
MemberAuthor

Tldr; feel free to release as 0.7 which is likely more intuitive to your users. The schema representation changed but the wire format has remained uncuanged

That sounds good too, thank you for pointing that out. In fact, others have suggested this approach as well. So the Python SDK will establish its own repair and release schedule.

* chore: make check happy
Signed-off-by: Chojan Shang <chojan.shang@vesoft.com>
* chore: gen schema with 0.9.1
Signed-off-by: Chojan Shang <chojan.shang@vesoft.com>
* chore: bump to 0.7.0
Signed-off-by: Chojan Shang <chojan.shang@vesoft.com>
---------
Signed-off-by: Chojan Shang <chojan.shang@vesoft.com>
@PsiACE
PsiACE marked this pull request as ready for review December 4, 2025 15:29
CopilotAI review requested due to automatic review settings December 4, 2025 15:29
@PsiACEPsiACE changed the title [DNM] refactor: significant pythonic restructuring preparing 0.7.xfeat: major Python-style refactoring underway, preparing to release version 0.7.x.Dec 4, 2025

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces significant Pythonic restructuring in preparation for the 0.7.x release, upgrading the protocol schema from v0.6.3 to v0.9.1. The changes focus on improving code quality, maintainability, and developer experience while maintaining backward compatibility.

Key Changes:

  • Migrated to snake_case naming convention throughout the API with a comprehensive compatibility layer
  • Introduced new high-level run_agent() and connect_to_agent() helpers to simplify common workflows
  • Refactored the router system for better maintainability and reduced boilerplate

Reviewed changes

Copilot reviewed 44 out of 47 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
src/acp/schema.pyUpdated schema to v0.9.1 with snake_case field names and new models (ListSessionsResponse, SessionCapabilities, etc.)
src/acp/router.pySimplified router with integrated legacy API support and unstable protocol warnings
src/acp/utils.pyAdded param_model decorator, to_camel_case converter, and compatibility wrapper functions
src/acp/interfaces.pyUpdated Protocol definitions with snake_case methods and @param_model decorators
src/acp/core.pyAdded run_agent() and connect_to_agent() convenience functions
src/acp/client/connection.pyMigrated to snake_case API with @compatible_class decorator for backward compatibility
src/acp/agent/connection.pySimilar migration with added listen() method for manual receive loop control
tests/conftest.pyCentralized test fixtures with TestClient and TestAgent implementations
tests/test_compatibility.pyNew comprehensive backward compatibility tests
examples/*.pyUpdated all examples to use new snake_case API
scripts/gen_*.pyEnhanced code generation with signature generation and improved schema processing

The PR successfully balances modernization with backward compatibility, providing deprecation warnings to guide users toward the new API patterns.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

server.server_reader,
)
agent_conn = ClientSideConnection(client, server._client_writer, server._client_reader) # type: ignore[arg-type]
_agent_conn = AgentSideConnection(

CopilotAIDec 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable _agent_conn is not used.

Copilot uses AI. Check for mistakes.
assert resp.session_id == "test-session-123"

with pytest.warns(DeprecationWarning) as record:
resp = await agent_conn.new_session(cwd="/home/tmp", mcp_servers=[])

CopilotAIDec 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment to 'resp' is unnecessary as it is redefined before this value is used.

Copilot uses AI. Check for mistakes.
Comment threadscripts/gen_schema.py
Comment on lines +343 to +344
for offset, line in enumerate(to_insert.splitlines(), 1):
lines.insert(insert_idx + offset, line)

CopilotAIDec 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nested for statement uses loop variable 'line' of enclosing for statement.

Suggested change
foroffset, lineinenumerate(to_insert.splitlines(), 1):
lines.insert(insert_idx+offset, line)
foroffset, insert_lineinenumerate(to_insert.splitlines(), 1):
lines.insert(insert_idx+offset, insert_line)

Copilot uses AI. Check for mistakes.
Signed-off-by: Chojan Shang <chojan.shang@vesoft.com>
@PsiACE

Copy link
Copy Markdown
MemberAuthor

The major changes appear to be complete. I will merge this PR and release version 0.7.0 to gather some feedback.

@PsiACE
PsiACE merged commit a09e090 into mainDec 4, 2025
8 checks passed
@PsiACE
PsiACE deleted the 0.7.x branch December 4, 2025 15:56
Sign up for freeto 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.

feat: Refactor the API to expose less types users need to import

4 participants

@PsiACE@frostming@benbrandt