Expand description
Agent<I, T, Ms, Ml, Sk> and the per-turn pipeline.
The agent holds an InferenceClient (an abstraction over a
ModelRunner from atomr-infer); strategies are generic so the
hot path is monomorphized. BoxedAgent (object-erased form)
and AgentRef (Arc-wrapped handle) provide config-driven
instantiation; see AgentSpec::into_agent.
Modules§
- providers
- Provider runtime back-ends, gated by per-provider features.
Wrap any of these
Runnertypes inLocalRunnerClientto use them as anInferenceClient.
Structs§
- Agent
- Generic agent. Strategy types are monomorphized for the hot
path; a
BoxedAgentform (usingBox<dyn>for each slot) is produced fromAgentSpec. - Agent
Budgets - Agent
Ref - Public, type-erased handle to an agent. Implements
Callable, so an agent can be passed wherever any executable unit is expected (workflow steps, team routing targets). - Agent
Spec - Static, serializable description of an agent. Used by the
registry and Python config;
AgentSpec::into_agentmaterializes a runnableAgentRef. Strategies and inference client are passed in (typically constructed from a registry lookup keyed off the spec’sid/model). - Boxed
Agent - Fully-erased agent. Mirrors the field shape of
crate::Agentbut stores each strategy as a trait object so callers without the concrete strategy types can still construct a runnable agent. - Budget
- A budget cap at a scope.
- Budget
Exceeded - Signalled when a budget is exceeded; a
TerminationStrategymaps this to a clean run termination. - Cost
Estimate - A pre-flight cost estimate.
- Cost
Meter - Estimates and records inference spend.
- Decision
Key - Business attribution for spend. Carried on
CallCtxas a typed extension:ctx.insert_ext(DecisionKey::new(...)). - Local
Runner Client - Wrap any
ModelRunner(includingMockRunner) as anInferenceClient. Single-runner concurrency is bounded by the internal mutex; production setups should use theEngineCoreActorfromatomr-infer-runtimeinstead. - Logging
Middleware - Middleware
Stack - Convenience container — registered middlewares + helpers to run them.
- Model
Pin - A first-class pin on
(provider, model, version, params). - Model
Pricing - Per-model pricing in micro-USD per 1000 tokens (avoids float drift).
- Pinned
Client InferenceClientmiddleware enforcing aModelPin.- Pricing
- Pricing table keyed by model id.
- Rate
Limit Middleware - Redaction
Middleware - Replay
Provider - An
InferenceClientthat returns recorded completions in order. - Resolved
Model - What a provider actually resolves to at call time.
- Spend
- A realized spend after a call.
- Spend
Ledger - Accumulates spend for cost-vs-alpha analysis and budget checks.
- Static
Resolver - A static resolver (tests / known-version deployments).
- Tool
Error Recovery Middleware - Turn
Result
Enums§
- Budget
Scope - Scope a budget applies to.
- Cap
- A spend cap.
- Drift
Kind - Kind of drift detected.
- Model
PinViolation - Pin violation: strict mode with no pin, or (optionally) a hard refusal on drift.
- Provider
- Replay
Error - Errors raised on the replay path. Replay fails loudly rather than re-inferring.
Traits§
- Agent
Middleware - Inference
Client - Implemented by anything the agent can use to drive an inference request. The provider matters for tool-call delta parsing.
- Model
Resolver - Resolves the concrete model/version a client would use right now. Hosts implement this (often by querying the provider) so a deployed pin can be re-validated on a heartbeat to catch provider-side silent upgrades.
Functions§
- detect_
drift - Compare a resolved model to a pin;
Noneif they match. - record_
turn - Capture a live
TurnResultas anInferenceRecordfor later replay.params_hash/prompt_hashare supplied by the caller (they derive from the request, which the pipeline holds). - turn_
from_ record - Reconstruct a
TurnResultfrom a recordedInferenceRecord.