#icp #tee #ai-agent #http

anda_core

Core types and traits for Anda -- a framework for AI agent development

11 releases

new 0.3.5 Feb 7, 2025
0.3.4 Jan 24, 2025
0.2.3 Jan 15, 2025
0.1.0 Jan 10, 2025

#1273 in Web programming

Download history 177/week @ 2025-01-07 517/week @ 2025-01-14 292/week @ 2025-01-21 19/week @ 2025-01-28 167/week @ 2025-02-04

1,011 downloads per month
Used in 2 crates

MIT/Apache

61KB
893 lines

anda_core: Anda Core Library

License Crates.io Test Docs.rs Latest Version

The Anda Core Library provides the fundamental building blocks for creating and managing AI agents and tools in a modular, secure, and extensible system.

More information about this crate can be found in the crate documentation.

Key Features

  • Modular Architecture: Separates concerns into distinct modules for agents, tools, context, and models
  • Type Safety: Strongly typed interfaces for agent and tool definitions
  • Asynchronous Execution: All operations are async for efficient I/O handling
  • Dynamic Dispatch: Supports runtime polymorphism for agents and tools
  • Security Features: Includes cryptographic operations and verified caller information
  • Extensibility: New features can be added through modular trait implementations

Core Modules

1. Agent Module agent.rs

Provides core functionality for creating and managing AI agents:

  • Agent trait for defining custom agents
  • AgentDyn trait for runtime polymorphism
  • AgentSet for managing multiple agents

2. Tool Module tool.rs

Defines the core functionality for creating and managing tools:

  • Tool trait for defining custom tools with typed arguments
  • ToolDyn trait for runtime polymorphism
  • ToolSet for managing multiple tools

3. Context Module context.rs

Provides the execution environment for agents and tools:

  • AgentContext as the primary interface combining all capabilities
  • BaseContext for fundamental operations
  • Feature sets including:
    • State management
    • Cryptographic operations
    • Persistent storage
    • In-memory caching
    • HTTP communication
    • Blockchain interactions

4. Model Module model.rs

Defines core data structures and interfaces for LLMs:

  • Agent output and message structures
  • Function definitions with JSON schema support
  • Knowledge and document handling
  • Completion and embedding request/response structures
  • Core AI capabilities traits

5. HTTP Module http.rs

Provides utilities for making RPC calls:

  • CBOR-encoded RPC calls
  • Candid-encoded canister calls
  • HTTP request/response handling
  • Error handling for RPC operations

Key Concepts

Agent System

  • Agents implement specific capabilities through the Agent trait
  • Agents can be dynamically selected and executed at runtime
  • Agents can depend on multiple tools for functionality

Tool System

  • Tools provide specific functionality through the Tool trait
  • Tools can be called with strongly-typed arguments
  • Tools support both direct and JSON-based execution

Context System

  • Provides the execution environment for agents and tools
  • Modular design allows for flexible feature composition
  • Includes security features like cryptographic operations

Knowledge Management

  • Supports semantic search and document storage
  • Allows adding and retrieving knowledge documents
  • Provides both similarity-based and time-based retrieval

Security Features

  • Cryptographic key derivation and management
  • Message signing and verification
  • Secure storage operations
  • Signed HTTP requests
  • Caller verification

License

Copyright © 2025 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.

Dependencies

~19–32MB
~498K SLoC