Expand description
Engine construction and top-level execution APIs.
Engine is the runtime boundary for a group of agents, tools, model
providers, storage backends, hooks, and remote engines. It is responsible for:
- validating callers and request metadata;
- creating scoped
AgentCtxandBaseCtxvalues; - dispatching local agent runs and direct tool calls;
- exporting selected agents and tools to other engines;
- signing challenge responses when Web3 or TEE clients are configured.
Engines are created with EngineBuilder. A built engine is private by
default; configure Management to expose it to additional callers.
§Usage
- Start from
Engine::builder. - Register models, tools, agents, hooks, storage, and remote engines.
- Select the default agent with
EngineBuilder::build. - Execute agents with
Engine::agent_runor direct tools withEngine::tool_call.
§Example
ⓘ
use anda_core::AgentInput;
use anda_engine::{
ANONYMOUS,
engine::{AgentInfo, EchoEngineInfo, Engine},
};
use std::sync::Arc;
let echo_info = AgentInfo {
handle: "echo".to_string(),
name: "Echo Agent".to_string(),
description: "Returns engine metadata as JSON.".to_string(),
..Default::default()
};
let engine = Engine::builder()
.register_agent(Arc::new(EchoEngineInfo::new(echo_info)), None)?
.build("echo".to_string())
.await?;
let output = engine
.agent_run(
ANONYMOUS,
AgentInput::new("echo".to_string(), "hello".to_string()),
)
.await?;Re-exports§
pub use crate::context::EngineCard;pub use crate::context::RemoteEngineArgs;pub use crate::context::RemoteEngines;
Structs§
- Agent
Info - Contains descriptive and operational information about an AI agent.
- Echo
Engine Info - Simple built-in agent that returns its configured
AgentInfoas JSON. - Engine
- Top-level runtime for a configured set of Anda agents and tools.
- Engine
Builder - Builder for assembling an
Engine. - Engine
Ref - EngineRef is a helper struct that allows for late binding of an Engine instance.