pub struct AgentBuilder { /* private fields */ }Expand description
智能体构建器 - 提供流式 API
Implementations§
Source§impl AgentBuilder
impl AgentBuilder
Sourcepub fn new(agent_id: &str, name: &str) -> AgentBuilder
pub fn new(agent_id: &str, name: &str) -> AgentBuilder
创建新的 AgentBuilder
Sourcepub fn with_capability(self, capability: &str) -> AgentBuilder
pub fn with_capability(self, capability: &str) -> AgentBuilder
添加能力
Sourcepub fn with_capabilities(self, capabilities: Vec<&str>) -> AgentBuilder
pub fn with_capabilities(self, capabilities: Vec<&str>) -> AgentBuilder
添加多个能力
Sourcepub fn with_dependency(self, dependency: &str) -> AgentBuilder
pub fn with_dependency(self, dependency: &str) -> AgentBuilder
添加依赖
Sourcepub fn with_plugin(self, plugin: Box<dyn AgentPlugin>) -> AgentBuilder
pub fn with_plugin(self, plugin: Box<dyn AgentPlugin>) -> AgentBuilder
添加插件
Sourcepub fn with_input(self, input: &str) -> AgentBuilder
pub fn with_input(self, input: &str) -> AgentBuilder
添加输入端口
Sourcepub fn with_output(self, output: &str) -> AgentBuilder
pub fn with_output(self, output: &str) -> AgentBuilder
添加输出端口
Sourcepub fn with_max_concurrent_tasks(self, max: usize) -> AgentBuilder
pub fn with_max_concurrent_tasks(self, max: usize) -> AgentBuilder
设置最大并发任务数
Sourcepub fn with_timeout(self, timeout: Duration) -> AgentBuilder
pub fn with_timeout(self, timeout: Duration) -> AgentBuilder
设置默认超时
Sourcepub fn with_config(self, key: &str, value: &str) -> AgentBuilder
pub fn with_config(self, key: &str, value: &str) -> AgentBuilder
添加自定义配置
Sourcepub fn build_config(&self) -> AgentConfig
pub fn build_config(&self) -> AgentConfig
构建智能体配置
Sourcepub fn build_metadata(&self) -> AgentMetadata
pub fn build_metadata(&self) -> AgentMetadata
构建元数据
Sourcepub async fn with_agent<A>(
self,
agent: A,
) -> Result<SimpleAgentRuntime<A>, Error>where
A: MoFAAgent,
pub async fn with_agent<A>(
self,
agent: A,
) -> Result<SimpleAgentRuntime<A>, Error>where
A: MoFAAgent,
使用提供的 MoFAAgent 实现构建简单运行时(非 dora 模式)
Sourcepub async fn build_and_start<A>(
self,
agent: A,
) -> Result<SimpleAgentRuntime<A>, Error>where
A: MoFAAgent,
pub async fn build_and_start<A>(
self,
agent: A,
) -> Result<SimpleAgentRuntime<A>, Error>where
A: MoFAAgent,
构建并启动智能体(非 dora 模式)
Auto Trait Implementations§
impl Freeze for AgentBuilder
impl !RefUnwindSafe for AgentBuilder
impl Send for AgentBuilder
impl Sync for AgentBuilder
impl Unpin for AgentBuilder
impl UnsafeUnpin for AgentBuilder
impl !UnwindSafe for AgentBuilder
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 moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage