Skip to main content

Module context

Module context 

Source
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

§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§

CancellationToken
A token which can be used to signal a cancellation request to one or more tasks.
ObjectMeta
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
UpdateVersion

Enums§

CacheExpiry
Cache expiration policy for cached items.
PutMode
Configure preconditions for the put operation

Traits§

AgentContext
AgentContext provides the execution environment for Agents. It combines core functionality with AI-specific features:
BaseContext
BaseContext is the core context interface available when calling Agent or Tool. It provides access to various feature sets including:
CacheFeatures
CacheFeatures is one of the context feature sets available when calling Agent or Tool.
CacheStoreFeatures
CacheStoreFeatures combines Store and Cache features for efficient data management.
CanisterCaller
A trait for interacting with canisters
HttpFeatures
HttpFeatures provides HTTP request capabilities for Agents and Tools.
KeysFeatures
KeysFeatures is one of the context feature sets available when calling Agent or Tool.
StateFeatures
StateFeatures is one of the context feature sets available when calling Agent or Tool.
StoreFeatures
StoreFeatures is one of the context feature sets available when calling Agent or Tool.
VectorSearchFeatures
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