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
impl AgentRuntime
Sourcepub fn builder() -> AgentRuntimeBuilder
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.
Sourcepub fn start_run(&self, request: RunRequest) -> Result<RunHandle, AgentError>
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.
Sourcepub fn run_text(&self, request: RunRequest) -> Result<RunResult, AgentError>
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.
Sourcepub fn run_typed<T: TypedOutputModel>(
&self,
request: RunRequest,
) -> Result<RunResult, AgentError>
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.
Sourcepub fn resolve_effective_package(
&self,
request: &RunRequest,
) -> Result<EffectiveRuntimePackage, AgentError>
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.
Sourcepub fn cancel_run(&self, run_id: &RunId) -> Result<(), AgentError>
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.
Sourcepub fn run_snapshot(&self, run_id: &RunId) -> Result<RunSnapshot, AgentError>
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.
Sourcepub fn registered_run_count(&self) -> Result<usize, AgentError>
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.
Sourcepub fn events(&self) -> Result<Arc<dyn AgentEventBus>, AgentError>
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.
Sourcepub fn subscribe_all(
&self,
cursor: Option<EventCursor>,
) -> Result<AgentEventStream, AgentError>
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.
Sourcepub fn subscribe_run(
&self,
run_id: RunId,
cursor: Option<EventCursor>,
) -> Result<AgentEventStream, AgentError>
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.
Sourcepub fn subscribe_agent(
&self,
agent_id: AgentId,
cursor: Option<EventCursor>,
) -> Result<AgentEventStream, AgentError>
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.
Sourcepub fn subscribe_events(
&self,
filter: CompiledEventFilter,
cursor: Option<EventCursor>,
) -> Result<AgentEventStream, AgentError>
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.
Sourcepub fn provider_registry(&self) -> &ProviderRegistry
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.
Sourcepub fn output_sinks(&self) -> &OutputSinkRegistry
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
impl Clone for AgentRuntime
Source§fn clone(&self) -> AgentRuntime
fn clone(&self) -> AgentRuntime
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more