ceylon_next/
lib.rs

1//! # Ceylon - AI Agent Framework
2//!
3//! Ceylon is a powerful and flexible framework for building AI agents with goal-oriented capabilities,
4//! memory management, and tool integration.
5//!
6//! ## Features
7//!
8//! - **Goal-Oriented Agents**: Agents that can analyze tasks, break them into sub-goals, and track progress
9//! - **Memory Management**: Built-in conversation history and context management
10//! - **Tool Integration**: Extensible tool system for adding custom capabilities
11//! - **Multiple LLM Support**: Works with OpenAI, Anthropic, Ollama, and other LLM providers
12//! - **Async-First**: Built on Tokio for efficient async/await support
13//!
14//! ## Quick Start
15//!
16//! ```rust,no_run
17//! use ceylon::agent::Agent;
18//! use ceylon::tasks::TaskRequest;
19//!
20//! #[tokio::main]
21//! async fn main() {
22//!     // Create a new agent
23//!     let mut agent = Agent::new("MyAssistant", "openai::gpt-4");
24//!
25//!     // Create a task
26//!     let task = TaskRequest::new("What is the capital of France?");
27//!
28//!     // Run the agent
29//!     let response = agent.run(task).await;
30//!     println!("Response: {:?}", response.result());
31//! }
32//! ```
33//!
34//! ## Working with Tools
35//!
36//! ```rust,no_run
37//! use ceylon::agent::Agent;
38//! use ceylon::tools::ToolTrait;
39//! use serde_json::json;
40//!
41//! // Define a custom tool
42//! struct CalculatorTool;
43//!
44//! impl ToolTrait for CalculatorTool {
45//!     fn name(&self) -> String {
46//!         "calculator".to_string()
47//!     }
48//!
49//!     fn description(&self) -> String {
50//!         "Performs basic arithmetic operations".to_string()
51//!     }
52//!
53//!     fn input_schema(&self) -> serde_json::Value {
54//!         json!({
55//!             "type": "object",
56//!             "properties": {
57//!                 "operation": {"type": "string"},
58//!                 "a": {"type": "number"},
59//!                 "b": {"type": "number"}
60//!             }
61//!         })
62//!     }
63//!
64//!     fn execute(&self, input: serde_json::Value) -> serde_json::Value {
65//!         // Implementation details...
66//!         json!({"result": 42})
67//!     }
68//! }
69//!
70//! #[tokio::main]
71//! async fn main() {
72//!     let mut agent = Agent::new("Calculator Agent", "openai::gpt-4");
73//!     agent.add_tool(CalculatorTool);
74//!     // Now the agent can use the calculator tool
75//! }
76//! ```
77//!
78//! ## Working with Memory
79//!
80//! ```rust,no_run
81//! use ceylon::agent::Agent;
82//! use ceylon::tasks::TaskRequest;
83//!
84//! #[tokio::main]
85//! async fn main() {
86//!     let mut agent = Agent::new("MemoryAgent", "openai::gpt-4");
87//!
88//!     // First conversation
89//!     let task1 = TaskRequest::new("My name is Alice");
90//!     agent.run(task1).await;
91//!
92//!     // Second conversation - agent remembers context
93//!     let task2 = TaskRequest::new("What is my name?");
94//!     let response = agent.run(task2).await;
95//!     // Agent should respond with "Alice"
96//!
97//!     // Search memory
98//!     let memories = agent.search_memory("Alice").await;
99//!     println!("Found {} relevant conversations", memories.len());
100//! }
101//! ```
102//!
103//! ## Working with Goals
104//!
105//! ```rust,no_run
106//! use ceylon::agent::{Agent, AgentConfig};
107//! use ceylon::tasks::TaskRequest;
108//!
109//! #[tokio::main]
110//! async fn main() {
111//!     let mut agent = Agent::new("GoalAgent", "openai::gpt-4");
112//!
113//!     // Enable goal analysis (enabled by default)
114//!     let mut config = AgentConfig::default();
115//!     config.with_goal_analysis(true);
116//!     agent.with_config(config);
117//!
118//!     // The agent will automatically analyze and break down complex tasks
119//!     let task = TaskRequest::new("Create a web server with user authentication");
120//!     let response = agent.run(task).await;
121//!
122//!     // Check the goal that was created
123//!     if let Some(goal) = agent.get_current_goal() {
124//!         println!("{}", goal.get_summary());
125//!     }
126//! }
127//! ```
128
129pub mod agent;
130pub mod llm;
131mod types;
132pub mod tasks;
133pub mod tools;
134pub mod memory;
135pub mod goal;
136pub mod runner;