pub trait AgentRuntimeTrait: Send + Sync {
// Required methods
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
) -> Pin<Box<dyn Future<Output = Layer2Result<AgentResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn run_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
callback: &'life2 dyn AgentLoopCallback,
) -> Pin<Box<dyn Future<Output = Layer2Result<AgentResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn run_stream_abortable<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
callback: &'life2 dyn AgentLoopCallback,
abort_flag: Arc<AtomicBool>,
) -> Pin<Box<dyn Future<Output = Layer2Result<AgentResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
) -> Pin<Box<dyn Future<Output = Layer2Result<SessionId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn pause<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn resume<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn status(&self, session_id: &SessionId) -> Layer2Result<AgentState>;
fn send_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn submit_tool_result<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
tool_call_id: &'life2 str,
result: ToolResult,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Agent 运行时接口
定义 Agent 执行的核心生命周期操作。
Required Methods§
Sourcefn run<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
) -> Pin<Box<dyn Future<Output = Layer2Result<AgentResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
) -> Pin<Box<dyn Future<Output = Layer2Result<AgentResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn run_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
callback: &'life2 dyn AgentLoopCallback,
) -> Pin<Box<dyn Future<Output = Layer2Result<AgentResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn run_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
callback: &'life2 dyn AgentLoopCallback,
) -> Pin<Box<dyn Future<Output = Layer2Result<AgentResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
流式启动 Agent 执行
Sourcefn run_stream_abortable<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
callback: &'life2 dyn AgentLoopCallback,
abort_flag: Arc<AtomicBool>,
) -> Pin<Box<dyn Future<Output = Layer2Result<AgentResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn run_stream_abortable<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
callback: &'life2 dyn AgentLoopCallback,
abort_flag: Arc<AtomicBool>,
) -> Pin<Box<dyn Future<Output = Layer2Result<AgentResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
流式启动 Agent 执行(支持中断)
Sourcefn start<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
) -> Pin<Box<dyn Future<Output = Layer2Result<SessionId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 str,
config: AgentConfig,
) -> Pin<Box<dyn Future<Output = Layer2Result<SessionId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn pause<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pause<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn resume<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resume<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn status(&self, session_id: &SessionId) -> Layer2Result<AgentState>
fn status(&self, session_id: &SessionId) -> Layer2Result<AgentState>
Sourcefn send_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn submit_tool_result<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
tool_call_id: &'life2 str,
result: ToolResult,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn submit_tool_result<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
tool_call_id: &'life2 str,
result: ToolResult,
) -> Pin<Box<dyn Future<Output = Layer2Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".