Agent interface and works anywhere Smithers accepts an agent, including <Task>.
The agent spawns the CLI, passes the prompt, captures output, and returns a GenerateTextResult.
For API-billed provider wrappers, see SDK Agents.
Import
Prerequisites
| Agent | CLI Required | Install |
|---|---|---|
ClaudeCodeAgent | claude | Claude Code CLI |
CodexAgent | codex | OpenAI Codex CLI |
GeminiAgent | gemini | Gemini CLI |
PiAgent | pi | PI Coding Agent |
KimiAgent | kimi | Kimi CLI |
ForgeAgent | forge | Forge CLI |
AmpAgent | amp | Amp CLI |
Quick Start
Hijack Support
All built-in CLI agents support native-session hijack viasmithers hijack <runId>.
| Agent | Hijack Mode | Native Relaunch |
|---|---|---|
ClaudeCodeAgent | Native CLI session | claude --resume <session> |
CodexAgent | Native CLI session | codex resume <session> -C <cwd> |
GeminiAgent | Native CLI session | gemini --resume <session> |
PiAgent | Native CLI session | pi --session <session> |
KimiAgent | Native CLI session | kimi --session <session> --work-dir <cwd> |
ForgeAgent | Native CLI session | forge --conversation-id <id> -C <cwd> |
AmpAgent | Native CLI session | amp threads continue <thread> |
- Live run: Smithers waits until the agent is between blocking tool calls before aborting.
- Finished/cancelled run: Smithers reopens the latest persisted native session.
- If the hijacked session exits successfully, the workflow resumes automatically in detached mode.
- Cross-engine hijack is not supported.
smithers hijack <runId> --launch=false to inspect the resumable candidate without opening the session.
Base Options
| Option | Default | Description |
|---|---|---|
id | Random UUID | Agent instance identifier |
model | undefined | Model name passed to --model |
systemPrompt | undefined | System instructions prepended to the prompt |
instructions | undefined | Alias for systemPrompt |
cwd | Tool context rootDir or process.cwd() | Working directory for the spawned process |
env | {} | Extra environment variables merged with process.env |
yolo | true | Skip all interactive permission prompts |
timeoutMs | undefined | Hard wall-clock timeout; kills process after this many ms |
idleTimeoutMs | undefined | Inactivity timeout; kills process after this many ms with no output |
maxOutputBytes | undefined | Truncate captured output to this size |
extraArgs | [] | Additional CLI flags |
Timeouts
timeoutMs: hard wall-clock cap.idleTimeoutMs: inactivity cap, resets on any stdout/stderr output.
ClaudeCodeAgent
Wrapsclaude CLI with --print mode.
Claude-Specific Options
| Option | Description |
|---|---|
outputFormat | "text", "json", or "stream-json" (default: "text") |
permissionMode | "bypassPermissions", "acceptEdits", "default", "delegate", "dontAsk", "plan" |
allowedTools | Tool name whitelist |
disallowedTools | Tool name blacklist |
maxBudgetUsd | Spending cap in USD |
mcpConfig | MCP server configuration files |
addDir | Additional context directories |
yolo is true (default), the agent passes --allow-dangerously-skip-permissions, --dangerously-skip-permissions, and --permission-mode bypassPermissions unless permissionMode is explicitly set.
CodexAgent
Wrapscodex CLI using codex exec with stdin input.
Codex-Specific Options
| Option | Description |
|---|---|
sandbox | "read-only", "workspace-write", or "danger-full-access" |
fullAuto | Full auto mode (no confirmations) |
config | Configuration overrides as key-value pairs or raw strings |
oss | Use open-source models |
localProvider | Local model provider URL |
outputLastMessage | File path to write the last message (auto-generated if not set) |
yolo is true and fullAuto is not set, passes --dangerously-bypass-approvals-and-sandbox. If fullAuto is true, uses --full-auto instead.
Prompt is passed via stdin using the - argument.
GeminiAgent
Wraps thegemini CLI.
Gemini-Specific Options
| Option | Description |
|---|---|
sandbox | Run in sandbox mode |
approvalMode | "default", "auto_edit", "yolo", or "plan" |
allowedTools | Tool name whitelist |
extensions | Gemini CLI extensions to load |
includeDirectories | Additional directories to include |
outputFormat | "text", "json", or "stream-json" (default: "json") |
yolo is true and approvalMode is not set, passes --yolo.
Prompt is passed via --prompt.
PiAgent
Wraps thepi CLI.
PI-Specific Options
| Option | Description |
|---|---|
provider | PI provider name (--provider) |
model | PI model (--model) |
apiKey | Passed to --api-key (prefer env/config for secrets) |
mode | text, json, or rpc |
print | Force --print in text mode |
continue / resume / session | Session continuation controls |
sessionDir | Custom session directory |
models / listModels | Scoped model patterns and listing |
extension | Extension path(s) |
skill | Skill path(s) |
promptTemplate | Prompt template path(s) |
theme | Theme path(s) |
tools / noTools | Enable specific tools or disable built-ins |
export | Export session HTML |
files | File args passed as @path (text/json modes) |
onExtensionUiRequest | RPC-only handler for extension UI requests |
noSession | Disable session persistence (default true unless session flags set) |
files emit as @path arguments. In rpc mode, the prompt is sent as JSON over stdin. Text mode defaults to --print without --mode; json/rpc set --mode and omit --print.
For workflow hijack, Smithers automatically uses PI’s structured event stream and keeps session persistence enabled regardless of noSession.
KimiAgent
Wrapskimi CLI using --print mode.
Kimi-Specific Options
| Option | Description |
|---|---|
thinking | Enable/disable thinking mode |
outputFormat | "text" or "stream-json" (default: "text") |
finalMessageOnly | Only print the final assistant message |
quiet | Alias for --print --output-format text --final-message-only |
agent | Built-in agent spec: "default" or "okabe" |
agentFile | Path to custom agent specification file |
skillsDir | Skills directory path |
mcpConfigFile | MCP config file(s) |
maxStepsPerTurn | Max steps in one turn |
maxRetriesPerStep | Max retries in one step |
maxRalphIterations | Extra iterations after the first turn in Loop mode |
yolo is true (default), passes --print which implicitly adds --yolo.
Prompt is passed via --prompt.
ForgeAgent
Wrapsforge CLI. Supports 300+ models via --prompt.
Forge-Specific Options
| Option | Description |
|---|---|
directory | Working directory (-C); defaults to cwd |
provider | Model provider name |
agent | Agent type |
conversationId | Resume conversation by ID |
sandbox | Sandbox name |
restricted | Enable restricted mode |
workflow | Workflow file path |
event | Event JSON for workflow triggers |
conversation | Conversation file path |
--prompt mode auto-approves tool use; no separate yolo flag.
Prompt is passed via --prompt.
AmpAgent
Wrapsamp CLI using --execute mode.
Amp-Specific Options
| Option | Description |
|---|---|
visibility | Thread visibility: "private", "public", "workspace", "group" |
mcpConfig | MCP configuration file path |
settingsFile | Custom settings file path |
logLevel | "error", "warn", "info", "debug", "audit" |
logFile | Log output file path |
dangerouslyAllowAll | Allow all tool calls without confirmation |
yolo is true (default) or dangerouslyAllowAll is true, passes --dangerously-allow-all.
Prompt is passed via --execute. Automatically passes --no-ide, --no-jetbrains, --no-color, and --archive for headless execution.
Agent Interface
All CLI agents implement two methods.generate(options)
Runs the CLI synchronously and returns a GenerateTextResult:
- Extracts prompt from
options.prompt(string) oroptions.messages(array). - Builds the CLI command with all configured flags.
- Spawns the process and captures stdout/stderr.
- For
json/stream-jsonoutput, extracts text from the JSON payload. - Returns the result as a
GenerateTextResult.
stream(options)
Calls generate() internally and wraps the result as a StreamTextResult. Not truly streamed.
Message Handling
When called with messages, agents convert them to a text prompt:- System messages are extracted and prepended as a system prompt.
- User/assistant messages are formatted as
ROLE: content, joined with double newlines. - Message system prompt is combined with any
systemPrompton the agent instance.