pub struct SimpleRuntime { /* private fields */ }Expand description
简单运行时 - 管理多个智能体的协同运行(非 dora 版本)
Implementations§
Source§impl SimpleRuntime
impl SimpleRuntime
Sourcepub async fn register_agent(
&self,
metadata: AgentMetadata,
config: AgentConfig,
role: &str,
) -> Result<Receiver<AgentEvent>>
pub async fn register_agent( &self, metadata: AgentMetadata, config: AgentConfig, role: &str, ) -> Result<Receiver<AgentEvent>>
注册智能体
Sourcepub fn message_bus(&self) -> &Arc<SimpleMessageBus>
pub fn message_bus(&self) -> &Arc<SimpleMessageBus>
获取消息总线
Sourcepub async fn get_agents_by_role(&self, role: &str) -> Vec<String>
pub async fn get_agents_by_role(&self, role: &str) -> Vec<String>
获取指定角色的智能体列表
Sourcepub async fn send_to_agent(
&self,
target_id: &str,
event: AgentEvent,
) -> Result<()>
pub async fn send_to_agent( &self, target_id: &str, event: AgentEvent, ) -> Result<()>
发送消息给指定智能体
Sourcepub async fn broadcast(&self, event: AgentEvent) -> Result<()>
pub async fn broadcast(&self, event: AgentEvent) -> Result<()>
广播消息给所有智能体
Sourcepub async fn publish_to_topic(
&self,
topic: &str,
event: AgentEvent,
) -> Result<()>
pub async fn publish_to_topic( &self, topic: &str, event: AgentEvent, ) -> Result<()>
发布到主题
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SimpleRuntime
impl !RefUnwindSafe for SimpleRuntime
impl Send for SimpleRuntime
impl Sync for SimpleRuntime
impl Unpin for SimpleRuntime
impl UnsafeUnpin for SimpleRuntime
impl !UnwindSafe for SimpleRuntime
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