Skip to main content

AgentRuntime

Struct AgentRuntime 

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

Holds agent runtime 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 AgentRuntime

Source

pub fn builder() -> AgentRuntimeBuilder

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

Source

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

Registers a run with the runtime and returns a handle for control and subscription. This resolves package, provider, journal, event, content, and policy ports, evaluates start policy, mutates the run registry, and registers run control; it does not call the provider model.

Source

pub fn run_text(&self, request: RunRequest) -> Result<RunResult, AgentError>

Runs a P0 text request to completion through the configured runtime. This registers the run, calls the P0 loop driver, and may use provider, journal, content, event, validation, and policy ports selected by the resolved package.

Source

pub fn run_typed<T: TypedOutputModel>( &self, request: RunRequest, ) -> Result<RunResult, AgentError>

Runs a typed request by attaching the model’s output contract and using the same runtime path as run_text. Validation and repair side effects remain on the canonical P1 output pipeline; this helper does not create a parallel typed-output path.

Source

pub fn resolve_effective_package( &self, request: &RunRequest, ) -> Result<EffectiveRuntimePackage, AgentError>

Resolve effective package. This reads configured runtime package state, applies request-level tightening, and computes the package fingerprint; it does not call provider or tool executors.

Source

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

Cancel run. This marks the registered run as cancellation requested and forwards the request to run control; actual adapter cleanup happens in the owning control path.

Source

pub fn run_snapshot(&self, run_id: &RunId) -> Result<RunSnapshot, AgentError>

Returns run snapshot for callers that need to inspect the contract state. This reads the in-memory run registry and returns a snapshot without mutating run state.

Source

pub fn registered_run_count(&self) -> Result<usize, AgentError>

Returns registered run count for callers that need to inspect the contract state. This reads the in-memory run registry length without starting, cancelling, or replaying runs.

Source

pub fn events(&self) -> Result<Arc<dyn AgentEventBus>, AgentError>

Returns the configured event bus as a subscription source. This retrieves the port so callers can subscribe; it does not publish events or drive a run.

Source

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

Subscribe all. This delegates to the configured event bus to create a read-only stream for all visible events.

Source

pub fn subscribe_run( &self, run_id: RunId, cursor: Option<EventCursor>, ) -> Result<AgentEventStream, AgentError>

Subscribe run. This delegates to the configured event bus to create a read-only stream scoped to one run.

Source

pub fn subscribe_agent( &self, agent_id: AgentId, cursor: Option<EventCursor>, ) -> Result<AgentEventStream, AgentError>

Subscribe agent. This delegates to the event-bus subscription port to create a read-only stream for matching agent events.

Source

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

Subscribe events. This delegates to the event-bus subscription port to create a read-only filtered stream.

Source

pub fn provider_registry(&self) -> &ProviderRegistry

Returns provider registry for callers that need to inspect the contract state. This returns the configured provider registry reference; callers must still use policy-checked runtime paths to execute providers.

Source

pub fn output_sinks(&self) -> &OutputSinkRegistry

Returns the output sinks currently held by this value. This returns the configured sink registry; sending remains owned by output-delivery paths.

Trait Implementations§

Source§

impl Clone for AgentRuntime

Source§

fn clone(&self) -> AgentRuntime

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
Source§

impl Default for AgentRuntime

Source§

fn default() -> Self

Returns the “default value” for a type. 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.