How ldclabs/anda works
Main Components
• Core Library (anda_core): This contains base types, shared interfaces, and models (e.g., completion, embedding, knowledge, thread). It forms the fundamental building blocks that other modules depend on.
• Engine (anda_engine): This module implements the runtime and management of AI agents. It includes subcomponents such as context management (for agents, cache, web3, etc.), extensions (e.g., attention, character, extractor, google integration), and a dedicated model directory supporting various AI providers (e.g., OpenAI, Cohere, Deepseek).
• CLI Interface (anda_cli): A command-line tool enabling interaction with the engine server and agent runtime.
• Engine Server (anda_engine_server): An HTTP-based server that exposes API endpoints to serve and manage one or more Anda engine instances.
• Lancedb Integration (anda_lancedb): Acts as the vector storage/retrieval component for the agents.
• Web3 Client (anda_web3_client): This module supplies the Rust SDK for Web3 integration outside of the TEE environments.
• Agents (e.g., agents/anda_bot): Concrete AI agent implementations—each agent (such as anda_bot) is in its own subdirectory including deployment scripts, Dockerfile (for containerized deployment, or Nitro Enclave support), configuration, and source code.
• Tools (e.g., tools/anda_icp): Utility modules that provide integration with external services like the Internet Computer Protocol (ICP) blockchain.
• Additional Supporting Files: Directories like “characters,” “examples,” and “docs” that provide configuration, example implementations, and extended architecture documentation.
Relationships and Interactions
• The Core Library (anda_core) is central—other components (engine, CLI, server, agents) depend on it for shared models, types, and interfaces.
• The Engine (anda_engine) uses the core to provide runtime management, agent orchestration, and extension support. Its “context” and “management” subdirectories indicate a structured approach, likely isolating responsibilities (e.g., communication, caching, state management).
• Agents (in agents/anda_bot, for example) are built using the core and engine libraries, where they incorporate domain-specific logic and TEE configurations (e.g., Nitro enclave setups).
• The Engine Server (anda_engine_server) exposes endpoints (HTTP) for interacting with the engine’s functionalities and orchestrating agent actions at runtime.
• The CLI (anda_cli) provides a developer-friendly interface to interact with these services.
• The Lancedb and Web3 modules represent external service integrations that support persistent memory (storing knowledge and vectors) and blockchain interactions respectively.
• Tools like anda_icp expand the platform’s integration, enabling features such as ledger querying and transfers over ICP.
Important Architectural Patterns and Design Principles
• Modularity and Composability: Each component is separated into different crates (modules), which makes the system extensible—new agents, tools, or integrations can be added without significant rework.
• Decoupled Core and Extensions: The core library remains independent while other modules (engine, agents, tools) build on top of it. Extensions (in anda_engine’s extension directory) support additional features like third-party integrations.
• Secure and Decentralized Execution: With TEE support and ICP blockchain integration, the design emphasizes trustworthiness, security, and decentralized memory (perpetual memory powered by blockchain).
• Clear Separation of Concerns: Command line interfaces, server interfaces, and agent-specific logic are well separated.