Expand description
Agent infrastructure and configuration. Agent Infrastructure
Core infrastructure for building LLM-powered agents.
This module provides:
- AgentCore - Complete working agent infrastructure
- Message types for Frontend-Controller communication
- Input routing between Frontend and controller
- Logging infrastructure
- Configuration management with trait-based customization
§Quick Start (Headless)
ⓘ
use agent_core_runtime::agent::{AgentConfig, AgentCore};
struct MyConfig;
impl AgentConfig for MyConfig {
fn config_path(&self) -> &str { ".myagent/config.yaml" }
fn default_system_prompt(&self) -> &str { "You are helpful." }
fn log_prefix(&self) -> &str { "myagent" }
fn name(&self) -> &str { "MyAgent" }
}
fn main() -> std::io::Result<()> {
let mut core = AgentCore::new(&MyConfig)?;
core.start_background_tasks();
// Get channels for custom frontend integration
let tx = core.to_controller_tx();
let rx = core.take_from_controller_rx();
// Create a session and interact programmatically
let (session_id, model, _) = core.create_initial_session()?;
// ... implement your own event loop
core.shutdown();
Ok(())
}Re-exports§
pub use crate::controller::ControllerEvent;pub use crate::controller::ControllerInputPayload;pub use crate::controller::LLMController;pub use crate::controller::LLMSessionConfig;pub use crate::controller::PermissionRegistry;pub use crate::controller::ToolResultStatus;pub use crate::controller::TurnId;pub use crate::controller::UserInteractionRegistry;
Structs§
- Agent
Core - AgentCore - Core runtime infrastructure for LLM-powered agents.
- Config
File - Root configuration structure from YAML
- Environment
Context - Environment context information.
- Input
Router - Routes messages from the TUI to the controller.
- LLMRegistry
- LLM Registry - stores loaded provider configurations
- Logger
- Tracing-based logger that writes to daily log files.
- Provider
Config - Provider configuration from YAML
- Provider
Info - Information about a known OpenAI-compatible provider.
Enums§
- Agent
Error - Error type for agent operations.
- Config
Error - Configuration errors
- UiMessage
- Messages sent from the controller to the TUI for display
Constants§
- DEFAULT_
CHANNEL_ SIZE - Default channel buffer size for internal communication. This applies to all async channels: LLM responses, tool results, UI events, etc. Can be overridden via AgentConfig::channel_buffer_size().
Traits§
- Agent
Config - Trait for agent-specific configuration.
Functions§
- convert_
controller_ event_ to_ ui_ message - Converts a ControllerEvent to a UiMessage for the frontend.
- create_
channels - Creates a pair of channels for TUI-Controller communication
- get_
provider_ info - Returns provider info for a known provider name.
- is_
known_ provider - Returns true if this is a known OpenAI-compatible provider.
- list_
providers - Returns a list of all known provider names.
- load_
config - Load config for an agent using its AgentConfig trait implementation.
Type Aliases§
- From
Controller Rx - Receiver for messages from controller to frontend
- From
Controller Tx - Sender for messages from controller to frontend
- ToController
Rx - Receiver for messages from frontend to controller
- ToController
Tx - Sender for messages from frontend to controller