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
59
60
61
62
//! Dragen - CodeAct-style agent framework
//!
//! Dragen provides a simple framework for building AI agents that execute
//! Python code in a secure sandbox. It uses the CodeAct pattern where the
//! LLM writes Python code to accomplish tasks, with tools exposed as
//! Python functions.
//!
//! # Quick Start
//!
//! ```ignore
//! use dragen::{Agent, AgentConfig};
//! use littrs::tool;
//!
//! /// Get the current weather for a city.
//! ///
//! /// Args:
//! /// city: The city name
//! #[tool]
//! fn get_weather(city: String) -> String {
//! format!("Weather in {}: Sunny, 22°C", city)
//! }
//!
//! #[tokio::main]
//! async fn main() {
//! let mut agent = Agent::new(AgentConfig::new("gpt-4o"));
//! agent.register(get_weather::Tool);
//!
//! let result = agent.run("What's the weather in Paris?").await.unwrap();
//! println!("{}", result);
//! }
//! ```
//!
//! # Sharing Data Between Agents
//!
//! Use `Context` to pass data between agents without manual Arc/Mutex management:
//!
//! ```ignore
//! use dragen::{Agent, AgentConfig, Context};
//!
//! let ctx = Context::new();
//!
//! // Planner writes output to context
//! let mut planner = Agent::new(AgentConfig::new("gpt-4o"))
//! .to_context(&ctx, "plan");
//! planner.run::<PlanOutput>(&query).await?;
//!
//! // Executor reads from context (injected into prompt)
//! let mut executor = Agent::new(AgentConfig::new("gpt-4o"))
//! .from_context(&ctx, "plan");
//! executor.run::<String>("Execute the plan").await?;
//! ```
pub use ;
pub use Context;
pub use ;
// Re-export littrs for convenience
pub use littrs;