Expand description
Agent Core
A Rust Framework for building TUI Agents powered by large language models.
This is a meta-crate that re-exports from:
agent-core-runtime- Core runtime (always included)agent-core-tui- TUI frontend (optional, enabled by default)
§Features
tui(default) - Include the TUI frontend
§Quick Start (with TUI)
ⓘ
use agent_core::agent::{AgentConfig, AgentCore};
use agent_core::tui::AgentCoreExt;
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 agent = AgentCore::new(&MyConfig)?;
agent.into_tui().run()
}§Headless Usage (without TUI)
ⓘ
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();
// 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(())
}Modules§
- agent
- Agent infrastructure and configuration. Agent Infrastructure
- client
- LLM client interface and provider implementations. LLM client with provider-agnostic interface.
- controller
- LLM session controller and tool execution. LLM session controller and tool execution framework.
- permissions
- Permission system for controlling agent access to resources. Permission system for controlling agent access to resources.
- skills
- Agent Skills support for extended capabilities. Agent Skills support for extended agent capabilities.
- tui
- TUI frontend for agent-core.