Skip to main content

Composable agentic framework on top of atomr actors and atomr-infer.

Project description

atomr-agents

A native Rust agentic framework built as a layered actor / strategy / harness substrate on top of atomr and atomr-infer. atomr-agents gives you a single mental model — pluggable strategies that resolve under shared budgets, channelled state with first-class checkpointing, tool-call orchestration with parallel dispatch, and durable harness loops — that scales from a one-off chatbot to a multi-tenant production agent platform.

use atomr_agents::prelude::*;

// One Pipeline composes prompt → model → parser like LCEL.
let pipeline = Pipeline::from(prompt)
    .then(model)
    .then(parser)
    .build();

let answer = pipeline.call(input, ctx).await?;

Why an agentic framework, in Rust, on actors

Agentic systems don't fail because the models aren't good enough — they fail because the substrate underneath them treats context, composition, and persistence as afterthoughts. Glue-code retry policies, opaque memory, hand-rolled tool loops, brittle handoff between agents — that's where 3 a.m. pages come from.

Composition is the unit of work. A real agent is a Pipeline of prompts, models, parsers, and tools — each with its own retry, fallback, timeout, cache, and trace policy. atomr-agents makes every component a Callable with the same composition surface, so with_retry, with_fallbacks, and with_config apply uniformly to prompts, models, retrievers, and parsers alike.

State is channelled, durable, and forkable. Long-running agents need more than chat history. They need typed channels with reducers (AppendMessages, MergeMap, LastWriteWins, MaxByTimestamp), per-super-step checkpoints keyed by (workflow, run, step), and fork-with-edit so an operator can branch a divergent run from any prior state. atomr-agents ships LangGraph's state model verbatim in atomr's actor idiom.

Tool calls are parallel and provider-agnostic. When a model emits five tool calls in one turn, atomr-agents fans them into a JoinSet and aggregates in original order. The streaming tool_call_delta parser handles OpenAI and Anthropic deltas natively; new providers plug in behind the same Provider enum. Per-call deltas are also surfaced as Event::ToolCallStreamed so tracers and UIs see tool intent in real time, distinct from the post-call Event::ToolInvoked. RichTool returns ToolReturn::{Content, ContentAndArtifact, Command} so a tool can also drive graph control flow.

Provider runtimes are opt-in feature flags. Enable provider-anthropic, provider-openai, or provider-gemini on the umbrella to pull the corresponding atomr-infer-runtime-* crate and re-export its *Config / *Pricing / *Runner via atomr_agents::agent::providers::{anthropic, openai, gemini}. Cost reports include cached_tokens (Anthropic prompt-cache, OpenAI cached input) and reasoning_tokens (o1-style) automatically.

Granular efficiency. Rust gives us deterministic resource use, zero-cost abstractions, and ownership-as-concurrency-safety. Strategy trait generics monomorphize the per-turn pipeline; Box<dyn> opt-in exists for config-driven loading. The whole 26-crate workspace builds under cargo check --workspace in seconds and ships zero runtime overhead beyond what the actor crate already pays.

What's in the box

Crate What it does
atomr-agents Umbrella facade re-exporting the public surface, feature-flag-driven
atomr-agents-core Ids, budgets (token / time / money / iteration), AgentContext, RunId, structured Event taxonomy, error types
atomr-agents-callable Callable trait, CallableHandle, Pipeline builder (then / fan_out / assign), decorators (with_retry / with_fallbacks / with_config / with_timeout / Branch / Lambda)
atomr-agents-strategy Strategy trait family (ToolStrategy, MemoryStrategy, SkillStrategy, RoutingStrategy, PolicyStrategy, LoopStrategy, TerminationStrategy) + combinators
atomr-agents-context ContextAssembler — priority-merge under a TokenBudget
atomr-agents-observability EventBus, RunTree builder, Tracer trait, StdoutTracer / JsonlTracer / LangSmithTracer
atomr-agents-state StateSchema + 5 reducers, RunState, Checkpointer trait + InMemoryCheckpointer, fork-with-edit; SQLite/Postgres backend stubs behind features
atomr-agents-tool Tool / RichTool traits, ToolDescriptor, ToolSet + ToolSetRegistry, PermissionSpec, provider-aware ToolCallParser (OpenAI / Anthropic), HandoffTool
atomr-agents-skill Skill, SkillSet, Static / Keyword skill strategies
atomr-agents-memory MemoryStore (short-term) + LongStore (long-term, namespace-tupled), RecencyMemoryStrategy / SummarizingMemoryStrategy / ChainedMemoryStrategy, WriteMemoryTool / UpdateMemoryTool / RecallMemoryTool
atomr-agents-embed Embedder trait, MockEmbedder, AnnIndex + InMemoryAnnIndex, EmbeddingToolStrategy
atomr-agents-retriever Retriever zoo: Bm25 / Vector / MultiQuery / ContextualCompression / ParentDocument / Ensemble (RRF) / SelfQuery / EmbeddingsFilter / TimeWeighted
atomr-agents-ingest Loader (text / md / json / csv) + splitters (Recursive / MarkdownHeader / Code / Token / Semantic) + CachedEmbedder + IngestPipeline
atomr-agents-persona All five structural strategies (Static, BigFive, Mbti, Jungian, Composite) + emphasis strategies (Static, AudienceAdaptive, TaskAdaptive, MoodState, GoalConditioned)
atomr-agents-instruction ComposedInstructionStrategy<P, T, B>, ChatPromptTemplate, MessagesPlaceholder, FewShotChatTemplate, LengthBasedSelector / SemanticSimilaritySelector
atomr-agents-agent Agent<I, T, Ms, Sk> actor + per-turn pipeline, tool-call loop with parallel dispatch, AgentMiddleware (logging / retry / rate-limit / redaction / tool-error-recovery), InferenceClient adapter for any ModelRunner
atomr-agents-workflow DAG primitives, WorkflowRunner, StatefulRunner (channelled state), Interruptible (interrupt() + interrupt_before / _after + Command::{Continue, Resume, Update, Goto}), Subgraph, dispatch_fan_out (Send-API analogue)
atomr-agents-harness Harness<L, T> actor, LoopStrategy / TerminationStrategy, durable iteration log; Harness is itself a Callable
atomr-agents-org Org / Department / Team, OrgRoutingStrategy impls (RoundRobin / LoadAware / CapabilityMatch), Policy::narrow, NamespacedMemory (read-cascade + write-gating), swarm_loop helper
atomr-agents-registry Versioned artifact registry with (kind, id, version) keys + publish_gated for eval-regression blocking
atomr-agents-eval EvalSuite, Scorer (Contains / Equality / Regex / LlmJudgeScorer / RubricScorer / PairwiseScorer), RegressionGate, AnnotationQueue
atomr-agents-cache LlmCache trait + InMemoryLlmCache + SemanticLlmCache (cosine match on prompt embedding); SQLite/Redis backend stubs behind features
atomr-agents-parser Parser<T> trait, JsonParser / JsonSchemaParser / SchemaParser<T> / EnumParser / CommaListParser / XmlParser / YamlParser, OutputFixingParser, RetryWithErrorParser, StreamingPartialJsonParser
atomr-agents-py-bindings atomr_agents._native PyO3 module — Event / EventBus / Registry exposed to Python
atomr-agents-cli atomr-agents binary with eval / registry / harness / serve (Studio-style read+resume inspector) subcommands
atomr-agents-testkit Stub crate today. For tests, depend on atomr-infer-testkit (re-exports MockRunner / MockScript) directly — that's what crates/agent tests use.

Plus a Python facade — pip install atomr-agents — that exposes the host-mode Registry / EventBus and the guest-mode @tool / @strategy / @persona decorators.

Quick start (Rust)

The umbrella crate is published on crates.io as atomr-agents:

[dependencies]
atomr-agents = { version = "0.2", features = ["agent", "harness", "eval"] }
atomr-infer  = { version = "0.6", features = ["openai"] }   # or any provider

Or, to pull a provider runtime through the umbrella so Agent / LocalRunnerClient / OpenAiRunner come from one crate:

atomr-agents = { version = "0.2", features = ["agent", "provider-openai"] }
# or features = ["agent", "provider-anthropic"], ["agent", "provider-gemini"]

A minimal agent against MockRunner (good for tests; swap for any ModelRunner in production):

use std::sync::Arc;
use atomr_agents::prelude::*;
use atomr_agents::agent::{Agent, AgentBudgets, InferenceClient, LocalRunnerClient, Provider};
use atomr_agents::tool::{StaticToolStrategy, DynTool};
use atomr_agents::memory::{InMemoryStore, RecencyMemoryStrategy};
use atomr_agents::skill::StaticSkillStrategy;
use atomr_agents::persona::StaticPersonaStrategy;
use atomr_agents::instruction::{
    ComposedInstructionStrategy, StaticBehaviorStrategy, StaticTaskStrategy,
};
use atomr_agents::observability::EventBus;
use atomr_infer_testkit::{MockRunner, MockScript};

let runner = MockRunner::new(MockScript::from_text(["the answer is ", "42"]));
let inference: Arc<dyn InferenceClient> =
    Arc::new(LocalRunnerClient::new(runner, Provider::OpenAi));

let agent = Agent {
    id: AgentId::from("a-1"),
    model: "mock".into(),
    instructions: ComposedInstructionStrategy::new(
        StaticPersonaStrategy::new("You are a helpful assistant."),
        StaticTaskStrategy("Answer arithmetic questions.".into()),
        StaticBehaviorStrategy("Reply tersely.".into()),
    ),
    tools: StaticToolStrategy::new(Vec::<DynTool>::new()),
    memory: RecencyMemoryStrategy::new(Arc::new(InMemoryStore::new()), 5, 30),
    skills: StaticSkillStrategy::new(vec![]),
    inference,
    bus: EventBus::new(),
    max_tool_iterations: 3,
};

let r = agent
    .run_turn("what's 1+2".into(), AgentBudgets::default())
    .await?;
println!("{}", r.text);

Add tools, switch the MockRunner to a real ModelRunner (OpenAI, Anthropic, vLLM, …), and the same code runs unchanged.

Quick start (Python)

pip install atomr-agents
from atomr_agents import EventBus, Registry

bus = EventBus()
bus.subscribe(lambda ev: print(ev.kind, ev.timestamp_ms))

registry = Registry()
registry.publish("tool_set", "ts", "0.1.0", {"tools": ["calc"]})
print(registry.latest("tool_set", "ts"))

See docs/python.md for the full host/guest model and the subinterpreter-pool dispatcher pattern inherited from atomr's pycore.

Documentation map

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atomr_agents-0.2.2.tar.gz (882.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

atomr_agents-0.2.2-cp311-cp311-win_amd64.whl (264.7 kB view details)

Uploaded CPython 3.11Windows x86-64

atomr_agents-0.2.2-cp311-cp311-manylinux_2_34_x86_64.whl (400.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

atomr_agents-0.2.2-cp311-cp311-manylinux_2_34_aarch64.whl (395.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ ARM64

atomr_agents-0.2.2-cp311-cp311-macosx_11_0_arm64.whl (357.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file atomr_agents-0.2.2.tar.gz.

File metadata

  • Download URL: atomr_agents-0.2.2.tar.gz
  • Upload date:
  • Size: 882.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for atomr_agents-0.2.2.tar.gz
Algorithm Hash digest
SHA256 8c01c6e804da483da8ee03ba999d54e88562ee01eaa21b19e1ec54e5f810be19
MD5 4aae093bb6cc97947ea083bdc62ff8ac
BLAKE2b-256 338274e8b938d7fca8344bc623734a2695cb41064cb55152df57bc5b740a2bbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_agents-0.2.2.tar.gz:

Publisher: release.yml on rustakka/atomr-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atomr_agents-0.2.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for atomr_agents-0.2.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 81b86a502a6dd06b4c8bf7412f5e6fd7c810b26fad617156022491deba6d4383
MD5 48538c9f0dd53e8e473a42afc386bd04
BLAKE2b-256 8dee6b972fc78f9f254d64eace5c20572dfb5e37092c40297fce86780bb10288

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_agents-0.2.2-cp311-cp311-win_amd64.whl:

Publisher: release.yml on rustakka/atomr-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atomr_agents-0.2.2-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for atomr_agents-0.2.2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 68fa28c0b0b5a98798746c95243f5df17b08c42d118ddbf2b222e324a3558dec
MD5 c9175de4da1f5a9e3402989edc080abd
BLAKE2b-256 1a7018b195c14e4177f88ef23e724f7696610b149dd48d80d92f1f5829129472

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_agents-0.2.2-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: release.yml on rustakka/atomr-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atomr_agents-0.2.2-cp311-cp311-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for atomr_agents-0.2.2-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 456d4386950b2c2700f98bf68607efa7ec8272edd45b5223ace23a7d5b1705e4
MD5 7c39f9118778d375f3e7d4ca4f51f693
BLAKE2b-256 3e87a29b107dd4bc6bc62229baf0be29445bbfeb70a8c4ae02d5212db918bdf1

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_agents-0.2.2-cp311-cp311-manylinux_2_34_aarch64.whl:

Publisher: release.yml on rustakka/atomr-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atomr_agents-0.2.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for atomr_agents-0.2.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 24903dbc98a77c5f971ad875dc029e4f03f5a0ec585b8aadcb9cc0205afccf8a
MD5 56e434877320c1e2078268ab04ad1680
BLAKE2b-256 6829721f7d267005f61382758b0b6b372f5c6f9ea08fb3542c49008b173e44be

See more details on using hashes here.

Provenance

The following attestation bundles were made for atomr_agents-0.2.2-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on rustakka/atomr-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page