Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autogen_substrate_memory-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autogen_substrate_memory-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file autogen_substrate_memory-0.1.0.tar.gz.

File metadata

File hashes

Hashes for autogen_substrate_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a0cd815f0c26e9df8cced07a348dbe74d40fc50c8e5d45f1b9aca3ca5d859f2f
MD5 4a43d35663f27b758f6ef0b13092ccfc
BLAKE2b-256 18bdd3edf77bd65469c2ae5a74d764502bfc67edb76b3cc0bf91c78af833fefd

See more details on using hashes here.

File details

Details for the file autogen_substrate_memory-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for autogen_substrate_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ffea9e8d8843074ccb19c70b670b9691703efaaecd86a97af9ea1a336dfd035c
MD5 b27e31ad322a20e5d38a8cf367d54889
BLAKE2b-256 31fddd55c0858d02c938eb6433c0d3cda8409e815db745160b1be9470a6e01c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page