Method overview
| Area | Method / Type | Purpose |
|---|---|---|
| Setup | Config::load() | Load configuration from disk |
AgentFactory::new(cwd) | Create a factory for building agents | |
build_ephemeral_service(factory, config, cap) | Build an in-memory session service | |
| Sessions | service.create_session(req) | Create a session and run the first turn |
service.start_turn(id, req) | Continue an existing session | |
service.read(id) | Read session state | |
service.list() | List active sessions | |
service.archive(id) | Remove a session | |
| Agent | agent.run(prompt) | Run agent with a prompt |
agent.run_with_events(prompt, tx) | Run with event streaming | |
agent.cancel() | Cancel the current run |
Installation
Feature flag reference
Feature flag reference
| Feature | Description | Default |
|---|---|---|
anthropic | Anthropic Claude API client | Yes |
openai | OpenAI API client | No |
gemini | Google Gemini API client | No |
all-providers | All LLM providers | No |
jsonl-store | File-based session persistence | Yes |
memory-store | In-memory session storage | No |
session-store | Persistent sessions (redb-backed) | No |
session-compaction | Auto-compact long conversations | No |
memory-store-session | Semantic memory indexing | No |
Quick start
The recommended entry point isSessionService via build_ephemeral_service:
Sessions
SessionService is the canonical lifecycle API. All surfaces (CLI, REST, MCP, RPC) route through it.
Multi-turn conversations
Error handling
Running agents
Basic run
Run with event streaming
Agent methods
| Method | Description |
|---|---|
run(prompt) | Run agent with user input |
run_with_events(prompt, tx) | Run with event streaming |
session() | Get current session (read-only) |
budget() | Get current budget tracker |
state() | Get current loop state |
cancel() | Cancel the current run |
Error handling
Events
All event types
All event types
Core types
Message
ToolCall and ToolResult
RunResult
See also
- Tools and stores - tool system, session stores, MCP integration
- Advanced - AgentBuilder, providers, budget, sub-agents
- API reference - quick-lookup type index
