This commit implements the subagent Request for Discussion (RFD) protocol
for ACP, replacing ad-hoc inline/toolbox display modes with a unified
ToolCallStart + ToolCallProgress approach.
ACP Schema Extensions:
- Add SubagentRunInfo to session updates for tracking child sessions
- Add 'subagent' to ToolCallKind enum
- Add PromptDelegation for client-driven subagent routing policies
- Add SubagentCapabilities to agent capability advertisement
- Add AvailableSubagentsUpdate for dynamic subagent catalog
Subagent Catalog & Delegation:
- Implement SubagentCatalogProvider with debounced updates
- Add delegation handler supporting auto/disable/prefer/require policies
- Propagate cancellation to foreground child sessions
- Add ACPProtocolHandler for SessionPool-backed session management
Event Converter:
- Emit ToolCallStart(kind=subagent) with SubagentRunInfo on subagent start
- Emit ToolCallProgress with status completed/failed on subagent end
- Remove inline, tool_box, and legacy display mode code paths
- Remove subagent_display_mode from ACPServer, ACPSession, SessionManager
- Remove --subagent-display-mode CLI option and pool_server config
Tests:
- Add subagent integration, e2e flow, capability, catalog, and cancellation tests
- Update event converter snapshots for new subagent ToolCallStart format
- Remove obsolete test_acp_display_config verification test
Refs: PR #43
Summary
Implement the ACP Subagents Protocol (RFC-0042) in AgentPool to standardize subagent discovery, delegation, and session hierarchy for external ACP clients.
Changes
Phase 1 — Core Protocol Surface
ACP Schema Extensions ()
"subagent"toToolCallKindLiteralSubagentRunInfo,SubagentInfo,SubagentCapabilitiesSessionInfo(parent_session_id, child_session_ids, depth)subagentfield toToolCallStart/ToolCallProgressavailable_subagentsto lifecycle responsesSpawnSessionStart — Add
run_modefield (Literal["foreground", "background"])SessionData Hierarchy — Typed property accessors for
parent_tool_call_idandsubagent_idToolKind Sync Guardrail — Cross-definition equality test
Phase 2 — Advanced Features
Event Converter — Emits
ToolCallStart(kind="subagent")for tool_box and inline modesForeground Cancellation — Propagates to child sessions, background children survive
Capability Advertisement — Static
availableSubagentsin all session lifecycle responsesDelegation Handler — auto/disable/prefer/require policies with capability gating
SubagentCatalogProvider — Debounced updates (500ms) with cycle detection
Dynamic Notifications —
available_subagents_updateemitted after catalog changesTesting
Verification
Related