Skip to main content

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

Metadata

Release files for autogen-substrate-memory 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autogen-substrate-memory 0.2.0
File Size Uploaded
autogen_substrate_memory-0.2.0.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autogen-substrate-memory 0.2.0
File Interpreter ABI Platform
autogen_substrate_memory-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / autogen_substrate_memory-0.2.0.tar.gz

Download URL autogen_substrate_memory-0.2.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
94c77da842a5ca0721da84cb785f827ca85e43c99f516fcb3cd27e5080d7e8db
BLAKE2b-256 checksum
How to use checksums
923582254b6be1b1ce269304f2d564ddc409e70308e70c385e70ed82e4111b08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / autogen_substrate_memory-0.2.0-py3-none-any.whl

Download URL autogen_substrate_memory-0.2.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c9e535636551e1448800a0bb559cfd4768a9766ebf2f3edc451938af4e79909
BLAKE2b-256 checksum
How to use checksums
9988e2e9dda20ee5551c91ccc5b5957280f24b6608976eb9a29a91d23d463346
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page