ClaudeCliBackend.build_command()

Build the claude -p argv for one stdin-prompted invocation.

Usage

Source

ClaudeCliBackend.build_command(
    model,
    schema_path,
    agent,
)

Every invocation runs without session persistence. Agent invocations add --permission-mode auto and a $1 --max-budget-usd cap; non-agent invocations empty the system prompt, disable setting sources, and load no MCP servers. A schema adds --json-schema with --output-format json.

Parameters

model: str

Claude model name or alias, e.g. haiku.

schema_path: str | None

Inline JSON schema passed to --json-schema, or None.

agent: bool
Whether the invocation may use tools / agent capabilities.

Returns

list[str]
The argv list to execute.