Skip to main content

atomr_agents_agent/
lib.rs

1//! `Agent<I, T, Ms, Ml, Sk>` and the per-turn pipeline.
2//!
3//! The agent holds an `InferenceClient` (an abstraction over a
4//! `ModelRunner` from atomr-infer); strategies are generic so the
5//! hot path is monomorphized. [`BoxedAgent`] (object-erased form)
6//! and [`AgentRef`] (Arc-wrapped handle) provide config-driven
7//! instantiation; see [`AgentSpec::into_agent`].
8
9mod boxed;
10mod cost;
11mod inference;
12mod middleware;
13mod model_pin;
14mod pipeline;
15mod replay;
16mod spec;
17mod r#trait;
18
19pub use boxed::BoxedAgent;
20pub use cost::{
21    Budget, BudgetExceeded, BudgetScope, Cap, CostEstimate, CostMeter, DecisionKey, ModelPricing, Pricing,
22    Spend, SpendLedger,
23};
24pub use inference::{InferenceClient, LocalRunnerClient, TurnResult};
25pub use middleware::{
26    AgentMiddleware, LoggingMiddleware, MiddlewareStack, RateLimitMiddleware, RedactionMiddleware,
27    ToolErrorRecoveryMiddleware,
28};
29pub use model_pin::{
30    detect_drift, DriftKind, ModelPin, ModelPinViolation, ModelResolver, PinnedClient, ResolvedModel,
31    StaticResolver,
32};
33pub use pipeline::{Agent, AgentBudgets};
34pub use r#trait::AgentRef;
35pub use replay::{record_turn, turn_from_record, ReplayError, ReplayProvider};
36pub use spec::AgentSpec;
37
38pub use atomr_agents_tool::Provider;
39
40/// Provider runtime back-ends, gated by per-provider features.
41/// Wrap any of these `Runner` types in `LocalRunnerClient` to use them
42/// as an `InferenceClient`.
43pub mod providers {
44    #[cfg(feature = "provider-anthropic")]
45    pub mod anthropic {
46        pub use atomr_infer_runtime_anthropic::{
47            classify_anthropic_error, AnthropicConfig, AnthropicPricing, AnthropicRunner,
48        };
49    }
50    #[cfg(feature = "provider-openai")]
51    pub mod openai {
52        pub use atomr_infer_runtime_openai::{
53            classify_openai_error, OpenAiConfig, OpenAiPricing, OpenAiRunner, OpenAiVariant,
54        };
55    }
56    #[cfg(feature = "provider-gemini")]
57    pub mod gemini {
58        pub use atomr_infer_runtime_gemini::{
59            classify_gemini_error, GeminiConfig, GeminiPricing, GeminiRunner, GeminiVariant, SafetySetting,
60        };
61    }
62}