Skip to main content

MemMachine memory tool for Strands Agents

Project description

strands-memmachine

MemMachine memory tool for Strands Agents

Strands DocsMemMachineAPI DocsCommunity Packages

A Strands Agents extension that integrates MemMachine as a persistent memory backend, enabling AI agents to store, search, list, and delete episodic and semantic memories across sessions. It also supports full project management — create, retrieve, list, and delete isolated memory namespaces.

What is MemMachine?

MemMachine is an AI memory platform by MemVerge that provides persistent, structured memory for AI agents. It enables agents to remember information across sessions, learn from past interactions, and deliver personalized, context-aware responses.

MemMachine supports two memory types:

  • Episodic memory — conversational, event-based memories tied to interactions
  • Semantic memory — factual, structured knowledge extracted from conversations

Memory is organized into Projects — isolated namespaces that keep memories separated by use case, user, or application.

Installation

pip install strands-memmachine

Configuration

Environment Variable Required Description
MEMMACHINE_API_KEY Yes API key from console.memmachine.ai
export MEMMACHINE_API_KEY=your_api_key

Usage

from strands import Agent
from strands_memmachine import memmachine_memory

agent = Agent(tools=[memmachine_memory])

# Store a memory
agent.tool.memmachine_memory(
    action="store",
    content="User prefers aisle seats on flights",
    metadata={"user_id": "alice", "category": "travel"},
)

# Search memories
agent.tool.memmachine_memory(
    action="search",
    query="What are the flight preferences?",
    top_k=5,
)

# List memories with filter
agent.tool.memmachine_memory(
    action="list",
    filter="metadata.user_id=alice AND metadata.category=travel",
    page_size=20,
)

# Delete a single episodic memory
agent.tool.memmachine_memory(
    action="delete",
    memory_type="episodic",
    memory_id="mem-123",
)

# Bulk delete semantic memories
agent.tool.memmachine_memory(
    action="delete",
    memory_type="semantic",
    memory_ids=["sem-1", "sem-2", "sem-3"],
)

# Create a project
agent.tool.memmachine_memory(
    action="create_project",
    project_id="my-project",
    description="Project for storing travel preferences",
)

# Get a project
agent.tool.memmachine_memory(
    action="get_project",
    project_id="my-project",
)

# List all projects
agent.tool.memmachine_memory(
    action="list_projects",
)

# Get episode count for a project
agent.tool.memmachine_memory(
    action="get_episode_count",
    project_id="my-project",
)

# Delete a project
agent.tool.memmachine_memory(
    action="delete_project",
    project_id="my-project",
)

Actions

Memory Actions

Action Required Parameters Optional Parameters
store content types, producer, produced_for, metadata
search query top_k, types, filter
list memory_type, filter, page_size, page_num
delete memory_type, memory_id or memory_ids

Project Actions

Action Required Parameters Optional Parameters
create_project project_id description
delete_project project_id
get_project project_id
list_projects
get_episode_count project_id

Memory Types

  • Episodic — conversational, event-based memories
  • Semantic — factual, structured knowledge

Use the types parameter to target one or both:

agent.tool.memmachine_memory(
    action="store",
    content="User is a software engineer",
    types=["semantic"],
)

Metadata Filter Syntax

Used with search and list actions:

# Single condition
metadata.user_id=alice

# Multiple conditions
metadata.user_id=alice AND metadata.category=travel

Parameters

Memory Parameters

Parameter Type Description
action str Operation to perform
content str Memory text. Required for store
query str Search query. Required for search
memory_id str Single UID to delete. Required for delete when memory_ids not provided
memory_ids list[str] List of UIDs for bulk delete. Required for delete when memory_id not provided
memory_type str episodic or semantic. Required for delete, optional for list
types list[str] Memory types to write to or search. Defaults to both when omitted
top_k int Max search results. Default: 10
page_size int Results per page for list. Default: 100
page_num int Zero-based page index for list. Default: 0
filter str Metadata filter expression for search and list
producer str Producer identity label for store. Default: user
produced_for str Intended recipient for store
metadata dict Key-value pairs attached to the stored memory. All values coerced to strings

Project Parameters

Parameter Type Description
project_id str Unique project identifier. Allowed characters: letters, numbers, underscores, hyphens, colons, and Unicode
description str Optional human-readable description of the project

Resources

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

strands_memmachine-0.1.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

strands_memmachine-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: strands_memmachine-0.1.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.7

File hashes

Hashes for strands_memmachine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e1d56fdb781fa3fba59dc65640ad4c8b7a7a88b14bbb81af5337705acf21b7d7
MD5 c58e1786855f6efd03a6e37a6008f478
BLAKE2b-256 b197ba2ec685edd9fa8d68c0393e48d28c7b39bf2d83209bda9e80e20a5c284c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for strands_memmachine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99a9ed076473856e1f5fd380801f8a6e200a2fd9882dc03f877e25f9ab890479
MD5 6e13c05d5fc9d3993a1430c2d755b305
BLAKE2b-256 7f7d1ce42ba948ed5cf4c34ce17e36d8cc2f1c5fa871711221831c574a8cb6a6

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