Simple Hello World Example
Hello World Example
This example demonstrates how to connect to the server, create a project, and add/retrieve memories.Ensure your MemMachine server is running (see Quickstart Guide) before running this code.
Key Concepts
Client (MemMachineClient)
The entry point for the SDK. It manages the HTTP connection to the MemMachine server.
Project (Project)
Represents a workspace within MemMachine. All memories are isolated within a project. You can create new projects or retrieve existing ones.
Memory (Memory)
The interface for adding and retrieving memories. It is context-aware, meaning you initialize it with specific identifiers:
- user_id: The ID of the human user.
- agent_id: The ID of the AI agent.
- session_id: (Optional) A specific conversation session ID.
- group_id: (Optional) For multi-user/multi-agent groups.
memory.add() or memory.search(), these identifiers are automatically attached to the operations.
