Skip to main content
Agent commands. Your AI agent uses this node in workflows. You don’t configure it directly.
The agent node gives a workflow an autonomous coding agent that can inspect files, edit a repository, run commands, and iterate. Each node declares backend: claude or backend: codex; the workflow-facing result and structured-output behavior stay the same across both. Use llm for text processing that does not need repository tools. Use code, shell, or http when one deterministic operation is enough.

Parameters

Shared parameters

Parameters remain flat. A backend-only parameter used with the other backend is a validation error, so a workflow cannot silently ignore a misspelled or misplaced permission setting.

Claude parameters

Claude sandbox keys include enabled, autoAllowBashIfSandboxed, excludedCommands, allowUnsandboxedCommands, network, enableWeakerNestedSandbox, and ignoreViolations. The backend passes unknown keys through for SDK forward compatibility while validating known value shapes.

Codex parameters

full-access maps to the Codex CLI’s danger-full-access mode. Dedicated node parameters take precedence over the same key in config.

Output

Schema soft-failures make the workflow DEGRADED, but the node still follows its normal success route. They do not trigger on-error; downstream logic should branch on the result shape or handle _schema_error in a fallback path.

Usage metadata

Both backends write these fields when usage is available:
Claude reports input_token_accounting: split_cache_fields and exposes the SDK comparison as api_equivalent_cost_usd. Codex reports total_includes_cache and adds reasoning_output_tokens. When a workflow declares model and the CLI emitted usage, pflow estimates api_equivalent_cost_usd from its LiteLLM pricing catalog and cache-aware token usage. The estimate remains null when usage is missing, model is omitted, or LiteLLM has no pricing; pflow does not inspect private Codex session files to infer the CLI-configured model. Agent backends leave canonical cost_usd as null because neither transport proves what the provider actually billed. API-equivalent cost is an estimate for comparison and planning, not evidence that a subscription-backed call incurred per-token charges. When schema recovery makes corrective calls, the top-level fields describe the final call and retries contains usage records for superseded calls. Reports and trace summaries aggregate the final call and those retry records.

Choose a backend

Claude-specific tool lists and sandbox settings let the workflow constrain the Claude Agent SDK surface.

Structured output

Both backends use their native JSON Schema support. The schema must declare top-level type: object; wrap arrays, primitives, or top-level combinators inside an object property.
The parsed object is available at ${review.result} and fields such as ${review.result.approved}. Pflow canonically coerces type-wrong scalar values, then asks the same session for a corrected object when needed. schema_retries controls those continuation calls. If the backend produces no session ID or still misses the schema, pflow preserves raw text in result, sets _schema_error, and marks the workflow DEGRADED. Set schema_retries: 0 when you want native structured output without pflow’s conformance check or corrective continuation.

Resume a session

Both backends expose a persistent identifier as llm_usage.session_id:
Claude resumes by SDK session ID. Codex resumes its on-disk CLI thread, so the ID also works across separate pflow invocations. A resumed Codex command does not re-apply initial cwd or add_dir flags; keep extra-directory assumptions explicit in the task.

Authentication

use_api_key is shared by both backends and fails closed on ambiguous values. Pflow never logs in, stores credentials, or requires a key; true is explicit permission for API-key or configured-provider billing.
With use_api_key: false, the node blanks ANTHROPIC_API_KEY for the Claude subprocess only so Claude Code can use its account/subscription login. Sibling llm nodes still see the original environment.Use claude setup-token for non-interactive subscription setup.
False mode controls the named first-party key variables, recognized stored API-key auth, and ordinary provider selection. It cannot prove custom profiles, providers, proxies, or base URLs are unmetered, and it cannot prevent account credits, auto-reload, overage, or administrator policy from applying.

Error handling

The node itself retries execution failures twice before surfacing the backend-specific error. Deterministic Codex installation and authentication failures are marked non-retriable for outer batch retries.