Module agent

Module agent 

Source
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§

AgentCore
AgentCore - A complete, working agent infrastructure.
ConfigFile
Root configuration structure from YAML
InputRouter
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.
ProviderConfig
Provider configuration from YAML

Enums§

AgentError
Error type for agent operations.
ConfigError
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§

AgentConfig
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§

FromControllerRx
Receiver for messages from controller to TUI
FromControllerTx
Sender for messages from controller to TUI
ToControllerRx
Receiver for messages from TUI to controller
ToControllerTx
Sender for messages from TUI to controller