pub struct AgentWorld { /* private fields */ }Expand description
A running embedded world: agents spawn into it, events stream out of it.
Internally this is the same WorldHost the daemon serves - addressed
in-process over a channel instead of over the control socket.
Implementations§
Source§impl AgentWorld
impl AgentWorld
Sourcepub fn builder() -> AgentWorldBuilder
pub fn builder() -> AgentWorldBuilder
Start building a world.
Sourcepub async fn spawn(&self, spec: SpawnSpec) -> Result<RunId, EmbedError>
pub async fn spawn(&self, spec: SpawnSpec) -> Result<RunId, EmbedError>
Spawn an agent. Returns its RunId once the agent is live in the
world (blueprint loaded, stages resolved, seeds applied).
Sourcepub fn events(&self) -> EventStream
pub fn events(&self) -> EventStream
Subscribe to the world’s events, from this moment on.
Sourcepub async fn status(&self, id: &RunId) -> Option<AgentStatus>
pub async fn status(&self, id: &RunId) -> Option<AgentStatus>
A run’s current status, or None if the world doesn’t know it.
Sourcepub async fn send_message(&self, id: &RunId, content: &str) -> bool
pub async fn send_message(&self, id: &RunId, content: &str) -> bool
Deliver a message into a running agent’s inbox. false when the
world can no longer accept messages (shut down or shutting down).
Sourcepub async fn resume(&self, id: &RunId) -> bool
pub async fn resume(&self, id: &RunId) -> bool
Resume a paused run. false if there is no such live run.
Sourcepub async fn cancel(&self, id: &RunId) -> bool
pub async fn cancel(&self, id: &RunId) -> bool
Cancel a run. false if there is no such live run.
Sourcepub fn pending_inputs(&self) -> Vec<(RunId, InteractionRequest)>
pub fn pending_inputs(&self) -> Vec<(RunId, InteractionRequest)>
Every open question agents are waiting on, as (run, request). Each
also arrived as an Interaction event.
Sourcepub fn answer(&self, response: InteractionResponse) -> bool
pub fn answer(&self, response: InteractionResponse) -> bool
Answer an open question (matched by the response’s request_id).
false if no such request is open.
Auto Trait Implementations§
impl !RefUnwindSafe for AgentWorld
impl !UnwindSafe for AgentWorld
impl Freeze for AgentWorld
impl Send for AgentWorld
impl Sync for AgentWorld
impl Unpin for AgentWorld
impl UnsafeUnpin for AgentWorld
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.