Awaken

June 8, 2026 · View on GitHub

English | 中文

CI crates.io awaken crates.io awaken-agent Changelog License MSRV

Build agent capability in Rust. Tune prompts, models, permissions, skills, and eval loops live. Serve AI SDK, AG-UI, A2A, MCP, and ACP clients from one runtime without turning each agent into a fragile script.

Docs: Awaken docs · 中文文档 · Changelog. MSRV: Rust 1.93. The published crate is awaken; awaken-agent is a compatibility republish from when the project shipped under that name.

Awaken admin console — connect Gemini, build an agent with the AI assistant, then test it live in the sandbox
Real Gemini in the Admin Console: connect a model, describe an agent, tune it, and run a live eval.

30-second version

Start the local server and Admin Console:

AWAKEN_HTTP_ADDR=127.0.0.1:38080 \
AWAKEN_ADMIN_API_BEARER_TOKEN=dev-token \
AWAKEN_STORAGE_DIR=./target/awaken-dev \
cargo run -p ai-sdk-starter-agent

pnpm --filter awaken-admin-console dev

Open http://127.0.0.1:3002, paste dev-token, configure a provider-backed model, then create or tune an agent. Without an API key, the starter backend uses a deterministic scripted executor so you can verify the server routes and console first.

The tune-first loop is:

Validate draft -> Preview chat -> Save snapshot -> Run task -> Inspect trace -> Capture dataset/eval -> Adjust

Why Awaken

  • Code stays stable. Tools, typed state, providers, stores, and plugins live in Rust.
  • Behavior tunes live. Prompts, model bindings, tool descriptions, permission rules, reminders, skills, delegates, and plugin sections change through managed config.
  • One backend serves many clients. AI SDK v6, AG-UI / CopilotKit, A2A, MCP, and ACP are adapters over the same runtime event stream and run model.
  • Runs are operational objects. Durable dispatch, HITL mailbox suspension, cancellation, trace capture, replay, datasets, eval runs, and audit restore are runtime/server contracts.
  • State and tools are typed. StateKey, generated JSON Schema for TypedTool, pure tool gating, and atomic commits make concurrent tool work auditable.

Tune-first workflow

Awaken treats agent behavior as managed resources, not scattered code edits. Server config writes are validated, published as registry snapshots, and auditable when stores are wired.

Tune onlineManaged by Awaken
Prompts, model bindings, reasoning effort, stop policiesValidate, preview, save, publish next-run registry snapshots
Tool descriptions, allow/exclude rules, permission gates, remindersTyped schemas, policy validation, HITL suspension/resume
Providers, models, model pools, MCP servers, skillsCapability metadata, provider checks, failover pools, catalogs
Traces, datasets, eval runs, audit historyReplayable records, baseline diffs, restorable config revisions

Tools are written once and stay stable. Models, agents, prompts, skills, delegates, and policy sections are tuned through /v1/config/* or the Admin Console — Validate → Save → preview-chat → adjust.

Choose your mode

Awaken separates the agent execution loop from the service control plane.

ModeStart withYou ownAwaken provides
Runtime libraryawaken / awaken-runtimeHTTP/UI/job scheduling, auth, config storage, concrete tools/providers/storesDirect run APIs, streaming events, typed tools/state, cancellation, tool gating, HITL primitives
Server control planeawaken-server + awaken-storesDeployment, tenant/auth policy, registered tools/providers, store selectionHTTP/SSE, AI SDK/AG-UI/A2A/MCP/ACP adapters, mailbox orchestration, /v1/config/*, registry snapshots, Admin Console

Runtime mode is in-process library use inside a standard async Rust program. It is not a no_std or Tokio-free embedded target. Server mode wraps the same runtime with protocols, durable dispatch, managed config, audit/restore, trace/eval storage, and the browser workflow.

Quickstart A: server + Admin Console

Use this path when you want the tuning workflow first.

AWAKEN_HTTP_ADDR=127.0.0.1:38080 \
AWAKEN_ADMIN_API_BEARER_TOKEN=dev-token \
AWAKEN_STORAGE_DIR=./target/awaken-dev \
cargo run -p ai-sdk-starter-agent

pnpm install
pnpm --filter awaken-admin-console dev

Open http://127.0.0.1:3002, click the token pill, and paste dev-token. Configure a provider/model, create an agent, preview it, then copy the AI SDK or AG-UI route from the saved agent page.

Useful docs:

Quickstart B: runtime library

Use this path when your Rust application owns the I/O boundary and calls the runtime directly.

Prerequisites: Rust 1.93+ and an OpenAI-compatible API key.

[dependencies]
awaken = { git = "https://github.com/AwakenWorks/awaken" }
tokio = { version = "1", features = ["full"] }
async-trait = "0.1"
serde_json = "1"

These snippets follow the current main-branch API. Use the 0.5 to 0.6 migration guide when upgrading from the published 0.5 line.

export OPENAI_API_KEY=<your-key>

src/main.rs:

use awaken::engine::GenaiExecutor;
use awaken::prelude::*;
use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;

struct EchoTool;

#[async_trait]
impl Tool for EchoTool {
    fn descriptor(&self) -> ToolDescriptor {
        ToolDescriptor::new("echo", "Echo", "Echo input back to the caller").with_parameters(json!({
            "type": "object",
            "properties": { "text": { "type": "string" } },
            "required": ["text"]
        }))
    }

    async fn execute(&self, args: JsonValue, _ctx: &ToolCallContext) -> Result<ToolOutput, ToolError> {
        let text = args["text"].as_str().unwrap_or_default();
        Ok(ToolResult::success("echo", json!({ "echoed": text })).into())
    }
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let runtime = AgentRuntimeBuilder::new()
        .with_agent_spec(
            AgentSpec::new("assistant")
                .with_model_id("gpt-4o-mini")
                .with_system_prompt("You are helpful. Use the echo tool when asked.")
                .with_max_rounds(5),
        )
        .with_tool("echo", Arc::new(EchoTool))
        .with_provider("openai", Arc::new(GenaiExecutor::new()))
        .with_model(ModelSpec::new("gpt-4o-mini", "openai", "gpt-4o-mini"))
        .build()?;

    let request = RunActivation::new("thread-1", vec![Message::user("Say hello using the echo tool")])
        .with_agent_id("assistant");

    let result = runtime.run_to_completion(request).await?;
    println!("{}", result.response);
    Ok(())
}

Use runtime.run(request, sink) instead of run_to_completion when you need to stream events to SSE, WebSocket, protocol adapters, or tests. For a longer example, see crates/awaken/examples/multi_turn.rs.

The quickstart path is covered without network access:

cargo test -p awaken --test readme_quickstart        # offline scripted provider
OPENAI_API_KEY=<key> cargo test -p awaken --test readme_live_provider -- --ignored  # live provider

Protocols

ProtocolRoute / transportTypical client
AI SDK v6POST /v1/ai-sdk/chatReact useChat()
AG-UIPOST /v1/ag-ui/runCopilotKit <CopilotKit>
A2APOST /v1/a2a/message:sendOther agents
MCPPOST /v1/mcpJSON-RPC 2.0 clients
ACPstdio via serve_stdioAgent Client Protocol hosts

Frontend guides: AI SDK · CopilotKit / AG-UI · HTTP SSE.

Extensions

The facade full feature pulls in the plugins below. Use default-features = false to opt out. awaken-ext-deferred-tools is a companion crate and is added as a direct dependency.

ExtensionWhat it doesFeature / crate
PermissionAllow/Deny/Ask rules on tool name and arguments; Ask suspends via mailbox for HITL.permission
ReminderInjects context messages when a tool call matches a configured pattern.reminder
ObservabilityOpenTelemetry traces and metrics aligned with GenAI Semantic Conventions.observability
MCPConnects to external MCP servers and registers their tools as native Awaken tools.mcp
SkillsDiscovers skill packages and injects a catalog before inference.skills
Generative UIStreams declarative UI components via A2UI, JSON Render, and OpenUI Lang.generative-ui
Deferred ToolsHides large tool schemas behind ToolSearch and re-defers idle tools.awaken-ext-deferred-tools

Write your own with ToolGateHook or BeforeToolExecute — same trait signatures the built-ins use.

Architecture

Awaken demo — managed agent run with tool calls, approval, and trace

awaken                   Facade crate with feature flags
├─ awaken-runtime-contract Runtime contracts: specs, tools, events, state, commit coordinator
├─ awaken-server-contract  Server/store contracts: queries, scoped stores, mailbox/outbox, staged commits
├─ awaken-runtime        Resolver, phase engine, loop runner, runtime control
├─ awaken-server         HTTP routes, SSE replay, mailbox dispatch, protocol adapters
├─ awaken-stores         Thread + run + config + mailbox + profile stores
├─ awaken-tool-pattern   Glob/regex matching used by extensions
└─ awaken-ext-*          Optional extensions and companion plugins

For details, start with Architecture and Run Lifecycle and Phases.

When this fits

  • You want a Rust backend for AI agents with compile-time guarantees.
  • You need to serve AI SDK, CopilotKit, A2A, MCP, and/or ACP from a single backend.
  • Tools need to share state safely during concurrent execution, and runs need auditable history with checkpoints and resume.
  • Operators need to tune prompts, models, permissions, skills, traces, datasets, and evals without changing code.

When it does not

  • You need built-in file/shell/web tools out of the box — consider OpenAI Agents SDK, Dify, or CrewAI.
  • You want a visual workflow builder — consider Dify or LangGraph Studio.
  • You want Python and rapid prototyping — consider LangGraph, AG2, or PydanticAI.
  • You need an LLM-managed memory subsystem where the agent decides what to remember — consider Letta.

Examples and learning paths

GoalStart withThen
Build your first agentGet StartedBuild Agents
Tune a saved agentUse the Admin ConsoleConfigure Agent Behavior
See a full-stack appAI SDK starterCopilotKit starter
Explore the APIReference docscargo doc --workspace --no-deps --open
Understand the runtimeArchitectureRun Lifecycle and Phases

Examples:

ExampleWhat it shows
live_testBasic LLM integration
multi_turnMulti-turn with persistent threads
tool_call_liveTool calling with calculator
ai-sdk-starterReact + AI SDK v6 full-stack
copilotkit-starterNext.js + CopilotKit full-stack
openui-chatOpenUI Lang chat frontend
admin-consoleConfig API management UI

Contributing

Setup in CONTRIBUTING.md and DEVELOPMENT.md. Good first issues is the entry-point label. Conversation: GitHub Discussions.

Acknowledgement

The awaken crate name on crates.io was transferred from @brayniac, who maintained an earlier crate under the same name. Versions 0.10.3 of awaken on crates.io belong to that earlier project; this codebase resumes the line that previously shipped as awaken-agent 0.2.x and starts at 0.4.0 to skip past those versions. Thank you.

License

Dual-licensed under MIT or Apache-2.0.