AnthropicAgent and OpenAIAgent are thin wrappers around the AI SDK ToolLoopAgent with class-style ergonomics matching the CLI agents.
Import
Quick Start
Model Input
Both classes accept a model ID string ("claude-opus-4-6", "gpt-5.3-codex") or a prebuilt AI SDK language model instance.
Options
Constructors forward standard AI SDKToolLoopAgent settings:
instructionstoolsstopWhenmaxOutputTokenstemperatureproviderOptionsprepareCall
model: the wrapper resolves model-ID strings automatically.
Hijack Support
SDK agents do not reopen a provider-native CLI. Smithers persists the agent conversation and reopens it through a Smithers-managed REPL viasmithers hijack <runId>.
Live-run behavior:
- Smithers captures response history after each step via
onStepFinish. smithers hijackwaits until history is durable, cancels the live run, and opens the REPL.- On clean REPL exit, Smithers writes updated message history back and resumes the workflow automatically.
- Conversation hijack stays on the same agent implementation. Cross-engine hijack is not supported.
- Smithers reconstructs the original task agent from the workflow source.
CLI vs SDK
| CLI Agents | SDK Agents | |
|---|---|---|
| Billing | Provider subscription / local CLI | API billing |
| Tools | Provider CLI tool ecosystem | Smithers tools sandbox |
| Flexibility | Native CLI flags | AI SDK providerOptions |
ToolLoopAgent directly if you prefer. The wrappers are convenience, not a separate runtime.