Title
ACP support for Agentao via stdio JSON-RPC server
Summary
Implement minimum viable Agent Client Protocol (ACP) support in Agentao so ACP-compatible clients can launch Agentao over stdio, create and load sessions, send prompts, receive streaming session updates, request tool permissions, and cancel active turns.
The first milestone targets a pragmatic compatibility layer on top of existing Agentao runtime abstractions rather than a full architecture rewrite. The implementation should reuse the current transport abstraction, session persistence, permission engine, cancellation flow, and MCP support where possible.
Goals
stdioinitializesession/newsession/promptsession/cancelsession/loadsession/update eventssession/request_permissionNon-goals for v1
stdiofs/* and terminal/*Acceptance Criteria
initialize -> session/new -> session/prompt flow successfully.session/update notifications.Dependencies / Reuse
agentao/transport/*agentao/agent.pyagentao/tool_runner.pyagentao/session.pyagentao/mcp/*Risks
Path.cwd() usage is process-global and not safe for ACP multi-session semantics.Title
Create ACP module skeleton and stdio JSON-RPC server foundation
Problem
Agentao does not expose any ACP-compatible server endpoint today. There is no JSON-RPC server, no ACP method dispatcher, and no ACP-specific module boundary.
Scope
agentao/acp/protocol.pyserver.pysession_manager.pytransport.pymodels.pyImplementation Checklist
agentao/acp/__init__.pyagentao/acp/protocol.pyagentao/acp/server.pyagentao/acp/server.pymethodAcceptance Criteria
Title
Implement ACP initialize handshake and capability negotiation
Problem
ACP clients require an initialize handshake before any session methods. Agentao currently has no ACP capability advertisement layer.
Scope
initializeagentCapabilities, agentInfo, and auth metadataImplementation Checklist
protocolVersion, clientCapabilities, and clientInfoloadSession capabilityagentInfo with name, title, versionAcceptance Criteria
initializeTitle
Add ACP session registry and per-session Agentao runtime lifecycle
Problem
ACP is session-based, but Agentao currently does not maintain ACP session state or a registry of runtime instances keyed by ACP session ID.
Scope
AcpSessionStateImplementation Checklist
AcpSessionState in agentao/acp/models.pysession_id, agent, cwd, client_capabilities, cancel_tokensession_manager.pyAcceptance Criteria
Title
Implement ACP session/new and runtime initialization from request params
Problem
There is no ACP entry point for creating a new session, binding a working directory, or injecting per-session MCP configuration.
Scope
session/newcwdImplementation Checklist
cwd from requestmcpServers from requestsessionIdACPTransport and inject it into AgentaoPermissionEngine for the sessionsessionIdAcceptance Criteria
sessionId can be used in later requestsTitle
Refactor Agentao to support per-session working directories
Problem
Current runtime code relies on Path.cwd() in several places. ACP sessions require working directory semantics that are not tied to the server process global cwd.
Scope
Implementation Checklist
Path.cwd() usageworking_directory to Agentao.__init__.agentao/ behavior under ACP sessionsAcceptance Criteria
Title
Implement ACP session/prompt with ContentBlock to Agentao message conversion
Problem
ACP prompt requests use structured content blocks, but Agentao currently accepts mostly string user input at its runtime boundary.
Scope
session/promptImplementation Checklist
ContentBlock[]text blocks in v1resource_link blocks with a documented minimal mappingAcceptance Criteria
Title
Implement ACP transport adapter for session/update notifications
Problem
Agentao emits internal runtime events, but ACP clients expect session/update notifications using ACP update types.
Scope
ACPTransportAgentEvent values to ACP update notificationsImplementation Checklist
EventType.LLM_TEXT to ACP agent message updatesEventType.TOOL_START to ACP tool call updatesEventType.TOOL_OUTPUT to incremental tool call content updatesEventType.TOOL_COMPLETE to terminal tool call updatesEventType.THINKINGAcceptance Criteria
session/update notifications during a turnTitle
Map Agentao tool confirmations to ACP session/request_permission
Problem
Agentao tool confirmation is currently synchronous and transport-local. ACP requires a protocol-level permission request flow.
Scope
ACPTransport.confirm_toolImplementation Checklist
session/request_permission from ACP transportallow_once and reject_onceallow_session in v1 if feasibleallow_session is supported, update session permission stateAcceptance Criteria
Title
Implement ACP session/cancel using existing Agentao cancellation flow
Problem
ACP clients must be able to cancel an active turn. Agentao already has cancellation primitives, but they are not exposed as ACP session methods.
Scope
session/cancelCancellationTokenImplementation Checklist
session/cancel handlerAcceptance Criteria
Title
Implement ACP session/load and replay saved session history as ACP updates
Problem
Agentao can persist and load sessions locally, but ACP requires protocol-level session loading and replay through session/update.
Scope
session/loadImplementation Checklist
agentao/session.py load pathAcceptance Criteria
Title
Support session-scoped MCP server injection from ACP session/new
Problem
ACP session creation may include MCP server configuration, but Agentao currently loads MCP mostly from local config files at startup.
Scope
Implementation Checklist
mcpServers to Agentao MCP configAcceptance Criteria
Title
Add ACP CLI entrypoint and runtime wiring for stdio mode
Problem
There is no supported way to launch Agentao as an ACP server from the command line.
Scope
--acp and --stdio startup pathImplementation Checklist
main.pyAcceptance Criteria
agentao --acp --stdio starts a valid ACP serverTitle
Add ACP unit, integration, and end-to-end test coverage
Problem
ACP support spans protocol framing, session state, transport mapping, cancellation, permissions, and persistence. Without dedicated tests, regressions will be hard to detect.
Scope
Implementation Checklist
tests/test_acp_protocol.pytests/test_acp_initialize.pytests/test_acp_session_new.pytests/test_acp_prompt.pytests/test_acp_transport.pytests/test_acp_permissions.pytests/test_acp_cancel.pytests/test_acp_load.pytests/test_acp_multi_session.pyAcceptance Criteria
Title
Document ACP support, limitations, and launch flow
Problem
ACP support will be non-obvious to users and contributors without dedicated documentation and clear statement of current limits.
Scope
Implementation Checklist
docs/ACP.mdREADME.md with ACP launch and scopeAcceptance Criteria
M1: Basic ACP Connectivity
M2: Streaming, Permissions, Cancellation
M3: Persistence and MCP
M4: Hardening and Release