Skip to content

Invoke-Acp

Terminal window
Invoke-Acp -Agent claude "add a regression test for the trailing-newline bug"

Alias: acp.

The cmdlet launches the agent as a subprocess, negotiates capabilities, opens a session rooted at the working directory, and then both streams the agent’s session/update notifications into the viewer and answers the callbacks the agent makes back — file reads and writes, and permission requests, which surface as a chooser. The agent runs as a separate process with its own model, its own key and its own tools; nothing here talks to an LLM.

ParameterTypeDefaultNotes
PromptstringPosition 0, accepts pipeline input. What to ask. Omitted on a terminal, the viewer opens empty and waits for i.
AgentstringclaudeA known name (claude, claude-code-acp, gemini, codex, opencode) or an executable on PATH that speaks ACP on stdio.
ArgumentListstring[]Alias Args. Extra arguments appended to the agent’s command line.
WorkspaceRootstringcurrent locationAliases Root, Path. Directory the session is rooted at.
AutoApproveswitchoffAnswer every permission request with the agent’s first allow-shaped option.
NoUiswitchoffSkip the viewer and write transcript objects to the pipeline.
ShowAgentLogswitchoffShow the agent’s stderr as transcript rows. Useful when a launch fails.
ConnectTimeoutSecondsint60ValidateRange(1, 600). Seconds to wait for initialize before giving up on the agent.
Cssstringbuilt-in agent sheetAliases Style, Stylesheet. Stylesheet name, inline CSS, or a .pcss path.
-AgentRuns
claude, claude-code-acpnpx -y @zed-industries/claude-code-acp
gemininpx -y @google/gemini-cli --experimental-acp
codexnpx -y @zed-industries/codex-acp
opencodeopencode acp

Matching is case-insensitive. Any other name is launched as-is with your ArgumentList:

Terminal window
Invoke-Acp "..." -Agent my-agent -ArgumentList '--stdio'

When the agent sends session/request_permission, the chooser renders the agent’s own options in its own order; Esc answers cancelled. -AutoApprove does not guess an option id — optionId strings are agent-specific, so it matches on the protocol-defined kind, preferring allow_always, then allow_once, then the first option. Declining always answers cancelled; it never falls through to an allow. Without an interactive view, an unset handler means every request is cancelled, which is the safe default for a non-interactive run.

Verified end-to-end against opencode 1.18.18:

Terminal window
Invoke-Acp "Read hello.txt and tell me the magic word." -Agent opencode -NoUi -AutoApprove

One cosmetic quirk: opencode sends tool-call titles with the drive letter stripped (Users\andyb\... rather than C:\Users\andyb\...). That is the agent’s own text, passed through verbatim — it looks like a bug here and is not.

The wire details — framing, capabilities, the nested permission outcome, confinement of the fs/* callbacks — are on the ACP reference page.