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
63
64
65
66
67
68
69
//! Agent module - Core AI agent logic and conversation handling
//!
//! This module provides the core agent loop and context building functionality
//! for ZeptoClaw. The agent is responsible for:
//!
//! - Processing inbound messages from channels
//! - Building conversation context with system prompts and history
//! - Calling LLM providers for responses
//! - Executing tool calls and feeding results back to the LLM
//! - Managing conversation sessions
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
//! │ MessageBus │────>│ AgentLoop │────>│ LLMProvider │
//! │ (inbound) │ │ │ │ (Claude) │
//! └─────────────┘ └─────────────┘ └─────────────┘
//! │ │
//! │ │
//! ▼ ▼
//! ┌─────────────┐ ┌─────────────┐
//! │ Session │ │ Tools │
//! │ Manager │ │ Registry │
//! └─────────────┘ └─────────────┘
//! ```
//!
//! # Example
//!
//! ```rust,ignore
//! use std::sync::Arc;
//! use zeptoclaw::agent::AgentLoop;
//! use zeptoclaw::bus::MessageBus;
//! use zeptoclaw::config::Config;
//! use zeptoclaw::session::SessionManager;
//! use zeptoclaw::providers::ClaudeProvider;
//! use zeptoclaw::tools::EchoTool;
//!
//! async fn run_agent() {
//! let config = Config::default();
//! let session_manager = SessionManager::new_memory();
//! let bus = Arc::new(MessageBus::new());
//! let agent = AgentLoop::new(config, session_manager, bus);
//!
//! // Configure provider
//! let provider = ClaudeProvider::new("your-api-key");
//! agent.set_provider(Box::new(provider)).await;
//!
//! // Register tools
//! agent.register_tool(Box::new(EchoTool)).await;
//!
//! // Start the agent loop
//! agent.start().await.unwrap();
//! }
//! ```
pub use TokenBudget;
pub use ;
pub use ;
pub use r#loopAgentLoop;
pub use r#loop::;
pub use SwarmScratchpad;