Skip to main content

Crate agent_core

Crate agent_core 

Source
Expand description

agent-core — the unified agent runtime.

It wraps the codex harness-style agent loop and guarantees the context contract: every Agent::run first recalls context from the store (vector/semantic recall — see context::embed), then after producing a reply memorizes both the user turn and the assistant reply. Tool execution is isolated in a Sandbox.

The store itself is an implementation detail: the cloud uses Postgres + pgvector, the on-device SDK uses the embedded store. The contract lives in context.

The LLM is accessed through ModelClient; a deterministic StubModel is the default so the runtime is runnable without an API key. Enable the openai feature to use the real OpenAI Responses/Chat API.

Modules§

context
Context memory contract shared by every runtime tier.

Structs§

Agent
The unified agent. Holds the model client, context store and sandbox.
AgentConfig
Configuration for constructing an Agent. Serializable for SDK/Ffi.
ModelRequest
A single model request.
ModelResponse
A single model response.
ModelTurn
A model reply that may request one or more tool calls (agentic loop).
StubModel
Deterministic stand-in used when no API key / openai feature is present.
Tool
A tool the agent may invoke during an agentic turn.
ToolCall
A request from the model to invoke a tool.
ToolResult
The outcome of executing a tool, fed back to the model.

Enums§

AgentEvent
Events emitted by Agent::run_event_stream so callers can render a live agentic turn: phase boundaries, tool calls (with their results), streamed tokens, and the terminal Done.
CoreError

Traits§

ModelClient
LLM access seam. Implement this to plug in any backend.

Functions§

default_sandbox_box
Re-export the default sandbox constructor for callers that don’t need config.
in_memory_context
Convenience: an in-process context store for quick local use.