Skip to main content

Module context

Module context 

Source
Expand description

Context Provider Extension Point

This module provides the extension point for integrating context databases like OpenViking into the agent loop. Context providers can supply memory, resources, and skills to augment the LLM’s context.

§Usage

Implement the ContextProvider trait and register it with a session:

use a3s_code::context::{ContextProvider, ContextQuery, ContextResult};

struct MyProvider { /* ... */ }

#[async_trait::async_trait]
impl ContextProvider for MyProvider {
    fn name(&self) -> &str { "my-provider" }

    async fn query(&self, query: &ContextQuery) -> anyhow::Result<ContextResult> {
        // Retrieve relevant context...
    }
}

Re-exports§

pub use fs_provider::FileSystemContextConfig;
pub use fs_provider::FileSystemContextProvider;

Modules§

fs_provider
File System Context Provider

Structs§

ContextItem
A single piece of retrieved context
ContextQuery
Query to a context provider
ContextResult
Result from a context provider query

Enums§

ContextDepth
Retrieval depth for tiered context (L0/L1/L2 pattern)
ContextType
Type of context being queried

Traits§

ContextProvider
Context provider trait - implement this for OpenViking, RAG systems, etc.