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 TUI-Controller communication
- Input routing between TUI and controller
- Logging infrastructure
- Configuration management with trait-based customization
§Quick Start
ⓘ
use agent_core::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();
// Wire up your TUI and run
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 - A complete, working agent infrastructure.
- Config
File - Root configuration structure from YAML
- 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
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
Traits§
- Agent
Config - Trait for agent-specific configuration.
Functions§
- convert_
controller_ event_ to_ ui_ message - Converts a ControllerEvent to a UiMessage for the TUI.
- create_
channels - Creates a pair of channels for TUI-Controller communication
- load_
config - Load config for an agent using its AgentConfig trait implementation.
Type Aliases§
- From
Controller Rx - Receiver for messages from controller to TUI
- From
Controller Tx - Sender for messages from controller to TUI
- ToController
Rx - Receiver for messages from TUI to controller
- ToController
Tx - Sender for messages from TUI to controller