Skip to main content

AgentRequest

Struct AgentRequest 

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

Schema-bound input and request-local budget constraints for one agent run.

A request deliberately contains no tenant, run, thread, or invocation ID; those trusted identifiers are assigned by run admission. budget_limits is another restrictive layer and can never widen system, tenant, policy, or immutable agent limits. Input JSON is structurally bounded here, while a trusted local schema registry performs digest-pinned schema evaluation.

Implementations§

Source§

impl AgentRequest

Source

pub const fn new( input_schema: SchemaReference, input: BoundedJson, budget_limits: BudgetLimits, ) -> Self

Constructs an intrinsically bounded agent request.

Source

pub const fn input_schema(&self) -> &SchemaReference

Returns the exact input schema identity.

Source

pub const fn input(&self) -> &BoundedJson

Returns the bounded input without permitting mutation.

Source

pub const fn budget_limits(&self) -> &BudgetLimits

Returns the optional request-local budget layer.

Source

pub fn into_parts(self) -> (SchemaReference, BoundedJson, BudgetLimits)

Consumes this request into schema, input, and budget components.

Source

pub fn resolve_for( &self, descriptor: &AgentDescriptor, base_budget_layers: &[BudgetLimits], observed_at: Timestamp, ) -> Result<ResolvedBudget, AgentRequestValidationError>

Validates a new invocation and resolves its complete finite budget.

base_budget_layers contains only the already selected system, tenant, and policy layers. This method appends the immutable agent layer and this request layer, evaluates the supplied durable clock observation, and checks the materialized input against the resulting byte ceiling. Deprecated agents remain invocable; retired agents remain readable for recovery but cannot be admitted as new work.

Digest-pinned JSON Schema evaluation remains a separate trusted-registry operation and must complete before the returned budget is committed.

§Errors

Returns AgentRequestValidationError for retirement, schema substitution, excessive layer count, incomplete/invalid budget resolution, an already expired deadline, or oversized input.

Source

pub fn validate_with_resolved_budget( &self, descriptor: &AgentDescriptor, budget: &ResolvedBudget, ) -> Result<(), AgentRequestValidationError>

Revalidates schema identity and input bytes against a trusted budget.

This is intended for recovery after the exact resolved budget was durably snapshotted by Self::resolve_for. It intentionally permits a now-retired descriptor because retirement cannot invalidate old runs.

§Errors

Returns AgentRequestValidationError for schema substitution or input beyond the snapshotted budget ceiling.

Trait Implementations§

Source§

impl Clone for AgentRequest

Source§

fn clone(&self) -> Self

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 Debug for AgentRequest

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AgentRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for AgentRequest

Source§

impl JsonSchema for AgentRequest

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for AgentRequest

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for AgentRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AgentRequest

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.