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
impl AgentPool
Sourcepub fn builder(pool_id: AgentPoolId) -> AgentPoolBuilder
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.
Sourcepub fn pool_id(&self) -> &AgentPoolId
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.
Sourcepub fn start_run(&self, request: RunRequest) -> Result<RunHandle, AgentError>
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.
Sourcepub fn join_run(&self, member: AgentPoolMember) -> Result<(), AgentError>
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.
Sourcepub fn members(&self) -> Result<Vec<AgentPoolMember>, AgentError>
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.
Sourcepub fn leave_run(&self, run_id: &RunId) -> Result<AgentPoolMember, AgentError>
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.
Sourcepub fn send(&self, message: RunMessage) -> Result<MessageReceipt, AgentError>
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.
Sourcepub fn record_message_status(
&self,
message: &RunMessage,
status: MessageStatus,
delivered_to: Vec<RunId>,
) -> Result<MessageReceipt, AgentError>
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.
Sourcepub fn subscribe(
&self,
filter: EventFilter,
cursor: Option<EventCursor>,
) -> Result<AgentEventStream, AgentError>
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.
Sourcepub fn compile_scoped_filter(
&self,
filter: EventFilter,
) -> Result<CompiledEventFilter, AgentError>
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.
Sourcepub fn scope_filter(&self, filter: EventFilter) -> EventFilter
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.
Sourcepub fn suspend_until(
&self,
run_id: RunId,
condition: WakeCondition,
) -> Result<WakeRegistration, AgentError>
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.
Sourcepub fn poll_wake(
&self,
condition_id: &WakeConditionId,
) -> Result<WakeRegistration, AgentError>
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.
Sourcepub fn cancel_wake(
&self,
condition_id: &WakeConditionId,
) -> Result<WakeRegistration, AgentError>
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.
Sourcepub fn snapshot(&self) -> Result<AgentPoolSnapshot, AgentError>
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.
Sourcepub fn watch_pool(
&self,
cursor: Option<AgentPoolStoreCursor>,
) -> Result<AgentPoolStoreStream, AgentError>
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.