anda_core
anda_core defines the shared traits, data models, and protocol helpers used by the Anda agent framework. It is the stable contract between runtimes, agents, tools, model adapters, and clients.
This crate is intentionally small in scope: it does not run an engine, call model providers directly, or ship built-in tools. Runtime orchestration and provider integrations live in higher-level crates such as anda_engine.
Full API documentation is available on docs.rs.
Install
[]
= "0.11"
What It Provides
- Strongly typed
AgentandTooltraits. - Dynamic registries through
AgentSetandToolSet. - Execution context capability traits for state, keys, storage, cache, HTTP, and canister calls.
- Provider-neutral model types such as
Message,ContentPart,CompletionRequest, andAgentOutput. - JSON schema helpers for LLM function calling.
- CBOR/Candid HTTP RPC helpers for remote engines and ICP canisters.
Module Map
| Module | Purpose |
|---|---|
agent |
Defines agents, dynamic dispatch, dependency declarations, and agent registries. |
tool |
Defines typed tools, raw JSON dispatch, supported resource tags, and tool registries. |
context |
Defines runtime capabilities exposed to agents and tools. |
model |
Defines request/response, message, content, function-call, document, and usage types. |
http |
Provides CBOR/Candid RPC request and response helpers. |
json |
Generates compact JSON Schema values for tool and agent parameters. |
Core Concepts
Agents
An agent implements Agent<C> for a runtime context C. It declares a name, description, function definition, optional tool dependencies, optional supported resource tags, and an async run method.
Agent names are registered case-insensitively and must follow the same function-name rules used for LLM function calling: lowercase ASCII letters, digits, and underscores, starting with a lowercase letter.
Tools
A tool implements Tool<C> with typed Args and Output associated types. The runtime accepts raw JSON tool calls, deserializes them into Args, executes the tool, then serializes the output back to JSON.
Tools can declare supported resource tags. During a call, the runtime removes matching resources from the request resource list and passes them to the tool.
Contexts
BaseContext is the capability surface available to tools and agents. It combines:
StateFeaturesfor engine identity, caller identity, metadata, cancellation, and elapsed time.KeysFeaturesfor AES, Ed25519, and Secp256k1 key derivation, signing, verification, and public keys.StoreFeaturesfor isolated object storage.CacheFeaturesfor isolated in-memory cache values with optional TTL/TTI expiration.HttpFeaturesfor runtime-managed HTTPS calls.CanisterCallerfor ICP canister calls.
AgentContext extends BaseContext with LLM completion and orchestration methods for local or remote agents and tools.
Messages and Content
Message and ContentPart provide a normalized representation for text, reasoning, files, inline binary data, tool calls, tool outputs, signed actions, and provider-specific JSON payloads. Model adapters can preserve unknown provider content in ContentPart::Any while still exposing common behavior to the rest of the framework.
Minimal Tool Example
use ;
use JsonSchema;
use Deserialize;
;
Validation
Useful checks while working on this crate:
RUSTDOCFLAGS="-D warnings"
License
Copyright © 2026 LDC Labs.
ldclabs/anda is licensed under the MIT License. See the MIT license for the full license text.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in anda by you shall be licensed as MIT, without any additional
terms or conditions.