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
impl AgentRequest
Sourcepub const fn new(
input_schema: SchemaReference,
input: BoundedJson,
budget_limits: BudgetLimits,
) -> Self
pub const fn new( input_schema: SchemaReference, input: BoundedJson, budget_limits: BudgetLimits, ) -> Self
Constructs an intrinsically bounded agent request.
Sourcepub const fn input_schema(&self) -> &SchemaReference
pub const fn input_schema(&self) -> &SchemaReference
Returns the exact input schema identity.
Sourcepub const fn input(&self) -> &BoundedJson
pub const fn input(&self) -> &BoundedJson
Returns the bounded input without permitting mutation.
Sourcepub const fn budget_limits(&self) -> &BudgetLimits
pub const fn budget_limits(&self) -> &BudgetLimits
Returns the optional request-local budget layer.
Sourcepub fn into_parts(self) -> (SchemaReference, BoundedJson, BudgetLimits)
pub fn into_parts(self) -> (SchemaReference, BoundedJson, BudgetLimits)
Consumes this request into schema, input, and budget components.
Sourcepub fn resolve_for(
&self,
descriptor: &AgentDescriptor,
base_budget_layers: &[BudgetLimits],
observed_at: Timestamp,
) -> Result<ResolvedBudget, AgentRequestValidationError>
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.
Sourcepub fn validate_with_resolved_budget(
&self,
descriptor: &AgentDescriptor,
budget: &ResolvedBudget,
) -> Result<(), AgentRequestValidationError>
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
impl Clone for AgentRequest
Source§impl Debug for AgentRequest
impl Debug for AgentRequest
Source§impl<'de> Deserialize<'de> for AgentRequest
impl<'de> Deserialize<'de> for AgentRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for AgentRequest
Source§impl JsonSchema for AgentRequest
impl JsonSchema for AgentRequest
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more