Mem0

Learn how to use Mem0 with Composio

Overview

SLUG: MEM0

Description

Mem0 assists with AI-driven note-taking, knowledge recall, and productivity tools, allowing users to organize, search, and generate content from stored information

Authentication Details

generic_api_key
stringRequired

Connecting to Mem0

Create an auth config

Use the dashboard to create an auth config for the Mem0 toolkit. This allows you to connect multiple Mem0 accounts to Composio for agents to use.

1

Select App

Navigate to Mem0.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Mem0 Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using API Key

1from composio import Composio
2
3# Replace these with your actual values
4mem0_auth_config_id = "ac_YOUR_MEM0_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/app
6
7composio = Composio()
8
9def authenticate_toolkit(user_id: str, auth_config_id: str):
10 # Replace this with a method to retrieve an API key from the user.
11 # Or supply your own.
12 user_api_key = input("[!] Enter API key")
13
14 connection_request = composio.connected_accounts.initiate(
15 user_id=user_id,
16 auth_config_id=auth_config_id,
17 config={"auth_scheme": "API_KEY", "val": user_api_key}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Mem0 for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, mem0_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Mem0 toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["MEM0"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Add new memory records

Description

Stores new memory records from a list of messages, optionally inferring structured content; requires association via `agent id`, `user id`, `app id`, or `run id`.

Action Parameters

agent_id
string
app_id
string
excludes
string
includes
string
infer
booleanDefaults to True
messages
arrayRequired
org_id
string
org_name
string
output_format
string
project_id
string
project_name
string
run_id
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add organization member

Description

Adds a new member, who must be a registered user, to an organization, assigning them a specific role.

Action Parameters

email
stringRequired
org_id
stringRequired
role
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create a new organization entry

Description

Creates a new organization entry using the provided name and returns its details.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create project

Description

Creates a new project with a given name within an organization that must already exist.

Action Parameters

name
stringRequired
org_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete memories

Description

Deletes memories matching specified filter criteria; omitting all filters may result in deleting all memories.

Action Parameters

agent_id
string
app_id
string
metadata
object
org_id
string
org_name
string
project_id
string
project_name
string
run_id
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Perform semantic search on memories

Description

Searches memories semantically using a natural language query (required if `only metadata based search` is false) and/or metadata filters.

Action Parameters

agent_id
string
app_id
string
categories
array
fields
array
filter_memories
boolean
only_metadata_based_search
boolean
org_id
string
org_name
string
output_format
string
project_id
string
project_name
string
query
stringRequired
rerank
boolean
run_id
string
top_k
integerDefaults to 10
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve memory by id

Description

Retrieves a complete memory entry by its unique identifier; `memory id` must be valid and for an existing memory.

Action Parameters

memory_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Search memories with filters

Description

Semantically searches memories using a natural language query and mandatory structured filters, offering options to rerank results and select specific fields; any provided `org id` or `project id` must reference a valid existing entity.

Action Parameters

fields
array
filters
objectRequired
org_id
string
org_name
string
project_id
string
project_name
string
query
stringRequired
rerank
boolean
top_k
integerDefaults to 10

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add member to project

Description

Adds an existing user to a project (identified by `project id` within organization `org id`), assigning a valid system role.

Action Parameters

org_id
stringRequired
project_id
stringRequired
role
stringRequired
username
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create an export job with schema

Description

Initiates an asynchronous job to export memories, structured by a schema provided in the request body and allowing optional filters.

Action Parameters

app_id
string
org_id
string
project_id
string
run_id
string
session_id
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create a new agent

Description

Creates a new agent with a unique `agent id` and an optional `name`; additional metadata may be assigned by the system.

Action Parameters

agent_id
stringRequired
name
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create a new agent run

Description

Creates a new agent run in the mem0.ai system.

Action Parameters

name
string
run_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create a new application

Description

Creates a new application, allowing metadata to be passed in the request body (not an explicit field in this action's request model); ensure `app id` is unique to avoid potential errors or unintended updates.

Action Parameters

app_id
stringRequired
name
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create a new user

Description

Creates a new user with the specified unique `user id` and supports associating `metadata` (not part of the request schema fields).

Action Parameters

user_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create memory entry

Description

Lists/searches existing memory entries with filtering and pagination; critically, this action retrieves memories and does *not* create new ones, despite its name.

Action Parameters

filters
object
org_id
string
org_name
string
page
integer
page_size
integer
project_id
string
project_name
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete an organization

Description

Permanently deletes an existing organization identified by its unique id.

Action Parameters

org_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete memory by id

Description

Permanently deletes a specific memory by its unique id; ensure the `memory id` exists as this operation is irreversible.

Action Parameters

memory_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete entity by type and id

Description

Call to permanently and irreversibly hard-delete an existing entity (user, agent, app, or run) and all its associated data, using its type and id.

Action Parameters

entity_id
stringRequired
entity_type
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete memory batch with uuids

Description

Deletes a batch of up to 1000 existing memories, identified by their uuids, in a single api call.

Action Parameters

memory_ids
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete project

Description

Permanently deletes a specific project and all its associated data from an organization; this action cannot be undone and requires the project to exist within the specified organization.

Action Parameters

org_id
stringRequired
project_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete project member

Description

Removes an existing member, specified by username, from a project, immediately revoking their project-specific access; the user is not removed from the organization.

Action Parameters

org_id
stringRequired
project_id
stringRequired
username
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Export data based on filters

Description

Retrieves memory export data, optionally filtered by various identifiers (e.g., user id); without filters, it may return all accessible or recent exports based on default behavior.

Action Parameters

app_id
string
org_id
string
project_id
string
run_id
string
session_id
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List organizations

Description

Retrieves a summary list of organizations for administrative oversight; returns summary data (names, ids), not exhaustive details, despite 'detailed' in the name.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Fetch details of a specific organization

Description

Fetches comprehensive details for an organization using its `org id`; the `org id` must be valid and for an existing organization.

Action Parameters

org_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get list of entity filters

Description

Retrieves predefined filter definitions for entities (e.g., by type, creation/modification date); returns definitions only, not filtered entity data.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get entity by id

Description

Fetches detailed information for an existing entity (user, agent, app, or run) identified by its type and unique id.

Action Parameters

entity_id
stringRequired
entity_type
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get organization members

Description

Fetches a list of members for a specified, existing organization.

Action Parameters

org_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get projects

Description

Retrieves all projects for a given organization `org id` to which the caller has access.

Action Parameters

org_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get project details

Description

Fetches comprehensive details for a specified project within an organization.

Action Parameters

org_id
stringRequired
project_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get project members

Description

Retrieves all members for a specified project within an organization.

Action Parameters

org_id
stringRequired
project_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get user memory stats

Description

Retrieves a summary of the authenticated user's memory activity, including total memories created, search events, and add events.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List entities

Description

Retrieves a list of entities, optionally filtered by organization or project (prefer `org id`/`project id` over deprecated `org name`/`project name`), noting results may be summaries and subject to limits.

Action Parameters

org_id
string
org_name
string
project_id
string
project_name
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Remove a member from the organization

Description

Removes a member, specified by their username, from an existing organization of which they are currently a member.

Action Parameters

org_id
stringRequired
username
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve all events for the currently logged in user

Description

Retrieves a paginated list of events for the authenticated user, filterable and paginable via url query parameters. this is a read-only operation that does not modify data. supported query parameters (applied directly to the request url): - `event type` (str, optional): filters events by their type (e.g., 'add', 'search'). - `start date` (str, optional): filters events on or after this date (format: yyyy-mm-dd). - `end date` (str, optional): filters events on or before this date (format: yyyy-mm-dd). - `page` (int, optional): specifies the page number for paginated results. - `page size` (int, optional): number of events per page (default: 50, max: 100).

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve entity-specific memories

Description

Retrieves all memories (e.g., user preferences, chat history) for a specific entity from the mem0 platform, using its `entity type` and `entity id`; ensure the entity exists.

Action Parameters

entity_id
stringRequired
entity_type
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve list of memory events

Description

Retrieves a chronological list of all memory events (e.g., user inputs, ai responses) from the mem0 platform, providing interaction history and context for ai assistants.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve memory history by id

Description

Retrieves the complete version history for an existing memory, using its unique `memory id`, to inspect its evolution or audit changes.

Action Parameters

memory_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve memory list

Description

Retrieves a list of memories, supporting pagination and diverse filtering (e.g., by ids, metadata, keywords, date ranges); ensure dates are iso 8601 and `page`/`page size` (if used) are positive integers.

Action Parameters

agent_id
string
app_id
string
categories
array
end_date
string
fields
array
keywords
string
metadata
object
org_id
string
org_name
string
page
integer
page_size
integer
project_id
string
project_name
string
run_id
string
start_date
string
user_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update memory batch with uuid

Description

Updates text for up to 1000 memories in a single batch, using their uuids.

Action Parameters

memories
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update memory text content

Description

Updates the text content of an existing memory, identified by its `memory id`.

Action Parameters

memory_id
stringRequired
text
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update organization member role

Description

Updates the role of an existing member to a new valid role within an existing organization.

Action Parameters

org_id
stringRequired
role
stringRequired
username
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update project

Description

Updates a project by `project id` within an `org id`, modifying only provided fields (name, description, custom instructions, custom categories); list fields are fully replaced (cleared by `[]`), other omitted/null fields remain unchanged.

Action Parameters

custom_categories
array
custom_instructions
array
description
string
name
string
org_id
stringRequired
project_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update project member role

Description

Updates the role of a specific member within a designated project, ensuring the new role is valid and recognized by the system.

Action Parameters

org_id
stringRequired
project_id
stringRequired
role
stringRequired
username
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired