Skip to main content
Client utilities for interacting with the MemMachine HTTP API.

Class MemMachineClient

Main client class for interacting with MemMachine memory system. This client provides a high-level interface for managing episodic and profile memory. It handles authentication and provides convenient methods for memory operations.
def MemMachineClient(api_key: str | None, base_url: str | None, timeout: int, max_retries: int)
Parameters
NameTypeDescription
api_key`strNone`-
base_url`strNone`-
timeoutint-
max_retriesint-

request

Make an HTTP request using the client’s session.
def request(method: str, url: str, timeout: int | None)
Parameters
NameTypeDescription
methodstrHTTP method (GET, POST, etc.)
urlstrRequest URL
timeout`intNone`Request timeout in seconds (uses client default if not provided) **kwargs: Additional arguments passed to requests.Session.request()
Returns Response object from the request Raises requests.RequestException: If the request fails

create_project

Create a new project in MemMachine.
def create_project(org_id: str, project_id: str, description: str, embedder: str, reranker: str, timeout: int | None)
Parameters
NameTypeDescription
org_idstrOrganization identifier (required)
project_idstrProject identifier (required)
descriptionstrOptional description for the project (default: "")
embedderstrEmbedder model name to use (default: “default”)
rerankerstrReranker model name to use (default: “default”)
timeout`intNone`Request timeout in seconds (uses client default if not provided)
Returns Project instance representing the created project Raises requests.RequestException: If the request fails RuntimeError: If the client has been closed

get_project

Get an existing project from MemMachine.
def get_project(org_id: str, project_id: str, timeout: int | None)
Parameters
NameTypeDescription
org_idstrOrganization identifier (required)
project_idstrProject identifier (required)
timeout`intNone`Request timeout in seconds (uses client default if not provided)
Returns Project instance representing the project Raises requests.RequestException: If the request fails RuntimeError: If the client has been closed

health_check

Check the health status of the MemMachine server.
def health_check(timeout: int | None)
Parameters
NameTypeDescription
timeout`intNone`Request timeout in seconds (uses client default if not provided)
Returns Dictionary containing health status information Raises requests.RequestException: If the health check fails

close

Close the client and clean up resources.
def close()
Parameters
NameTypeDescription

session

Expose the underlying requests session for advanced usage.
def session()
Parameters
NameTypeDescription

closed

Check if the client has been closed.
def closed()
Parameters
NameTypeDescription