Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Or, if using `uv`:
"args": [
"run",
"/abs/path/to/agentclientprotocol/python-sdk/examples/echo_agent.py"
],
]
}
}
}
Expand All @@ -92,7 +92,6 @@ import asyncio
import sys
from pathlib import Path
from typing import Any
from uuid import uuid4

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

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


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

Run it with `run_agent()` inside an async entrypoint and wire it to your client. Refer to:
Expand Down
3 changes: 1 addition & 2 deletions examples/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ async def prompt(
| EmbeddedResourceContentBlock
],
session_id: str,
message_id: str | None = None,
**kwargs: Any,
) -> PromptResponse:
logging.info("Received prompt request for session %s", session_id)
Expand All @@ -113,7 +112,7 @@ async def prompt(
await self._send_agent_message(session_id, text_block("Client sent:"))
for block in prompt:
await self._send_agent_message(session_id, block)
return PromptResponse(stop_reason="end_turn", user_message_id=message_id)
return PromptResponse(stop_reason="end_turn")

async def cancel(self, session_id: str, **kwargs: Any) -> None:
logging.info("Received cancel notification for session %s", session_id)
Expand Down
6 changes: 4 additions & 2 deletions examples/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import sys
from pathlib import Path
from typing import Any
from uuid import uuid4

from acp import (
PROTOCOL_VERSION,
Expand All @@ -18,6 +17,8 @@
from acp.core import ClientSideConnection
from acp.schema import (
AgentMessageChunk,
AgentPlanContentUpdate,
AgentPlanRemovedUpdate,
AgentPlanUpdate,
AgentThoughtChunk,
AudioContentBlock,
Expand Down Expand Up @@ -102,6 +103,8 @@ async def session_update(
| ToolCallStart
| ToolCallProgress
| AgentPlanUpdate
| AgentPlanContentUpdate
| AgentPlanRemovedUpdate
| AvailableCommandsUpdate
| CurrentModeUpdate
| ConfigOptionUpdate
Expand Down Expand Up @@ -158,7 +161,6 @@ async def interactive_loop(conn: ClientSideConnection, session_id: str) -> None:
await conn.prompt(
session_id=session_id,
prompt=[text_block(line)],
message_id=str(uuid4()),
)
except Exception as exc:
logging.error("Prompt failed: %s", exc) # noqa: TRY400
Expand Down
3 changes: 1 addition & 2 deletions examples/echo_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ async def prompt(
| EmbeddedResourceContentBlock
],
session_id: str,
message_id: str | None = None,
**kwargs: Any,
) -> PromptResponse:
for block in prompt:
Expand All @@ -76,7 +75,7 @@ async def prompt(
chunk.content.field_meta = {"echo": True}

await self._conn.session_update(session_id=session_id, update=chunk, source="echo_agent")
return PromptResponse(stop_reason="end_turn", user_message_id=message_id)
return PromptResponse(stop_reason="end_turn")


async def main() -> None:
Expand Down
8 changes: 8 additions & 0 deletions examples/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from acp.core import ClientSideConnection
from acp.schema import (
AgentMessageChunk,
AgentPlanContentUpdate,
AgentPlanRemovedUpdate,
AgentPlanUpdate,
AgentThoughtChunk,
AllowedOutcome,
Expand Down Expand Up @@ -124,6 +126,8 @@ async def session_update( # noqa: C901
| ToolCallStart
| ToolCallProgress
| AgentPlanUpdate
| AgentPlanContentUpdate
| AgentPlanRemovedUpdate
| AvailableCommandsUpdate
| CurrentModeUpdate
| ConfigOptionUpdate
Expand All @@ -143,6 +147,10 @@ async def session_update( # noqa: C901
print("\n[plan]")
for entry in update.entries:
print(f" - {entry.status.upper():<10} {entry.content}")
elif isinstance(update, AgentPlanContentUpdate):
print(f"\n[plan update] {update.plan.id}")
elif isinstance(update, AgentPlanRemovedUpdate):
print(f"\n[plan removed] {update.id}")
elif isinstance(update, ToolCallStart):
print(f"\n🔧 {update.title} ({update.status or 'pending'})")
elif isinstance(update, ToolCallProgress):
Expand Down
2 changes: 1 addition & 1 deletion schema/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
refs/tags/v0.13.3
refs/tags/v0.13.6
3 changes: 1 addition & 2 deletions schema/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"session_prompt": "session/prompt",
"session_resume": "session/resume",
"session_set_config_option": "session/set_config_option",
"session_set_mode": "session/set_mode",
"session_set_model": "session/set_model"
"session_set_mode": "session/set_mode"
},
"clientMethods": {
"elicitation_complete": "elicitation/complete",
Expand Down
Loading
Loading