Skip to main content
CLI-backed agent classes wrap external AI command-line tools and implement the AI SDK Agent interface. Use them anywhere Smithers accepts an agent, including <Task>. Reach for these for a vendor’s full CLI surface (sessions, sandboxes, slash commands, MCP). For API-billed provider wrappers, see SDK Agents.
API reference: Agents lists every agent class, its options, and links to source and tests.

Quick Start

Available agents

CLI binaries must be on PATH: codex, cursor-agent, claude, agy, gemini, pi, omp, kimi, grok, forge, hermes, amp, vibe, opencode, openclaw, pool, smithers-nanocodex. HermesCliAgent drives the Hermes agent CLI. It is distinct from HermesAgent, which talks to the Hermes model over an OpenAI-compatible HTTP API. Use HermesCliAgent to delegate a task to the Hermes coding agent itself; use HermesAgent to call a Hermes model endpoint. OpenClawAgent drives openclaw agent in JSON mode. Pass agent for a named OpenClaw agent, sessionId to resume a session with --session-id, workspace to set the workspace path, and continueSession when the installed CLI should continue its active session.

Default routing: Claude builds and gates, Codex checks

When bunx smthrs init detects usable Codex authentication, its generated implementation pool starts with Claude Opus 5, the checking pools start with Codex workers using exact model pins, and the orchestration seats run on Claude: Start substantial implementation on Claude Opus 5, escalating to Fable 5 for the most ambitious builds; Sol takes final review and second opinions, Terra takes validation and tool-heavy checking, and Luna stays on trivial, minimal-risk work only. Never give GPT-5.6 Sol or Terra the orchestration or gating seat; those decisions run on Claude, with Codex Sol behind it only as an availability fallback. Other adapters stay later in automatic sequential fallback chains, while an explicitly constructed provider agent remains a deliberate choice. See SOTA role defaults.

Oh My Pi (OMP) CLI Agent

OmpAgent runs the installed OMP v17.0.5 harness in headless text, JSON print, or RPC mode.

Mode defaults

When mode is omitted, Smithers picks it from the call. A streaming run (any <Task>, or a generate() that passes onEvent) defaults to rpc: a persistent session, the same protocol the interactive OMP TUI speaks, so the agent runs its full multi-turn tool loop instead of answering once and exiting. Everything else defaults to text. Set mode: "json" to opt back into a one-shot --print --mode json execution. That is the cheaper choice for genuinely single-turn work such as classification or extraction, where a persistent session only costs extra tokens and latency. A streaming run that passes file arguments falls back to one-shot json automatically, because RPC mode rejects files. Smithers emits only flags verified by omp --help: --print, --mode, model/provider and system-prompt options, --cwd, session controls, tools, extensions, plural comma-separated --skills, thinking (off, minimal, low, medium, high, xhigh, max, or auto), hooks, --max-time, and approval controls. Credentials are delivered through the provider’s documented environment variable (for example OPENAI_API_KEY or ANTHROPIC_API_KEY), never as --api-key; an explicit key fails closed when no safe provider/model mapping is known. A valued --resume takes precedence over continueSession; --continue selects OMP’s recent session. In RPC mode, prompts are sent over stdin and file arguments are rejected. JSON print mode emits a session header followed by agent-session events such as text deltas, tool execution lifecycle events, and agent_end; terminal assistant messages are authoritative when present, including delta-free completions. RPC mode begins with ready, negotiates get_state, then sends a correlated prompt; it has no print-mode session header and completes on agent_end or documented local-only prompt completion. Pi-only flags such as --session, --list-models, singular --skill, --prompt-template, and --theme are not emitted.

Codex CLI Agent

CodexAgent is the Smithers wrapper for OpenAI’s codex CLI. It runs codex exec in non-interactive mode, sends the task prompt over stdin, forces --json so Smithers can stream structured progress, and captures the final assistant message via --output-last-message.
For ChatGPT-account Codex auth, use an exact Codex model id such as gpt-5.6-luna; do not invent a -codex suffix.

Authentication

  • Subscription login: run codex login once. For isolated accounts, pass configDir; Smithers sets CODEX_HOME for that invocation.
  • apiKey: Smithers sets OPENAI_API_KEY on the spawned process, but Codex CLI >= 0.144 ignores that variable for auth/billing selection when subscription login is present. The option is therefore effectively inert on current CLIs; the subscription login wins.
  • Account registry: bunx smthrs agents add --provider codex ... registers a subscription config directory, while --provider openai-api registers API-key billing for Codex-compatible providers.

Structured output

  • If the Smithers task has an output schema and outputSchema is not set, Smithers writes a temporary OpenAI-compatible JSON Schema file and passes it as --output-schema.
  • Resume attempts use codex exec resume <thread-id> and skip --output-schema, matching the Codex CLI’s resume command surface.
  • Hijack opens native Codex with codex resume <thread-id> -C <cwd>.

Claude Code CLI Agent

ClaudeCodeAgent is the Smithers wrapper for Anthropic’s claude CLI. It runs the CLI non-interactively, captures the final assistant message, and (by default) forces --output-format stream-json so Smithers can stream structured progress.

Authentication

  • Subscription billing (default): ClaudeCodeAgent clears ANTHROPIC_API_KEY from the spawned process so the CLI bills your Claude Pro/Max subscription instead of the API. No key is required. The agent logs a one-time warning when it unsets an inherited ANTHROPIC_API_KEY.
  • Subscription login: the claude CLI stores credentials per config directory. To set up an isolated subscription, run CLAUDE_CONFIG_DIR=<dir> claude once and complete /login interactively, or let Smithers drive it: bunx smthrs agents add --provider claude-code --label <name> --tmux launches the CLI in a detached tmux session and registers the account when the browser login completes. Credentials land at <dir>/.credentials.json, or on macOS in a per-config-dir Keychain item (Claude Code-credentials-<first 8 hex of sha256(configDir)>).
  • Pinning a subscription: pass configDir to use that directory’s credentials. Smithers sets CLAUDE_CONFIG_DIR=<configDir> for that invocation, so you can run several subscriptions side by side. Omit it to use the default ~/.claude/.
  • API billing: pass apiKey to bill the Anthropic API instead. When apiKey is set, Smithers stops clearing ANTHROPIC_API_KEY and forwards your key as ANTHROPIC_API_KEY to the spawned claude process.
Check and reauthenticate every registered Claude subscription sequentially:
The command probes each login and refreshes expired access tokens before it opens a browser. It prompts only for missing or rejected credentials. Pass --force to log out and reauthenticate every target. Pass --label <name> to select one label. --include-default also checks the ambient ~/.claude login. On macOS, forced authentication deletes the exact per-config-dir Keychain item before login so Claude Code cannot silently reuse a stale token. The result names each signed-in subscription and warns when labels share one Anthropic organization and quota. bunx smthrs usage --fresh shows the 5-hour, weekly, Opus, Sonnet, and Fable windows that the provider returns. Fable has a 50% weekly plan cap. Smithers normalizes the shared weekly value against that cap when the provider omits a dedicated Fable window.

Multi-account Claude pool

Use the registered subscriptions as one quota-aware task chain:
Copy every permission, sandbox, and tool option from the old ClaudeCodeAgent into agentOptions["claude-code"]. Smithers orders healthy accounts by model-specific headroom. It persists provider reset times and skips known rate-limited accounts without starting Claude again. A cached window at 100% also blocks the account until its reported reset. The run seed keeps every account at the same chain index after quota state changes. The example excludes the ambient ~/.claude login because fallback: [] disables the default tail. Omit that line to keep the ambient login as the last fallback. Use agents reauth --include-default to check it too. A live agent process cannot change its account chain. After editing the workflow, cancel the old run and start a new run:
Do not use retry-task to apply this source edit. It resets task state inside the existing run, while resume rejects a changed workflow source hash. To use the same pool in an interactive shell, run:
The wrapper selects an unblocked registered account, sets CLAUDE_CONFIG_DIR, and launches claude. Pass --label <name> to pin one account or --dry-run to print the selection without launching it.
Codex also supports codex login / CODEX_HOME via configDir. Although its apiKey option sets OPENAI_API_KEY, current Codex CLIs do not use that variable to switch away from subscription auth.

Subscription-mode structured completion

You do not need a Workflow or Task graph to call a model once and get a typed object back. Construct a CLI agent and call agent.generate({ prompt, outputSchema, timeout, abortSignal }) directly. With no apiKey, the call bills the host subscription, returns a single completion, and is bounded by timeout and abortSignal. generate() resolves to an AI SDK GenerateTextResult. Read the full text from .text; when the response is valid JSON, Smithers parses it into .output using the AI SDK 7 structured-output field.

Claude Code (subscription, no API key)

ClaudeCodeAgent.generate() does not auto-inject the schema into the prompt (that injection happens inside <Task>), so when calling it standalone, instruct JSON in the prompt yourself. outputSchema drives .output parsing and validation. Setting outputFormat: "json" and tools: "" keeps the run a single quiet completion with no tool use.

Codex (subscription, strict JSON)

CodexAgent with nativeStructuredOutput: true forwards the schema to the CLI as codex exec --output-schema, so the model is constrained to emit JSON matching the schema. No API key is needed; it bills your ChatGPT subscription via ~/.codex/auth.json (or CODEX_HOME when configDir is set).
Notes:
  • No API key is required for either agent; the call bills the host subscription.
  • outputSchema is honored differently per agent: Codex constrains decoding via --output-schema (strict JSON); Claude Code relies on the JSON you ask for in the prompt and parses it into .output. Both validate against the schema.
  • A single generate() call returns one completion. There is no graph, no durability, and no retry loop unless you add one. For schema-validation retries, durability, and multi-step orchestration, wrap the agent in a <Task>.
  • timeout: { totalMs, idleMs } caps wall-clock and idle time; pass an AbortSignal to cancel from the outside.

Common options

All CLI agents accept the same base option surface:

Provider retry/recovery policy

recoveryPolicy adds typed provider error recovery to generate and stream on every CLI agent. A failed attempt is classified by the policy: before substantive model/tool/file activity the attempt is retried fresh, and after substantive activity the exact emitted CLI session is resumed. Failed-attempt callbacks (events, stdout, stderr) are quarantined under a byte cap and released only for the terminal attempt, replayed lifecycle events are deduplicated on resume, backoff is bounded under the combined caller and policy deadline, and caller cancellation aborts promptly. The primary use is provider rate limits, for example Codex routed through OpenRouter returning HTTP 429.
classifyError receives the attempt’s error, bounded stdout/stderr tails, whether substantive activity occurred, the resume id the CLI emitted, and the elapsed/remaining window. It returns retry-fresh, resume-session, or terminal. validateResumeSession can verify the captured resume id before a resume retry uses it; an unverifiable id surfaces the error instead of resuming blindly. Per-call timeout override:

Per-agent extras

ClaudeCodeAgent extends the base with Claude Code-specific session and permission flags. Key additions: permissionMode, sessionId, mcpConfig, resume.

Allow-list and deny-list tools

allowedTools and disallowedTools are independent string arrays that map to the Claude Code CLI’s --allowed-tools and --disallowed-tools. Use them together: allowedTools whitelists what the agent may use, and disallowedTools hard-blocks tools even if they would otherwise be allowed. To let an agent read and write files but never run a shell, list both:
Setting allowedTools alone does not block Bash; the deny-list is what forbids it. Tool names follow the Claude Code convention (Read, Write, Edit, Bash, WebFetch, Grep, …) and Bash(git:*)-style scoping is allowed.

Custom-provider usage normalization

When Claude Code is routed to an Anthropic-compatible custom provider whose usage fields differ from Anthropic’s, pass normalizeUsage. The hook receives the raw stream-json result payload and returns the normalized usage shape; it applies consistently to completed events, generate results, stream results, and failures. For DeepSeek’s supported Claude Code integration, use the shipped createDeepSeekUsageNormalizer(): it maps prompt_cache_miss_tokens to inputTokens, prompt_cache_hit_tokens to cacheReadTokens, and output_tokens to outputTokens, and rejects ambiguous legacy Anthropic aliases instead of silently mis-billing them.

MCP servers (mcpConfig)

mcpConfig is a string array passed straight through to the CLI’s --mcp-config flag. Each entry is either a path to an MCP config JSON file or an inline JSON string (the Claude Code CLI accepts both forms), so you can mix them:
CodexAgent extends the base with OpenAI Codex-specific flags. Key additions: sandbox, config, outputSchema.
CursorAgent wraps Cursor’s cursor-agent CLI in headless print mode. Key additions: apiKey, mode, force, sandbox, workspace, pluginDir, resume, continueSession, and worktree.
CursorAgent defaults to --print --output-format stream-json --stream-partial-output --trust --workspace <task cwd>. Passing apiKey sets CURSOR_API_KEY for the spawned process; otherwise Cursor uses its normal local login state. AntigravityAgent wraps the Google agy CLI. Key additions: allowedMcpServerNames, geminiDir, conversation, continue, and resume.
Current agy builds changed several Gemini-era flags. Smithers treats that as a runtime contract, not a best-effort pass-through: Smithers does not emit --output-format, --include-directories, --resume, --screen-reader, --debug, extension flags, session-list flags, or --prompt for Antigravity. Options that would require those removed flags fail fast with AGENT_CONFIG_INVALID and a replacement hint. Plugins are managed outside workflow launch through agy plugin. GeminiAgent is the deprecated legacy wrapper for the older gemini CLI. Prefer AntigravityAgent for new Google CLI integrations, but existing workflows can still use GeminiAgent.
PiAgent wraps the Pi CLI and adds extension UI hook support. Key additions: provider, model, mode, onExtensionUiRequest, extension, thinking.
KimiAgent wraps the Moonshot Kimi CLI with automatic session isolation. Key additions: thinking, agent, maxRalphIterations.
Kimi CLI dialects, usage, sessions, and homes
cliVersion: "0.29" targets the @moonshot-ai/kimi-code@0.29.x argv surface: the command builder emits only flags that CLI accepts (--prompt, --output-format, --model, --yolo, --continue, --skills-dir, --agent, --agent-file, and repeated --add-dir), omits the newer-only flags (--print, --final-message-only, --work-dir, --thinking/--no-thinking, the step/retry controls, the MCP config flags), and never forwards a synthetic --session. The default dialect (no cliVersion) is unchanged. wireUsage extracts invocation-local token usage from the CLI’s wire.jsonl. Kimi stream JSON carries no token usage; the wire log records per-step counters on StatusUpdate messages (token_usage.input_cache_read, input_cache_creation, input_other, output). The CLI writes one log per session at <home>/sessions/<workspace>/<session>/wire.jsonl, so every log under the invocation home is position-baselined at invocation start and again after resumed session state is seeded; logs the invocation creates count in full and historical tokens are not re-billed. Reads enforce byte, entry, file, and directory bounds. The delta is attached to the completed event as normalized usage. Pass path to read one explicit log instead. sessionRecovery resolves and publishes the actual resumable session id from CLI output or the on-disk session index instead of the synthetic pre-launch id, and reports it through onSessionResolved. The session index is the workspace-scoped directory tree the CLI writes (<home>/sessions/<workspace>/<session>/), so the published id is the session id kimi -r accepts, never the workspace directory that contains it. With sessionStateDir set, a resumed session’s on-disk state is copied into the isolated invocation home before launch and persisted back at exit, preserving its workspace-scoped path, so resume works across invocations. State copies enforce byte, file, and directory bounds. credentialDir separates the shared credential source directory (read-only use by the live child) from an isolated per-invocation runtime home (runtimeDir or a fresh temp dir), so parallel invocations share credentials without contending over mutable session and config state. credentialDir and configDir are mutually exclusive. Unlike the other agents, KimiAgent’s configDir sets the KIMI_SHARE_DIR environment variable for that invocation (Kimi has no separate config-dir flag), pinning credentials and session state to <configDir> instead of the default ~/.kimi/. It is exactly equivalent to env: { KIMI_SHARE_DIR: "<configDir>" }; the configDir name just keeps the option uniform across agents. GrokAgent wraps xAI’s official Grok Build CLI. Smithers uses the CLI adapter, not a direct HTTP adapter, because xAI ships a coding-agent CLI with native tools, streaming JSON, and resumable sessions. The exact current model id lives in the SOTA registry; omit model to let the CLI pick its default.
The adapter streams text, tool-call lifecycle events, per-session token usage, and the terminal session id from --output-format streaming-json. It resumes with --resume and discards dead session ids immediately when Grok reports that no matching session exists. Typed tasks use Grok Build’s native --json-schema constraint; Smithers reads the schema-validated structuredOutput from the terminal event. The protocol does not provide enough verified before/after data for Smithers to claim file-diff support. Authenticate an isolated subscription with:
This runs grok login --device-auth with an isolated GROK_HOME and registers its configDir. For API billing, register --provider xai-api --api-key ...; Smithers supplies the key only through XAI_API_KEY, never argv or events, and uses an isolated GROK_HOME so ambient subscription credentials cannot win. Both account kinds participate in fallbackAgents() and oneshot routing. Persisted 429 reset times make a limited account sink to the end of its pool. xAI publishes limits and shows them in its console, but exposes no live account usage endpoint. bunx smthrs usage therefore reports xAI exposes no live usage endpoint instead of estimating a quota window. ForgeAgent wraps the Forge CLI and supports 300+ models via provider/model strings. Key additions: conversationId, provider, workflow.
HermesCliAgent wraps the Nous Research Hermes Agent CLI in its headless one-shot mode (hermes -z "<prompt>"): a single prompt in, the final response text out. Key additions: provider, continueSession. A per-call resumeSession emits -r <session>; a configured continueSession emits -c [name].
Smithers also installs a native Hermes plugin (slash commands, a live-run status injector, lifecycle hooks, a bundled skill, and approval buttons) when you run bunx smthrs hermes (an alias for bunx smthrs mcp add --agent hermes), so Hermes can drive Smithers as its durable control plane. See the Hermes & Eliza page. OpenClawAgent wraps the OpenClaw gateway-backed agent CLI via openclaw agent --message <prompt> --json. Key additions: agent, session, workspace, json, and continueSession. A per-call resumeSession emits --session-id <id>, so Smithers can route retries or continuations into the right OpenClaw conversation when the installed CLI supports sessions.
Smithers also installs a native OpenClaw plugin when you run bunx smthrs mcp add --agent openclaw. The plugin adds Smithers workflow tools, a bundled orchestration skill, and eval/optimization tools that encourage OpenClaw to turn repeated work into reusable, measured workflows. See OpenClaw. AmpAgent wraps the Amp CLI in --execute headless mode. Key additions: visibility, mcpConfig, dangerouslyAllowAll.
VibeAgent wraps Mistral’s vibe CLI with streaming JSON output. Key additions: agent, maxTurns, maxPrice, maxTokens, enabledTools, sessionId, continueSession.
OpenCodeAgent wraps the OpenCode CLI via opencode run --format json. Key additions: agentName, continueSession, sessionId. Note: native hijack support is not yet shipped.
PoolAgent wraps pool exec with ACP-compatible NDJSON streaming. It supports named agents, explicit sandbox mode, and manual session continuation.

Hijack handoff

Most built-in CLI agents support bunx smthrs hijack RUN_ID, which relaunches the agent in its native CLI session for interactive takeover. Smithers persists the native session or conversation id on each task event. On hijack, it waits for a safe boundary between blocking tool calls, then reopens the session via the vendor’s resume flag: On clean exit the workflow resumes in detached mode. Grok, Cursor, Vibe, OpenCode, and OpenClaw stream capture and headless session continuation are documented above, but native bunx smthrs hijack support for Grok, Cursor, Vibe, OpenCode, and OpenClaw is not shipped yet. The deprecated GeminiAgent has no native hijack launcher; use AntigravityAgent (agy --conversation) for Google CLI takeover. See How it works → Durability and resume.

Notes

  • Yolo defaults. yolo: true (default) maps to each CLI’s “skip approvals” flag (--dangerously-skip-permissions, --dangerously-bypass-approvals-and-sandbox, --yolo, --dangerously-allow-all). Set yolo: false or use the agent-specific approval option for tighter control.
  • Pi rpc mode sends prompts as JSON over stdin and is required for onExtensionUiRequest callbacks; text/json modes pass the prompt as a positional arg with files emitted as @path.
  • Kimi share dir. KimiAgent auto-creates an isolated KIMI_SHARE_DIR per invocation to prevent kimi.json corruption under concurrent runs. Pass configDir (or env.KIMI_SHARE_DIR) to pin a specific directory instead, or credentialDir to keep credentials shared but read-only while each invocation runs in its own runtime home.
  • Antigravity config. AntigravityAgent launches the agy binary and passes configDir/geminiDir as both --gemini_dir and GEMINI_DIR, matching Antigravity’s ~/.gemini/antigravity-cli config root. Current agy prompts use -p, extra directories use --add-dir, and native resume uses --conversation.
  • Non-idempotent retries. When a <Task> retries, Smithers prepends a warning listing previously-called side-effect tools so the agent can verify external state before re-invoking them.