Expand description
The awaken facade crate — the primary entry point for building AI agents.
This crate re-exports everything you need from the underlying awaken-* crates
so that user code only needs a single dependency. Start with prelude for a
one-import convenience layer, or access individual modules directly.
§Quick start
ⓘ
use awaken::prelude::*;
use awaken::engine::GenaiExecutor;
let runtime = AgentRuntimeBuilder::new()
.with_agent_spec(AgentSpec::new("assistant").with_model_id("gpt-4o-mini"))
.with_provider("openai", Arc::new(GenaiExecutor::new()))
.with_model_binding("gpt-4o-mini", ModelBinding {
provider_id: "openai".into(),
upstream_model: "gpt-4o-mini".into(),
})
.build()?;
let request = RunRequest::new("thread-1", vec![Message::user("Hello")])
.with_agent_id("assistant");
let result = runtime.run_to_completion(request).await?;
let response = result.response;§Module layout
| Path | Description |
|---|---|
prelude | One-stop import for common agent-building types |
contract | Core protocol traits: tools, inference, events, lifecycle |
model | Data-model primitives: phases, effects, scheduled actions |
state | State key/value types and mutation primitives |
registry | Agent registry and resolution |
builder | AgentRuntimeBuilder — fluent runtime construction |
plugins | Plugin trait and descriptor types |
phase | Phase execution context and hooks |
engine | Low-level agent execution engine |
stores | Storage backend implementations |
server | HTTP server layer (feature server) |
Re-exports§
pub use awaken_stores as stores;pub use awaken_ext_generative_ui as ext_generative_ui;pub use awaken_ext_mcp as ext_mcp;pub use awaken_ext_observability as ext_observability;pub use awaken_ext_permission as ext_permission;pub use awaken_ext_reminder as ext_reminder;pub use awaken_ext_skills as ext_skills;pub use awaken_server as server;
Modules§
- agent
- Agent configuration and instance types.
- builder
- Fluent builder for constructing an
AgentRuntime. Fluent builder API for constructingAgentRuntime. - context
- Execution context and request/response wrappers. Context management: compaction, summarization, truncation, and plugin state.
- contract
- Core protocol traits: tools, inference, events, lifecycle, storage contracts.
- engine
- Low-level agent execution engine. Engine layer: genai-backed LLM executor and type conversion.
- execution
- Execution-environment helpers and run orchestration. Tool execution concerns: executors.
- extensions
- Extension-point traits for integrating with the runtime. Bundled extensions for the awaken runtime.
- loop_
runner - Agent run-loop runner. Minimal sequential agent loop driven by state machines.
- model
- Data-model primitives: phases, effects, scheduled actions.
- phase
- Phase execution context, hooks, and phase-level runtime.
- plugins
- Plugin loading, descriptor registry, and registration API.
- policies
- Stop policies and run-termination conditions. Stop condition policy system and built-in policies.
- prelude
- One-import convenience module for awaken.
- registry
- Agent registry lookup and resolution. Registry traits, in-memory implementations, and agent resolution.
- registry_
spec - Agent-registry specification types. Serializable agent definition — pure data, no trait objects.
- runtime
AgentRuntimeandRunRequest— the top-level run API.- state
- Combined state types from both the contract and runtime layers.
Structs§
- Agent
Runtime - Top-level agent runtime. Manages runs across threads.
- Agent
Runtime Builder - Fluent API for constructing an
AgentRuntime. - Agent
Spec - Serializable agent definition referencing registries by ID.
- Agent
Spec Patch - Patch for built-in agent customization.
- Cancellation
Token - A cooperative cancellation token.
- Commit
Event - Config
Record - Wrapper carrying a spec plus provenance + lifecycle metadata.
- Execution
Env - Per-run execution environment.
- Failed
Scheduled Actions - Mock
Provider Profile - Explicit mock provider wiring for tests and local development.
- Mutation
Batch - A batch of state mutation operations.
- NoConfig
Patch - Empty patch for spec types that do not support field-level overrides.
- Pending
Scheduled Actions - Persisted
State - Phase
Context - Execution context passed to phase hooks and action handlers.
- Phase
Runtime - Plugin
Descriptor - Plugin
Registrar - Provider
Removal Impact - Provider
Removal Preview - Record
Meta - Provenance + lifecycle metadata for a stored spec.
- Redacted
String - String wrapper whose
Debug/Displayimplementations never reveal the underlying value, and whose buffer is zeroized on drop. - Registry
Resource Ref - Registry
Validation Error - Resolved
Agent - A fully resolved agent: all capabilities + plugin environment, ready to run.
- RunRequest
- Unified request for starting or resuming a run.
- Runtime
Registry Update - Serializable
Registry Diagnostic - Snapshot
- State
Command - A command that carries state mutations, scheduled actions, and effects.
- State
KeyOptions - State
Map - State
Store - Typed
Effect
Enums§
- Build
Error - Error returned when the builder cannot construct the runtime.
- Config
Record Error - Error returned while decoding a
ConfigRecordor applying its overrides. - Config
Validation Error - Json
Value - Represents any valid JSON value.
- KeyScope
- Lifetime scope for a state key.
- Merge
Strategy - Parallel merge strategy for a state key.
- Phase
- Lifecycle phase within an agent run.
- Provider
Removal Policy - Record
Source - Who wrote this record into ConfigStore.
- Registry
Diagnostic - Registry
Diagnostic Severity - Registry
Update Error - Runtime
Error - Runtime-specific errors that wrap
StateErrorand add variants for agent resolution and run management. - State
Error - Unknown
Field Policy - Unknown-field behavior for a serializable config surface.
- Unknown
KeyPolicy
Constants§
- AGENT_
SPEC_ PATCH_ UNKNOWN_ FIELD_ POLICY - AGENT_
SPEC_ UNKNOWN_ FIELD_ POLICY AgentSpecandAgentSpecPatchreject unknown fields.- DEFAULT_
MAX_ PHASE_ ROUNDS - MODEL_
BINDING_ SPEC_ UNKNOWN_ FIELD_ POLICY - PROVIDER_
SPEC_ UNKNOWN_ FIELD_ POLICY ProviderSpec’s serde implementation is intentionally lenient for read-time compatibility, but config write/validate surfaces reject unknown fields so operators do not persist silently ignored provider settings.
Traits§
- Agent
Resolver - Resolves an agent by ID, producing a ready-to-execute config + environment.
- Commit
Hook - Config
Record Merge - Spec types that can apply
RecordMeta::user_overridesat read time. - Effect
Spec - Phase
Hook - Plugin
- Plugin
Config Key - Typed plugin configuration key.
- Scheduled
Action Spec - State
Key - Tool
Gate Hook - Typed
Effect Handler - Typed
Scheduled Action Handler - Typed
Tool - A strongly-typed tool trait that derives its descriptor schema from
Args.
Functions§
- decode_
config_ record - Decode a value into
ConfigRecord<T>, accepting either an envelope or a legacy bare spec. This does not validateRecordMeta::user_overrides. - diagnose_
agent_ spec - diagnose_
registry_ set - diagnose_
registry_ set_ serializable - effective_
config_ record - Apply
RecordMeta::user_overridesto the record’s base spec. - effective_
visible_ config_ records - Decode visible records and return their effective specs.
- generate_
tool_ schema - Generate a JSON Schema for
Tthat is suitable for LLM tool calling. - merge_
agent_ spec - Apply a
AgentSpecPatchon top of a baseAgentSpec, producing the effective spec passed to the resolver. - preview_
provider_ removal - rebuild_
agent_ model_ provider_ registries - sanitize_
for_ llm - Sanitize a JSON Schema value in-place to be LLM-friendly.
- validate_
against_ schema - Validate
argsagainst a JSON Schema, returning an error with joined messages on failure. - validate_
agent_ spec - Validate and decode an
AgentSpec. - validate_
agent_ spec_ patch - Validate and decode an
AgentSpecPatch. - validate_
config_ record - Validate and decode a config record envelope, accepting legacy bare specs.
RecordMeta::user_overridesmust decode as the patch type forT. - validate_
config_ record_ overrides - Validate
RecordMeta::user_overridesfor an already decoded record. - validate_
model_ binding_ spec - Validate and decode a
ModelBindingSpecfor config write surfaces. - validate_
provider_ spec - Validate and decode a
ProviderSpecfor config write surfaces.