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.1.tar.gz (9.9 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.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for autogen_substrate_memory-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f7d511809644a150f93e8c04d734ee3b26381cf3f6de6441e382906ef83d16a0
MD5 14682cf6bf67bd866149d8471ec2d332
BLAKE2b-256 09ca571729de44cf7755b3cc6859aa129b051266284f10e2bd045976129b7c98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for autogen_substrate_memory-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 269efd5369c5489b02b89363660c40ff033f330386db6843512e04bf94cebeb1
MD5 076e56f19ea86a61c1d65f6d0f2f81e9
BLAKE2b-256 d43ca481ab1ccf69d5b1e31fd95dd3f645d3163e2f31f60a6d0a84d8d49f96dd

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