Skip to main content

AgentPool

Struct AgentPool 

Source
pub struct AgentPool { /* private fields */ }
Expand description

Holds agent pool application-layer state or configuration. Use it with the documented coordinator methods; run, journal, event, provider, or port effects are called out on those methods rather than on construction.

Implementations§

Source§

impl AgentPool

Source

pub fn builder(pool_id: AgentPoolId) -> AgentPoolBuilder

Starts a builder for this application::agent_pool value. Building is data-only; runtime side effects occur only when a later coordinator or host port executes the built configuration.

Source

pub fn pool_id(&self) -> &AgentPoolId

Returns the pool id currently held by this value. This is a data-only accessor and does not change membership or wake state.

Source

pub fn start_run(&self, request: RunRequest) -> Result<RunHandle, AgentError>

Starts a run through the shared runtime and joins it to this pool. Runtime registration and provider-loop effects stay in AgentRuntime; the pool side effect is membership tracking for coordination.

Source

pub fn join_run(&self, member: AgentPoolMember) -> Result<(), AgentError>

Join run. This records pool membership in the coordinator so later pool messages and subscriptions can target the run.

Source

pub fn members(&self) -> Result<Vec<AgentPoolMember>, AgentError>

Returns the members currently held by this value. This reads current pool membership without starting, stopping, or messaging runs.

Source

pub fn leave_run(&self, run_id: &RunId) -> Result<AgentPoolMember, AgentError>

Records that a run has left the pool. This removes membership from the shared store, appends a lifecycle record, and publishes a pool event. It does not cancel or otherwise mutate the run itself.

Source

pub fn send(&self, message: RunMessage) -> Result<MessageReceipt, AgentError>

Sends a run message through the pool coordinator. This resolves the addressed members, applies pool message policy, appends accepted and terminal delivery records to the source run journal, publishes the matching agent-pool events, and deduplicates repeated calls by idempotency key.

Source

pub fn record_message_status( &self, message: &RunMessage, status: MessageStatus, delivered_to: Vec<RunId>, ) -> Result<MessageReceipt, AgentError>

Records one run-message status transition. This appends the status record to the source run journal, publishes the matching agent-pool event on the runtime event bus, and returns a receipt carrying the journal cursor. Use AgentPool::send for the full accept-to-terminal delivery flow.

Source

pub fn subscribe( &self, filter: EventFilter, cursor: Option<EventCursor>, ) -> Result<AgentEventStream, AgentError>

Subscribe. This creates a read-only subscription scoped by pool membership and the supplied filter.

Source

pub fn compile_scoped_filter( &self, filter: EventFilter, ) -> Result<CompiledEventFilter, AgentError>

Computes or returns compile scoped filter for the application::agent_pool contract without external I/O or side effects.

Source

pub fn scope_filter(&self, filter: EventFilter) -> EventFilter

Returns scope filter derived from the supplied state. This operates on the named coordinator state or selected port; it does not create a parallel runtime path.

Source

pub fn suspend_until( &self, run_id: RunId, condition: WakeCondition, ) -> Result<WakeRegistration, AgentError>

Registers a wake condition for a pool member run. This mutates the pool’s wake registry and dedupe index, scopes the event filter to current members, and may poll the configured event subscription port to trigger immediately.

Source

pub fn poll_wake( &self, condition_id: &WakeConditionId, ) -> Result<WakeRegistration, AgentError>

Polls a registered wake condition for a matching event. This reads and may update pool wake state through record_wake_status; it creates a read-only event subscription but does not cancel or advance the target run.

Source

pub fn cancel_wake( &self, condition_id: &WakeConditionId, ) -> Result<WakeRegistration, AgentError>

Cancel wake. This marks a registered wake condition as cancelled in pool state; it does not cancel the run itself.

Source

pub fn snapshot(&self) -> Result<AgentPoolSnapshot, AgentError>

Rehydrates the current durable pool snapshot from the configured store. This returns only pool-backed membership, message, wake, policy, and cursor state; it does not subscribe to the global event bus or synthesize missing records.

Source

pub fn watch_pool( &self, cursor: Option<AgentPoolStoreCursor>, ) -> Result<AgentPoolStoreStream, AgentError>

Watches durable pool-store changes after the supplied cursor. This is a pool-scoped coordination-record stream, not a global event bus.

Trait Implementations§

Source§

impl Clone for AgentPool

Source§

fn clone(&self) -> AgentPool

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.