Expand description
§Context Module
This module defines the core context interfaces and traits that provide the execution environment for Agents and Tools in the ANDA system. It includes:
- AgentContext: The primary interface combining all core functionality and AI-specific features.
- BaseContext: Fundamental operations available to all Agents and Tools.
- Feature Traits: Modular capabilities including state management, cryptographic operations, storage, caching, and HTTP communication.
The context system is designed to be:
- Modular: Features are separated into distinct traits for better organization and flexibility.
- Asynchronous: All operations are async to support efficient I/O operations.
- Extensible: New features can be added as separate traits while maintaining compatibility.
- Secure: Includes cryptographic operations and verified caller information.
§Key Components
§Core Traits
AgentContext: Main interface combining all capabilities;BaseContext: Fundamental operations required by all contexts;
§Feature Sets
StateFeatures: Contextual information about the execution environment;KeysFeatures: Cryptographic operations and key management;StoreFeatures: Persistent storage capabilities;CacheFeatures: In-memory caching with expiration policies;HttpFeatures: HTTP communication capabilities;VectorSearchFeatures: Semantic search functionality.
§Usage
Implement these traits to create custom execution contexts for Agents and Tools. The anda_engine context module provides.
a complete implementation, but custom implementations can be created for specialized environments.
Structs§
- Cancellation
Token - A token which can be used to signal a cancellation request to one or more tasks.
- Object
Meta - The metadata that describes an object.
- OsVersion
- Uniquely identifies a version of an object to update
- Path
- A parsed path representation that can be safely written to object storage
- Principal
- Generic ID on Internet Computer.
- PutResult
- Result for a put request
- Update
Version
Enums§
- Cache
Expiry - Cache expiration policy for cached items.
- PutMode
- Configure preconditions for the put operation
Traits§
- Agent
Context - AgentContext provides the execution environment for Agents. It combines core functionality with AI-specific features:
- Base
Context - BaseContext is the core context interface available when calling Agent or Tool. It provides access to various feature sets including:
- Cache
Features - CacheFeatures is one of the context feature sets available when calling Agent or Tool.
- Cache
Store Features - CacheStoreFeatures combines Store and Cache features for efficient data management.
- Canister
Caller - A trait for interacting with canisters
- Http
Features - HttpFeatures provides HTTP request capabilities for Agents and Tools.
- Keys
Features - KeysFeatures is one of the context feature sets available when calling Agent or Tool.
- State
Features - StateFeatures is one of the context feature sets available when calling Agent or Tool.
- Store
Features - StoreFeatures is one of the context feature sets available when calling Agent or Tool.
- Vector
Search Features - Provides vector search capabilities for semantic similarity search.
Functions§
- derivation_
path_ with - Derives a derivation path with the given path and derivation path.
Type Aliases§
- Json
- Type alias for serde_json::Value