Skip to main content

agent_base/
lib.rs

1pub mod engine;
2pub mod llm;
3pub mod tool;
4pub mod types;
5
6// ---------------------------------------------------------------------------
7// Prelude — most commonly used types for `use agent_base::prelude::*`
8// ---------------------------------------------------------------------------
9pub mod prelude {
10    pub use crate::engine::{
11        AgentBuilder, AgentRuntime, AgentSession, AllowAllApprovalHandler,
12        DenyAllApprovalHandler,
13    };
14    pub use crate::llm::{
15        AnthropicClient, LlmClient, LlmClientBuilder, OpenAiClient,
16    };
17    pub use crate::tool::{
18        AutoContinueTool, SubAgentTool, Tool, ToolContext, ToolOutput,
19        ToolPolicy, ToolRegistry, TypedTool,
20    };
21    pub use crate::types::{
22        AgentConfig, AgentError, AgentResult, ChatMessage, Language,
23        Message, MessageRole, RunOutcome, RuntimeEvent, SessionId, UserEvent,
24    };
25}
26
27// ---------------------------------------------------------------------------
28// Agent Runtime
29// ---------------------------------------------------------------------------
30pub use engine::{
31    AgentBuilder,
32    AgentRuntime,
33    AgentSession,
34    CircuitBreaker,
35    CircuitState,
36    DefaultPipeline,
37    InMemorySessionStore,
38    SessionId,
39    SessionStore,
40    ToolExecutionPipeline,
41};
42
43// ---------------------------------------------------------------------------
44// LLM Provider
45// ---------------------------------------------------------------------------
46pub use llm::{
47    AnthropicClient,
48    LlmCapabilities,
49    LlmClient,
50    LlmClientBuilder,
51    LlmProvider,
52    OpenAiClient,
53    ReasoningConfig,
54    ReasoningEffort,
55    StreamChunk,
56    UsageInfo,
57};
58
59// ---------------------------------------------------------------------------
60// Approval
61// ---------------------------------------------------------------------------
62pub use engine::{
63    AllowAllApprovalHandler,
64    ApprovalDecision,
65    ApprovalHandler,
66    ApprovalRequest,
67    ConsecutiveFailureRecovery,
68    DenyAllApprovalHandler,
69    Middleware,
70    PostLlmCtx,
71    PreLlmCtx,
72    UserMessageCtx,
73    ContextWindowManager,
74    RiskLevel,
75    RetryOnError,
76    StopOnError,
77    ToolEnforcementConfig,
78    ToolEnforcementMiddleware,
79    ToolErrorAction,
80    ToolErrorRecovery,
81    TurnFactMiddleware,
82    TurnToolLimitMiddleware,
83};
84
85// ---------------------------------------------------------------------------
86// Tools
87// ---------------------------------------------------------------------------
88pub use tool::{
89    AutoContinueTool,
90    SubAgentSessionPolicy,
91    SubAgentTool,
92    Tool,
93    ToolContext,
94    ToolControlFlow,
95    ToolOutput,
96    ToolPolicy,
97    ToolRegistry,
98    TypedTool,
99    UpdatePlanTool,
100};
101
102// ---------------------------------------------------------------------------
103// Events
104// ---------------------------------------------------------------------------
105pub use types::{RuntimeEvent, UserEvent};
106
107// ---------------------------------------------------------------------------
108// Errors
109// ---------------------------------------------------------------------------
110pub use types::{AgentError, AgentResult, ErrorKind};
111
112// ---------------------------------------------------------------------------
113// Types
114// ---------------------------------------------------------------------------
115pub use types::{
116    AgentConfig,
117    ChatMessage,
118    CheckpointData,
119    CheckpointStep,
120    ImageAttachment,
121    ImageDetail,
122    Language,
123    Message,
124    MessageRole,
125    PlanItem,
126    PlanStepStatus,
127    ResponseFormat,
128    RetryConfig,
129    RunOutcome,
130    SafetyConfig,
131    SessionConfig,
132    ToolCallMessage,
133    ToolResultData,
134    UpdatePlanArgs,
135};