Architecture
The MemMachine Client SDK acts as a bridge between your application logic (e.g., an AI agent, a chatbot, or a backend service) and the MemMachine Server.Communication Flow
The following diagram illustrates how the Client SDK integrates into your system architecture:Interaction Sequence
The standard workflow involves initializing the client, selecting a project, defining a memory context, and then performing operations.Installation
Install the client package via pip:Hello World Example
This complete example demonstrates the core workflow: connecting to the server, initializing a project workspace, and performing memory operations.MemMachineClient Hello World
Hello World Expected Output
Core Concepts
MemMachineClient
The entry point for the SDK. It manages the persistent HTTP session, connection pooling, and global configuration (like timeouts and retries).
Key Parameters:
base_url: The URL of your MemMachine Server (e.g.,http://localhost:8080).api_key: (Optional) Authentication token if your server requires it.timeout: Request timeout in seconds (default: 30).
Project
A Project represents an isolated workspace. All data in MemMachine is siloed by org_id and project_id.
- Use
client.create_project()to initialize or retrieve a project. - Use
client.get_project()to retrieve an existing project (raises error if not found).
Memory
The Memory object is a transient interface bound to a specific context. It does not hold state itself but ensures that every operation (add, search, delete) is tagged with the correct metadata identifiers:
user_id: The human user.agent_id: The AI agent.group_id: (Optional) A group identifier for multi-user contexts.session_id: (Optional) A specific session identifier.
add(content, role, ...): Stores a new memory episode.search(query, ...): Semantically searches for relevant memories.delete(): Deletes memories matching specific criteria.

