Skip to main content

ai_agents_runtime/
lib.rs

1//! Runtime agent and builder for AI Agents framework
2
3mod builder;
4mod runtime;
5mod streaming;
6mod turn_context;
7
8pub mod orchestration;
9pub mod spawner;
10pub mod spec;
11
12pub use builder::AgentBuilder;
13pub use runtime::RuntimeAgent;
14pub use streaming::{StreamChunk, StreamingConfig};
15pub use turn_context::TurnActorContext;
16
17pub use ai_agents_core::{AgentInfo, AgentResponse, Result, ToolCall};
18
19use async_trait::async_trait;
20use serde::{Deserialize, Serialize};
21
22#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct ParallelToolsConfig {
24    #[serde(default = "default_parallel_enabled")]
25    pub enabled: bool,
26    #[serde(default = "default_max_parallel")]
27    pub max_parallel: usize,
28}
29
30fn default_parallel_enabled() -> bool {
31    true
32}
33
34fn default_max_parallel() -> usize {
35    5
36}
37
38impl Default for ParallelToolsConfig {
39    fn default() -> Self {
40        Self {
41            enabled: true,
42            max_parallel: 5,
43        }
44    }
45}
46
47#[async_trait]
48pub trait Agent: Send + Sync {
49    async fn chat(&self, input: &str) -> Result<AgentResponse>;
50    fn info(&self) -> AgentInfo;
51    async fn reset(&self) -> Result<()>;
52}