fix(acp): answer initialize with version 1 instead of rejecting newer protocol versions
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 20/100
Research direction
Read _initialize in runtimes/common/agentkit_serve_common/acp.py and the related tests in runtimes/common/tests/test_acp_protocol.py; an open linked pull request (#73) indicates work is already underway. The issue specifies valid and invalid version cases; done means the tests pass and initialize returns protocol version 1 for valid requests while rejecting invalid values.
Written by the indexing model from the issue text.
Description
Problem
When a client connects to AgentKit's ACP mode, the first message is initialize. It carries protocolVersion, the newest ACP version the client can speak. The ACP spec says how the agent must answer:
If the Agent supports the requested version, it MUST respond with the same version. Otherwise, the Agent MUST respond with the latest version it supports.
The client then decides whether it can work with that version.
AgentKit doesn't follow this. In runtimes/common/agentkit_serve_common/acp.py, _initialize rejects any version other than 1 with an "invalid params" error, around line 577:
if type(version) is not int or version != ACP_PROTOCOL_VERSION:
raise ACPProtocolError(_INVALID_PARAMS, f"protocolVersion must be {ACP_PROTOCOL_VERSION}")
ACP version 2 is now published as a draft, and clients are starting to ask for it. A client that sends protocolVersion: 2 gets an error from AgentKit instead of the answer "1", which the client could have accepted.
What
Answer initialize with version 1 whenever the client asks for any valid version, so the client can decide. Keep rejecting values that aren't a valid version number.
Out of scope:
- Supporting ACP version 2. This change only makes AgentKit answer correctly for the version it supports.
Why
- It follows the ACP spec.
- Clients that try version 2 first, then fall back to 1, keep working with AgentKit.
- Orka plans to ask newer agents for version 2 one day, see orka-agents/orka#749. AgentKit shouldn't break when that happens.
How
- In
_initialize, accept any integer from 0 to 65535, the range ACP version numbers use. Always reply with"protocolVersion": ACP_PROTOCOL_VERSION. Keep the "invalid params" error for anything else: a missing value, a string, a float, a boolean, or a number outside that range. Python treatsTrueas an integer, which the existingtype(version) is not intcheck already rejects. Keep that check. - Add tests in
runtimes/common/tests/test_acp_protocol.py:- Requests for 1, 2 and 65535 all get
protocolVersion: 1back, and the session works afterwards. - Requests for 0 get 1 back.
- A missing value,
"1",1.0,true, -1 and 65536 get "invalid params".
- Requests for 1, 2 and 65535 all get
- Run
uv run --directory runtimes/common --extra dev pytest -q.
Done when
initializewith any valid version returnsprotocolVersion: 1.- Values that aren't valid versions still return "invalid params".
- The tests above pass.
- Dominant language
- Python
- Stars
- 7
- Forks
- 5
- Avg merge
- 3h 39m
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from orka-agents/agentkit
-
fix(pydantic-ai): CI fails with newest pydantic-ai (unexpected 'history' argument)Possibly taken @gambtho claimed this 30 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
orka-agents/agentkit#77 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
orka-agents/agentkit#76 · 3 comments ·
-
area/build area/orka area/runtime blocked enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
orka-agents/agentkit#69 ·
-
area/build area/orka area/runtime enhancement
Difficulty 4/5 3-5 days Newbie friendliness 68/100
orka-agents/agentkit#68 ·
-
area/build enhancement testing
Difficulty 5/5 Over a week Newbie friendliness 42/100
orka-agents/agentkit#65 ·
All issues in orka-agents/agentkit
Similar issues
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 62/100
DaoCloud/DaoCloud-docs#7839 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
sav-oss-org/ptusa_main#1610 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug status/accepted type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/apm#4925 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
sagemathinc/sagebrush#1701 ·
Maintainers usually reply within 1 day