1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Agent module — core abstractions for building AI agents.
//!
//! This module implements a **Runner-driven, managed-agent** architecture that
//! combines the best ideas from `OpenAI` Agents SDK and `HuggingFace` smolagents:
//!
//! - **[`Agent`]** is a self-contained unit with its own LLM provider, enabling
//! heterogeneous multi-agent systems where each agent uses a different model.
//! - **[`Runner`]** is a stateless execution engine that drives the agent through
//! a ReAct-style reasoning loop (think → act → observe → repeat).
//! - **Managed agents** are sub-agents registered via [`Agent::managed_agent`],
//! dispatched inline by the Runner as parallel tool calls — inspired by smolagents.
//!
//! # Quick Start
//!
//! ```rust
//! use machi::agent::{Agent, RunConfig};
//!
//! let agent = Agent::new("assistant")
//! .instructions("You are a helpful assistant.")
//! .model("gpt-4o");
//!
//! assert_eq!(agent.name(), "assistant");
//! assert_eq!(agent.get_model(), "gpt-4o");
//! ```
//!
//! # Heterogeneous Multi-Agent
//!
//! ```rust
//! use machi::agent::Agent;
//!
//! let researcher = Agent::new("researcher")
//! .instructions("You research topics thoroughly.")
//! .model("gpt-4o");
//!
//! let writer = Agent::new("writer")
//! .instructions("You write clear summaries.")
//! .model("claude-sonnet");
//!
//! let orchestrator = Agent::new("orchestrator")
//! .instructions("Delegate research and writing tasks to your team.")
//! .model("gpt-4o")
//! .managed_agent(researcher)
//! .managed_agent(writer);
//!
//! assert_eq!(orchestrator.name(), "orchestrator");
//! ```
pub use ;
pub use AgentError;
pub use ;
pub use Runner;