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