Agent Data Store
The Agent Data Store provides persistent key-value storage for agents, enabling them to save and retrieve data across executions.
Overview
The data store enables:
- Persistence: Save results between agent runs
- Caching: Avoid redundant expensive operations
- Cross-agent communication: Share data between agents
- Incremental processing: Build up results over multiple executions
Data is automatically scoped per-user, so agents can only access their owner's data.
Quick Example
The data_store object is automatically available in every agent:
async def run(input_dict: dict, tools: dict) -> dict:
# Check cache
cached = data_store.get("analysis-result")
if cached:
return {"result": cached, "source": "cache"}
# Compute and cache
result = await expensive_analysis()
data_store.set("analysis-result", result)
return {"result": result, "source": "computed"}
Documentation
Detailed documentation is available in the data-store directory:
- Quick Start - Get started in 5 minutes
- API Reference - Complete method documentation
- Schema - Document structure
- Namespaces - Organizing data
- Patterns - Common usage recipes
- Cross-Agent Workflows - Multi-agent data sharing
- Troubleshooting - Common issues
- Administration - Database management
Key Features
Namespaces
Organize data into logical groups:
# Different namespaces for different purposes
files = data_store.use_namespace(f"files:{repo}")
summaries = data_store.use_namespace(f"summary:{repo}")
cache = data_store.use_namespace("api-cache")
Namespace Discovery
Find what data exists:
namespaces = data_store.list_namespaces()
# Returns: ["default", "files:my-repo", "cache:github", ...]
Batch Operations
Efficient bulk operations:
# Set multiple values
data_store.set_many({"key1": val1, "key2": val2})
# Get multiple values
results = data_store.get_many(["key1", "key2"])
Related Documentation
- Database Service - Underlying storage infrastructure
- Developer Quickstart - Getting started with development