Skip to main content

AgentInvocationAccounting

Trait AgentInvocationAccounting 

Source
pub trait AgentInvocationAccounting:
    Send
    + Sync
    + 'static {
    // Required methods
    fn reference(&self) -> &AgentInvocationAccountingReference;
    fn model_charge(
        &self,
        invocation: &ModelInvocation,
    ) -> AgentInvocationCharge;
    fn tool_charge(&self, invocation: &ToolInvocation) -> AgentInvocationCharge;
}
Expand description

Offline, deterministic pricing boundary for durable model and tool ledgers.

Implementations must perform no I/O and must be deterministic for the exact terminal invocation snapshot. Their reference is part of the graph contract digest, so changing a price table requires a new graph version. Returning AgentInvocationCharge::Unpriced preserves the event in usage evidence and causes finite monetary budget evaluation to stop before another call.

Required Methods§

Source

fn reference(&self) -> &AgentInvocationAccountingReference

Returns the immutable implementation and price-table reference.

Source

fn model_charge(&self, invocation: &ModelInvocation) -> AgentInvocationCharge

Prices one committed or failed model attempt.

Source

fn tool_charge(&self, invocation: &ToolInvocation) -> AgentInvocationCharge

Prices one committed or failed tool attempt.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§