SUBSTRATE cognitive memory provider for Microsoft AutoGen agents
Project description
autogen-substrate-memory
SUBSTRATE cognitive memory provider for Microsoft AutoGen agents.
Give your AutoGen agents persistent identity, emotional awareness, and causal memory powered by the SUBSTRATE cognitive entity framework.
Installation
pip install autogen-substrate-memory
Or install from source:
pip install -e ".[dev]"
Quick Start
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_substrate import SubstrateMemory
async def main():
# Create SUBSTRATE memory provider
memory = SubstrateMemory(api_key="sk_sub_your_key_here")
# Create an AutoGen agent with SUBSTRATE memory
agent = AssistantAgent(
name="kai",
model_client=OpenAIChatCompletionClient(model="gpt-4o"),
memory=[memory],
)
# The agent now has access to persistent cognitive memory,
# emotional state, and identity verification.
response = await agent.run(task="What do you remember about our last conversation?")
print(response)
asyncio.run(main())
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
SUBSTRATE_API_KEY |
Your SUBSTRATE API key | (required) |
SUBSTRATE_MCP_URL |
MCP server URL | https://substrate.garmolabs.com/mcp-server/mcp |
Full Configuration
from autogen_substrate.memory import SubstrateMemory, SubstrateMemoryConfig
config = SubstrateMemoryConfig(
api_key="sk_sub_...",
mcp_url="https://substrate.garmolabs.com/mcp-server/mcp",
search_top_k=10, # Number of memory results per query
include_emotion=True, # Include emotional state in queries
include_identity=True, # Include identity verification in context
include_values=True, # Include core values in context
timeout_seconds=30.0, # HTTP request timeout
)
memory = SubstrateMemory(config=config)
How It Works
Memory Protocol
SubstrateMemory implements AutoGen's Memory protocol:
| Method | Behavior |
|---|---|
query(query) |
Hybrid search (semantic + keyword) across entity memory. Optionally includes emotional state. |
update_context(model_context) |
Injects identity, emotion, values, and relevant memories as a SystemMessage. |
add(content) |
Stores content via the SUBSTRATE respond tool with a [memory-store] prefix. |
clear() |
No-op. SUBSTRATE manages its own memory lifecycle with causal consolidation. |
close() |
No-op. Each operation creates its own HTTP connection. |
SUBSTRATE MCP Tools Used
| Tool | Used In | Purpose |
|---|---|---|
hybrid_search |
query(), update_context() |
Semantic + keyword memory retrieval |
memory_search |
query() (fallback) |
Keyword-only memory retrieval |
get_emotion_state |
query(), update_context() |
Current affective state (valence, arousal, dominance) |
verify_identity |
update_context() |
Cryptographic identity continuity check |
get_values |
update_context() |
Core value architecture |
respond |
add() |
Store new memories via conversational input |
Get an API Key
Sign up at garmolabs.com to get a SUBSTRATE API key.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autogen_substrate_memory-0.2.0.tar.gz.
File metadata
- Download URL: autogen_substrate_memory-0.2.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94c77da842a5ca0721da84cb785f827ca85e43c99f516fcb3cd27e5080d7e8db
|
|
| MD5 |
71d1490c695f8db52eccd2f5446fd84b
|
|
| BLAKE2b-256 |
923582254b6be1b1ce269304f2d564ddc409e70308e70c385e70ed82e4111b08
|
File details
Details for the file autogen_substrate_memory-0.2.0-py3-none-any.whl.
File metadata
- Download URL: autogen_substrate_memory-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c9e535636551e1448800a0bb559cfd4768a9766ebf2f3edc451938af4e79909
|
|
| MD5 |
40eecd9dc829393aedc83984c00c8125
|
|
| BLAKE2b-256 |
9988e2e9dda20ee5551c91ccc5b5957280f24b6608976eb9a29a91d23d463346
|