Skip to main content

agent_air/
lib.rs

1//! Agent Air
2//!
3//! A Rust Framework for building TUI Agents powered by large language models.
4//!
5//! Homepage: <https://agent-air.ai>
6//!
7//! This is a meta-crate that re-exports from:
8//! - `agent-air-runtime` - Core runtime (always included)
9//! - `agent-air-tui` - TUI frontend (optional, enabled by default)
10//!
11//! ## Features
12//!
13//! - `tui` (default) - Include the TUI frontend
14//!
15//! ## Quick Start (with TUI)
16//!
17//! ```ignore
18//! use agent_air::agent::{AgentConfig, AgentAir};
19//! use agent_air::tui::AgentAirExt;
20//!
21//! struct MyConfig;
22//! impl AgentConfig for MyConfig {
23//!     fn config_path(&self) -> &str { ".myagent/config.yaml" }
24//!     fn default_system_prompt(&self) -> &str { "You are helpful." }
25//!     fn log_prefix(&self) -> &str { "myagent" }
26//!     fn name(&self) -> &str { "MyAgent" }
27//! }
28//!
29//! fn main() -> std::io::Result<()> {
30//!     let agent = AgentAir::new(&MyConfig)?;
31//!     agent.into_tui().run()
32//! }
33//! ```
34//!
35//! ## Headless Usage (without TUI)
36//!
37//! ```ignore
38//! use agent_air::agent::{AgentConfig, AgentAir};
39//!
40//! struct MyConfig;
41//! impl AgentConfig for MyConfig {
42//!     fn config_path(&self) -> &str { ".myagent/config.yaml" }
43//!     fn default_system_prompt(&self) -> &str { "You are helpful." }
44//!     fn log_prefix(&self) -> &str { "myagent" }
45//!     fn name(&self) -> &str { "MyAgent" }
46//! }
47//!
48//! fn main() -> std::io::Result<()> {
49//!     let mut core = AgentAir::new(&MyConfig)?;
50//!     core.start_background_tasks();
51//!
52//!     // Get channels for custom frontend integration
53//!     let tx = core.to_controller_tx();
54//!     let rx = core.take_from_controller_rx();
55//!
56//!     // Create a session and interact programmatically
57//!     let (session_id, model, _) = core.create_initial_session()?;
58//!     // ... implement your own event loop
59//!
60//!     core.shutdown();
61//!     Ok(())
62//! }
63//! ```
64
65// Re-export everything from the runtime crate
66pub use agent_air_runtime::*;
67
68// Re-export the TUI crate when the feature is enabled
69#[cfg(feature = "tui")]
70pub mod tui {
71    //! TUI frontend for agent-air.
72    //!
73    //! This module provides a ratatui-based terminal interface for agents.
74    //! Use `AgentAirExt::into_tui()` to convert an `AgentAir` into a `TuiRunner`.
75
76    pub use agent_air_tui::*;
77}