ACP host hooks — permission, updates, cancel, stream
Python · package toolnexus · SPEC §8
Opt-in hooks on an ACP model source: choose the permission option, watch every session/update, cancel a turn, and stream through an in-process client.
What to use instead
Section titled “What to use instead”Python ships the ACP model source itself — load_acp(ACPOptions(command=..., args=[...]))
returns a warm ACPClient whose generate you hand to
create_in_process_client(model=..., generate=acp.generate) — but not the four host hooks.
Today, in Python:
- Permissions are answered by the client with the first option whose
kindstarts withallow; there is noon_permissioncallback. To gate what the agent may do, start it in a restricted mode (ACPOptions(mode=...), sent assession/set_mode) or a sandboxedcwd.permission_timeout(default 5 s) bounds a turn. - Updates: only
agent_message_chunktext forms the reply; thoughts, tool calls and plans are not surfaced (noon_update). - Cancel and streaming are not available:
generateis synchronous and a client built on it runs non-streaming only. Useclient.runand show the final text.
The Go port has all four (Go reference); the other ports are
tracked in openspec/changes/add-go-host-asks task 2.6d.
See also
Section titled “See also”create_client— The unified client: system prompt, skills injection, parallel and chained tool calls, retries, memory.Client.run— Send a prompt, let the loop call tools until the model stops, get a RunResult.Client.stream— The streaming loop: text deltas, tool-call events, and suspension events as they happen.Hooks— Intercept before/after model calls and tool calls: audit, redact, veto, or rewrite.