Skip to main content

agent_core_runtime/agent/
mod.rs

1//! Agent Infrastructure
2//!
3//! Core infrastructure for building LLM-powered agents.
4//!
5//! This module provides:
6//! - AgentCore - Complete working agent infrastructure
7//! - Message types for Frontend-Controller communication
8//! - Input routing between Frontend and controller
9//! - Logging infrastructure
10//! - Configuration management with trait-based customization
11//!
12//! # Quick Start (Headless)
13//!
14//! ```ignore
15//! use agent_core_runtime::agent::{AgentConfig, AgentCore};
16//!
17//! struct MyConfig;
18//! impl AgentConfig for MyConfig {
19//!     fn config_path(&self) -> &str { ".myagent/config.yaml" }
20//!     fn default_system_prompt(&self) -> &str { "You are helpful." }
21//!     fn log_prefix(&self) -> &str { "myagent" }
22//!     fn name(&self) -> &str { "MyAgent" }
23//! }
24//!
25//! fn main() -> std::io::Result<()> {
26//!     let mut core = AgentCore::new(&MyConfig)?;
27//!     core.start_background_tasks();
28//!
29//!     // Get channels for custom frontend integration
30//!     let tx = core.to_controller_tx();
31//!     let rx = core.take_from_controller_rx();
32//!
33//!     // Create a session and interact programmatically
34//!     let (session_id, model, _) = core.create_initial_session()?;
35//!     // ... implement your own event loop
36//!
37//!     core.shutdown();
38//!     Ok(())
39//! }
40//! ```
41
42mod config;
43mod core;
44mod environment;
45mod error;
46mod logger;
47mod messages;
48mod providers;
49mod router;
50
51pub use config::{load_config, AgentConfig, ConfigError, ConfigFile, LLMRegistry, ProviderConfig};
52pub use environment::EnvironmentContext;
53pub use providers::{get_provider_info, is_known_provider, list_providers, ProviderInfo};
54pub use error::AgentError;
55pub use core::{
56    convert_controller_event_to_ui_message, AgentCore, FromControllerRx, FromControllerTx,
57    ToControllerRx, ToControllerTx,
58};
59pub use logger::Logger;
60pub use messages::channels::{create_channels, DEFAULT_CHANNEL_SIZE};
61pub use messages::UiMessage;
62pub use router::InputRouter;
63
64// Re-export common types from llm-controller-rs that agents typically need
65pub use crate::controller::{
66    ControllerEvent, ControllerInputPayload, LLMController, LLMSessionConfig, PermissionRegistry,
67    ToolResultStatus, TurnId, UserInteractionRegistry,
68};