Expand description
Astrid Runtime - Agent orchestration and session management.
This crate provides:
- Agent runtime with LLM, MCP, and security integration
- Session management with persistence
- Context management with auto-summarization
§Architecture
The runtime coordinates:
- LLM provider for language model interactions
- MCP client for tool execution
- Capability store for authorization
- Audit log for security logging
§Example
use astrid_runtime::{AgentRuntime, RuntimeConfig, SessionStore};
use astrid_llm::{ClaudeProvider, ProviderConfig};
use astrid_mcp::McpClient;
use astrid_audit::AuditLog;
use astrid_crypto::KeyPair;
// Create components
let llm = ClaudeProvider::new(ProviderConfig::new("api-key", "claude-sonnet-4-20250514"));
let mcp = McpClient::from_default_config()?;
let audit_key = KeyPair::generate();
let runtime_key = KeyPair::generate();
let audit = AuditLog::in_memory(audit_key);
let home = astrid_core::dirs::AstridHome::resolve()?;
let sessions = SessionStore::from_home(&home);
// Create runtime
let runtime = AgentRuntime::new(
llm,
mcp,
audit,
sessions,
runtime_key,
RuntimeConfig::default(),
);
// Create a session
let mut session = runtime.create_session(None);
// Run a turn (would need a Frontend implementation)
// runtime.run_turn_streaming(&mut session, "Hello!", &frontend).await?;Re-exports§
pub use subagent::SubAgentHandle;pub use subagent::SubAgentId;pub use subagent::SubAgentPool;pub use subagent::SubAgentPoolStats;pub use subagent::SubAgentStatus;pub use subagent_executor::SubAgentExecutor;pub use astrid_workspace;pub use astrid_tools;
Modules§
- config_
bridge - Bridge from
astrid_config::Configto domain types. - prelude
- Prelude module - commonly used types for convenient import.
- subagent
- Subagent pool management.
- subagent_
executor - Sub-agent executor — implements
SubAgentSpawnerusing the runtime’s agentic loop.
Structs§
- Agent
Runtime - The main agent runtime.
- Agent
Session - An agent session.
- Context
Manager - Context manager for handling context overflow.
- Context
Stats - Context statistics.
- GitState
- Git repository state snapshot.
- Runtime
Config - Configuration for the agent runtime.
- Serializable
Session - Serializable session state (for persistence).
- Session
Metadata - Session metadata.
- Session
Store - Session store for persistence.
- Session
Summary - Summary of a session for listing.
- Summarization
Result - Result of a summarization operation.
- Tool
Context - Shared context available to all built-in tools.
- Tool
Registry - Registry of built-in tools for lookup and LLM definition export.
- Workspace
Boundary - Workspace boundary checker.
- Workspace
Config - Workspace configuration.
Enums§
- Runtime
Error - Errors that can occur in the runtime.
- Workspace
Mode - Operating mode for the workspace.
Functions§
- build_
system_ prompt - Build the complete system prompt for an agent session.
Type Aliases§
- Runtime
Result - Result type for runtime operations.