pub struct SimpleAgentRuntime<A: MoFAAgent> { /* private fields */ }Expand description
简单智能体运行时 - 不依赖 dora-rs 的轻量级运行时
Implementations§
Source§impl<A: MoFAAgent> SimpleAgentRuntime<A>
impl<A: MoFAAgent> SimpleAgentRuntime<A>
Sourcepub fn metadata(&self) -> &AgentMetadata
pub fn metadata(&self) -> &AgentMetadata
获取元数据
Sourcepub fn config(&self) -> &AgentConfig
pub fn config(&self) -> &AgentConfig
获取配置
Sourcepub fn interrupt(&self) -> &AgentInterrupt
pub fn interrupt(&self) -> &AgentInterrupt
获取中断句柄
Sourcepub fn max_concurrent_tasks(&self) -> usize
pub fn max_concurrent_tasks(&self) -> usize
获取最大并发任务数
Sourcepub fn default_timeout(&self) -> Duration
pub fn default_timeout(&self) -> Duration
获取默认超时时间
Sourcepub async fn init_plugins(&mut self) -> Result<()>
pub async fn init_plugins(&mut self) -> Result<()>
初始化插件
Sourcepub async fn handle_event(&mut self, event: AgentEvent) -> Result<()>
pub async fn handle_event(&mut self, event: AgentEvent) -> Result<()>
处理单个事件
Sourcepub async fn run_with_receiver(
&mut self,
event_rx: Receiver<AgentEvent>,
) -> Result<()>
pub async fn run_with_receiver( &mut self, event_rx: Receiver<AgentEvent>, ) -> Result<()>
运行事件循环(使用事件通道)
Sourcepub fn trigger_interrupt(&self)
pub fn trigger_interrupt(&self)
触发中断
Auto Trait Implementations§
impl<A> Freeze for SimpleAgentRuntime<A>where
A: Freeze,
impl<A> !RefUnwindSafe for SimpleAgentRuntime<A>
impl<A> Send for SimpleAgentRuntime<A>
impl<A> Sync for SimpleAgentRuntime<A>
impl<A> Unpin for SimpleAgentRuntime<A>where
A: Unpin,
impl<A> UnsafeUnpin for SimpleAgentRuntime<A>where
A: UnsafeUnpin,
impl<A> !UnwindSafe for SimpleAgentRuntime<A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more