pub struct SubAgentHandle {
pub id: String,
/* private fields */
}Expand description
SubAgent 句柄
用于控制和查询 SubAgent 的状态。
Fields§
§id: StringSubAgent ID
Implementations§
Source§impl SubAgentHandle
impl SubAgentHandle
Sourcepub fn state(&self) -> SubAgentState
pub fn state(&self) -> SubAgentState
获取当前状态
注意:此方法使用非阻塞读取。如果状态锁当前被持有,返回 Initializing 状态。
在异步上下文中,建议使用 state_async() 以获得准确的状态。
Sourcepub async fn state_async(&self) -> SubAgentState
pub async fn state_async(&self) -> SubAgentState
异步获取当前状态
Sourcepub async fn activity(&self) -> SubAgentActivity
pub async fn activity(&self) -> SubAgentActivity
获取当前活动
Sourcepub fn config(&self) -> &SubAgentConfig
pub fn config(&self) -> &SubAgentConfig
获取配置
Sourcepub fn created_at(&self) -> u64
pub fn created_at(&self) -> u64
获取创建时间
Sourcepub async fn send_control(&self, signal: ControlSignal) -> Result<()>
pub async fn send_control(&self, signal: ControlSignal) -> Result<()>
发送控制信号
Sourcepub async fn adjust_params(
&self,
max_steps: Option<usize>,
timeout_ms: Option<u64>,
) -> Result<()>
pub async fn adjust_params( &self, max_steps: Option<usize>, timeout_ms: Option<u64>, ) -> Result<()>
调整参数
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
是否正在运行
Sourcepub fn events(&self) -> SubAgentEventStream
pub fn events(&self) -> SubAgentEventStream
Subscribe to events for this SubAgent.
Returns a filtered event stream that only includes events for this SubAgent.
Trait Implementations§
Source§impl Clone for SubAgentHandle
impl Clone for SubAgentHandle
Source§fn clone(&self) -> SubAgentHandle
fn clone(&self) -> SubAgentHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SubAgentHandle
impl !RefUnwindSafe for SubAgentHandle
impl Send for SubAgentHandle
impl Sync for SubAgentHandle
impl Unpin for SubAgentHandle
impl UnsafeUnpin for SubAgentHandle
impl !UnwindSafe for SubAgentHandle
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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