Skip to content

Invoke-Agent.ps1

Source file scripts/run-agent/Invoke-Agent.ps1. This page is generated from the file’s own help comment when the site is built.

Runs one headless `claude -p` call with the verified restricted flag set and classifies the result.
developer's own ~/.claude (user-level hooks and plugins) and CLAUDE.md. Every other flag is unchanged. It is refused (exit 5) when
GITHUB_ACTIONS is "true", so a CI run cannot use it.
claude's login lives in the default config folder, and an isolated CLAUDE_CONFIG_DIR logs it out ("Not logged in"), so in this
mode the default config folder is used, and --setting-sources user still limits settings to the user ones.
Agents get no command-running tools. Build agents may edit only the paths in -EditPaths.
Exit codes: 0 ok, 1 agent error (is_error, turn cap, no output, missing structured output), 2 timed out,
3 invocation error (bad flag), 4 wrong model, 5 bad arguments, 6 rate or usage limit (try again later).
Dot-source with -NoRun to use the functions in tests.
  • -Role
  • -Model
  • -PromptFile
  • -WorkDir
  • -OutDir
  • -Name
  • -MaxTurns
  • -TimeoutSec
  • -EditPaths
  • -JsonSchemaFile
  • -AddDir
  • -ConstraintsFile
  • -ClaudePath
  • -UseLocalLogin
  • -NoRun