Skip to content

Commit b38e9e6

Browse files
committed
feat: update ACP schema to v0.13.6
Signed-off-by: Chojan Shang <psiace@apache.org>
1 parent 50a27ef commit b38e9e6

21 files changed

Lines changed: 749 additions & 605 deletions

docs/quickstart.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Or, if using `uv`:
7171
"args": [
7272
"run",
7373
"/abs/path/to/agentclientprotocol/python-sdk/examples/echo_agent.py"
74-
],
74+
]
7575
}
7676
}
7777
}
@@ -92,7 +92,6 @@ import asyncio
9292
import sys
9393
from pathlib import Path
9494
from typing import Any
95-
from uuid import uuid4
9695

9796
from acp import PROTOCOL_VERSION, spawn_agent_process, text_block
9897
from acp.interfaces import Client
@@ -116,7 +115,6 @@ async def main() -> None:
116115
await conn.prompt(
117116
session_id=session.session_id,
118117
prompt=[text_block("Hello from spawn!")],
119-
message_id=str(uuid4()),
120118
)
121119

122120
asyncio.run(main())
@@ -135,9 +133,9 @@ from acp import Agent, PromptResponse
135133

136134

137135
class MyAgent(Agent):
138-
async def prompt(self, prompt, session_id, message_id=None, **kwargs) -> PromptResponse:
136+
async def prompt(self, prompt, session_id, **kwargs) -> PromptResponse:
139137
# inspect prompt, stream updates, then finish the turn
140-
return PromptResponse(stop_reason="end_turn", user_message_id=message_id)
138+
return PromptResponse(stop_reason="end_turn")
141139
```
142140

143141
Run it with `run_agent()` inside an async entrypoint and wire it to your client. Refer to:

examples/agent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ async def prompt(
103103
| EmbeddedResourceContentBlock
104104
],
105105
session_id: str,
106-
message_id: str | None = None,
107106
**kwargs: Any,
108107
) -> PromptResponse:
109108
logging.info("Received prompt request for session %s", session_id)
@@ -113,7 +112,7 @@ async def prompt(
113112
await self._send_agent_message(session_id, text_block("Client sent:"))
114113
for block in prompt:
115114
await self._send_agent_message(session_id, block)
116-
return PromptResponse(stop_reason="end_turn", user_message_id=message_id)
115+
return PromptResponse(stop_reason="end_turn")
117116

118117
async def cancel(self, session_id: str, **kwargs: Any) -> None:
119118
logging.info("Received cancel notification for session %s", session_id)

examples/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import sys
77
from pathlib import Path
88
from typing import Any
9-
from uuid import uuid4
109

1110
from acp import (
1211
PROTOCOL_VERSION,
@@ -18,6 +17,8 @@
1817
from acp.core import ClientSideConnection
1918
from acp.schema import (
2019
AgentMessageChunk,
20+
AgentPlanContentUpdate,
21+
AgentPlanRemovedUpdate,
2122
AgentPlanUpdate,
2223
AgentThoughtChunk,
2324
AudioContentBlock,
@@ -102,6 +103,8 @@ async def session_update(
102103
| ToolCallStart
103104
| ToolCallProgress
104105
| AgentPlanUpdate
106+
| AgentPlanContentUpdate
107+
| AgentPlanRemovedUpdate
105108
| AvailableCommandsUpdate
106109
| CurrentModeUpdate
107110
| ConfigOptionUpdate
@@ -158,7 +161,6 @@ async def interactive_loop(conn: ClientSideConnection, session_id: str) -> None:
158161
await conn.prompt(
159162
session_id=session_id,
160163
prompt=[text_block(line)],
161-
message_id=str(uuid4()),
162164
)
163165
except Exception as exc:
164166
logging.error("Prompt failed: %s", exc) # noqa: TRY400

examples/echo_agent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ async def prompt(
6666
| EmbeddedResourceContentBlock
6767
],
6868
session_id: str,
69-
message_id: str | None = None,
7069
**kwargs: Any,
7170
) -> PromptResponse:
7271
for block in prompt:
@@ -76,7 +75,7 @@ async def prompt(
7675
chunk.content.field_meta = {"echo": True}
7776

7877
await self._conn.session_update(session_id=session_id, update=chunk, source="echo_agent")
79-
return PromptResponse(stop_reason="end_turn", user_message_id=message_id)
78+
return PromptResponse(stop_reason="end_turn")
8079

8180

8281
async def main() -> None:

examples/gemini.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from acp.core import ClientSideConnection
2323
from acp.schema import (
2424
AgentMessageChunk,
25+
AgentPlanContentUpdate,
26+
AgentPlanRemovedUpdate,
2527
AgentPlanUpdate,
2628
AgentThoughtChunk,
2729
AllowedOutcome,
@@ -124,6 +126,8 @@ async def session_update( # noqa: C901
124126
| ToolCallStart
125127
| ToolCallProgress
126128
| AgentPlanUpdate
129+
| AgentPlanContentUpdate
130+
| AgentPlanRemovedUpdate
127131
| AvailableCommandsUpdate
128132
| CurrentModeUpdate
129133
| ConfigOptionUpdate
@@ -143,6 +147,10 @@ async def session_update( # noqa: C901
143147
print("\n[plan]")
144148
for entry in update.entries:
145149
print(f" - {entry.status.upper():<10} {entry.content}")
150+
elif isinstance(update, AgentPlanContentUpdate):
151+
print(f"\n[plan update] {update.plan.id}")
152+
elif isinstance(update, AgentPlanRemovedUpdate):
153+
print(f"\n[plan removed] {update.id}")
146154
elif isinstance(update, ToolCallStart):
147155
print(f"\n🔧 {update.title} ({update.status or 'pending'})")
148156
elif isinstance(update, ToolCallProgress):

schema/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
refs/tags/v0.13.3
1+
refs/tags/v0.13.6

schema/meta.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"session_prompt": "session/prompt",
2828
"session_resume": "session/resume",
2929
"session_set_config_option": "session/set_config_option",
30-
"session_set_mode": "session/set_mode",
31-
"session_set_model": "session/set_model"
30+
"session_set_mode": "session/set_mode"
3231
},
3332
"clientMethods": {
3433
"elicitation_complete": "elicitation/complete",

0 commit comments

Comments
 (0)