Memory

class pipecat.services.mem0.memory.Mem0MemoryService(*, api_key=None, local_config=None, user_id=None, agent_id=None, run_id=None, params=None)[source]

Bases: FrameProcessor

A standalone memory service that integrates with Mem0.

This service intercepts message frames in the pipeline, stores them in Mem0, and enhances context with relevant memories before passing them downstream.

Parameters:
  • api_key (str) – The API key for accessing Mem0’s API

  • user_id (str) – The user ID to associate with memories in Mem0

  • params (InputParams, optional) – Configuration parameters for memory retrieval

  • local_config (Dict[str, Any] | None)

  • agent_id (str | None)

  • run_id (str | None)

class InputParams(*, search_limit=10, search_threshold=0.1, api_version='v2', system_prompt='Based on previous conversations, I recall: \n\n', add_as_system_message=True, position=1)[source]

Bases: BaseModel

Parameters:
  • search_limit (int)

  • search_threshold (float)

  • api_version (str)

  • system_prompt (str)

  • add_as_system_message (bool)

  • position (int)

search_limit: int
search_threshold: float
api_version: str
system_prompt: str
add_as_system_message: bool
position: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

async process_frame(frame, direction)[source]

Process incoming frames, intercept context frames for memory integration.

Parameters:
  • frame (Frame) – The incoming frame to process

  • direction (FrameDirection) – The direction of frame flow in the pipeline