Skip to main content

lmm_agent/
lib.rs

1// Copyright 2026 Mahmoud Harmouch.
2//
3// Licensed under the MIT license
4// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
5// option. This file may not be copied, modified, or distributed
6// except according to those terms.
7
8//! # `lmm-agent` - equation-based autonomous agent framework.
9//!
10//! This crate lets you compose, build, and run autonomous agents that reason
11//! through the `lmm` equation engine and optionally enrich their knowledge via
12//! DuckDuckGo (no LLM provider required).
13//!
14//! ## Quick Start
15//!
16//! ```rust
17//! use lmm_agent::prelude::*;
18//!
19//! #[derive(Debug, Default, Auto)]
20//! pub struct MyAgent {
21//!     persona: Cow<'static, str>,
22//!     behavior:  Cow<'static, str>,
23//!     status:    Status,
24//!     agent:     LmmAgent,
25//!     memory:    Vec<Message>,
26//! }
27//!
28//! #[async_trait]
29//! impl Executor for MyAgent {
30//!     async fn execute<'a>(
31//!         &'a mut self, tasks: &'a mut Task,
32//!         execute: bool, browse: bool, max_tries: u64,
33//!     ) -> Result<()> {
34//!         let prompt = self.agent.persona().to_string();
35//!         let response = self.generate(&prompt).await?;
36//!         self.agent.add_message(Message {
37//!             role:    "assistant".into(),
38//!             content: response.into(),
39//!         });
40//!         Ok(())
41//!     }
42//! }
43//!
44//! #[tokio::main]
45//! async fn main() {
46//!     let agent = MyAgent {
47//!         persona: "Research Agent".into(),
48//!         behavior: "Research Rust async patterns.".into(),
49//!         agent: LmmAgent::new("Research Agent".into(), "Research Rust async patterns.".into()),
50//!         ..Default::default()
51//!     };
52//!
53//!     AutoAgent::default()
54//!         .with(agents![agent])
55//!         .build()
56//!         .unwrap()
57//!         .run()
58//!         .await
59//!         .unwrap();
60//! }
61//! ```
62
63pub mod agent;
64pub mod cognition;
65pub mod error;
66pub mod prelude;
67pub mod runtime;
68pub mod traits;
69pub mod types;