AgentBuilder
For most use cases, prefer
SessionService via build_ephemeral_service() (see
overview). AgentBuilder is used internally by AgentFactory::build_agent().
Direct usage is only needed when bypassing the session service entirely.All builder methods
All builder methods
| Method | Description | Default |
|---|---|---|
model(name) | Set the model identifier | "claude-opus-4-6" |
system_prompt(prompt) | Set the system prompt | None |
max_tokens_per_turn(n) | Max tokens per LLM call | 8192 |
temperature(t) | Sampling temperature (0.0-1.0) | None (model default) |
budget(limits) | Set resource limits | Unlimited |
retry_policy(policy) | Configure retry behavior | 3 retries with backoff |
resume_session(session) | Resume from existing session | New session |
provider_params(json) | Provider-specific parameters | None |
with_hook_engine(engine) | Attach a hook engine | None |
with_hook_run_overrides(overrides) | Run-scoped hook overrides | Empty |
Providers
Built-in clients for major LLM providers:- Anthropic
- OpenAI
- Gemini
Provider parameters
Pass provider-specific options viaAgentBuildConfig:
- Anthropic
- OpenAI
- Gemini
Implementing a custom LLM client
Implementing a custom LLM client
Budget configuration
Retry configuration
Sub-agent spawning
Spawn parallel sub-agents for concurrent work:Forking conversations
Forking conversations
Hook helpers
Complete example
Python and TypeScript SDKs
Both communicate with a localrkat rpc subprocess over JSON-RPC 2.0 — no native bindings required.
- Python: Python SDK overview
- TypeScript: TypeScript SDK overview
See also
- Rust SDK overview - getting started, sessions, events
- Tools and stores - tool system, stores, MCP
- API reference - type index
- Architecture - system design and internals
