Skip to main content
For the full guide, see Memory.
The runtime toggles shown below still depend on a memory-enabled build. If the binary was compiled without the relevant memory features, enable_memory and --tools full do not magically add semantic memory on their own.

Enable semantic memory

When memory is enabled, discarded conversation turns are indexed into a semantic store. The agent gains a memory_search tool to recall past context on demand.
When memory is enabled, the agent automatically gains the memory_search tool. It calls this tool when it needs to recall information from earlier, compacted-away turns. The tool call appears in the event stream like any other tool invocation:
Results are returned as a JSON array with similarity scores and the typed source handle (the half-open offset range of the source message(s) the entry was indexed from). Memory is scoped to a single session; results do not carry a session_id, and there is no cross-session recall:
Scores range from 0.0 (no match) to 1.0 (exact match). Useful results are typically above 0.7.

Compaction

Context compaction triggers automatically when the conversation history exceeds a token threshold. The compactor summarizes older turns, keeps recent ones, and indexes discarded messages into memory. The compaction cycle emits events into the session stream:
Custom thresholds via the Rust SDK:

Budget limits

Cap resource usage per session with token, time, and tool-call limits. When a budget is exhausted, the agent loop terminates gracefully.

Budget events

When consumption nears a limit, a warning event is emitted before the budget is fully exhausted:

Retry policy

Transient LLM errors (rate limits, network timeouts) trigger automatic retries with exponential backoff. Each retry attempt emits an event carrying the typed failure and the scheduled retry plan:
Retries consume time budget but not token budget. If the time budget expires during a backoff wait, the agent terminates with a budget-exhausted error.

Next step