Skip to main content

Crate atomr_agents_agent

Crate atomr_agents_agent 

Source
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 Runner types in LocalRunnerClient to use them as an InferenceClient.

Structs§

Agent
Generic agent. Strategy types are monomorphized for the hot path; a BoxedAgent form (using Box<dyn> for each slot) is produced from AgentSpec.
AgentBudgets
AgentRef
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).
AgentSpec
Static, serializable description of an agent. Used by the registry and Python config; AgentSpec::into_agent materializes a runnable AgentRef. Strategies and inference client are passed in (typically constructed from a registry lookup keyed off the spec’s id / model).
BoxedAgent
Fully-erased agent. Mirrors the field shape of crate::Agent but 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.
BudgetExceeded
Signalled when a budget is exceeded; a TerminationStrategy maps this to a clean run termination.
CostEstimate
A pre-flight cost estimate.
CostMeter
Estimates and records inference spend.
DecisionKey
Business attribution for spend. Carried on CallCtx as a typed extension: ctx.insert_ext(DecisionKey::new(...)).
LocalRunnerClient
Wrap any ModelRunner (including MockRunner) as an InferenceClient. Single-runner concurrency is bounded by the internal mutex; production setups should use the EngineCoreActor from atomr-infer-runtime instead.
LoggingMiddleware
MiddlewareStack
Convenience container — registered middlewares + helpers to run them.
ModelPin
A first-class pin on (provider, model, version, params).
ModelPricing
Per-model pricing in micro-USD per 1000 tokens (avoids float drift).
PinnedClient
InferenceClient middleware enforcing a ModelPin.
Pricing
Pricing table keyed by model id.
RateLimitMiddleware
RedactionMiddleware
ReplayProvider
An InferenceClient that returns recorded completions in order.
ResolvedModel
What a provider actually resolves to at call time.
Spend
A realized spend after a call.
SpendLedger
Accumulates spend for cost-vs-alpha analysis and budget checks.
StaticResolver
A static resolver (tests / known-version deployments).
ToolErrorRecoveryMiddleware
TurnResult

Enums§

BudgetScope
Scope a budget applies to.
Cap
A spend cap.
DriftKind
Kind of drift detected.
ModelPinViolation
Pin violation: strict mode with no pin, or (optionally) a hard refusal on drift.
Provider
ReplayError
Errors raised on the replay path. Replay fails loudly rather than re-inferring.

Traits§

AgentMiddleware
InferenceClient
Implemented by anything the agent can use to drive an inference request. The provider matters for tool-call delta parsing.
ModelResolver
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; None if they match.
record_turn
Capture a live TurnResult as an InferenceRecord for later replay. params_hash / prompt_hash are supplied by the caller (they derive from the request, which the pipeline holds).
turn_from_record
Reconstruct a TurnResult from a recorded InferenceRecord.