mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

Protobuf version constraint prevents deployment with LangGraph Cloud and langgraph-api

Open chelouche9 opened this issue 1 month ago • 1 comments

🐛 Describe the bug

Description

The current protobuf version constraint in mem0ai (protobuf>=5.29.0,<6.0.0) creates an incompatibility with LangGraph deployments, which require protobuf>=6.32.1. This prevents mem0ai from being used in production LangGraph Cloud deployments.

Environment

  • mem0ai version: 1.0.0
  • Python version: 3.11.9
  • Deployment platform: LangGraph Cloud
  • Conflicting package: langgraph-api 0.5.7

The Problem

Current Constraint (mem0ai 1.0.0)

protobuf>=5.29.0,<6.0.0

Required by LangGraph

langgraph-api==0.5.7 requires protobuf>=6.32.1,<7.0.0
grpcio-tools>=1.75.0 requires protobuf>=6.31.1,<7.0.0

Result

Dependency resolution fails during deployment:

× No solution found when resolving dependencies:
  ╰─▶ Because only mem0ai<=1.0.0 is available and mem0ai==1.0.0 depends on
      protobuf>=5.29.0,<6.0.0, we can conclude that mem0ai>=1.0.0 depends on
      protobuf>=5.29.0,<6.0.0.
      And because stacey==0.3.1 depends on mem0ai>=1.0.0 and
      protobuf>=6.32.1,<7.0.0, we can conclude that stacey==0.3.1 cannot be
      used.

Impact

Who Is Affected

  • LangGraph users: Cannot use mem0ai in LangGraph Cloud deployments
  • LangChain users: Similar issues in production environments requiring protobuf 6.x
  • Any async framework: Using langgraph-api, grpcio-tools, or other packages requiring protobuf 6.x

Deployment Environments

  • LangGraph Cloud - Strict dependency resolution fails build
  • Docker containers - Dependency conflicts prevent installation
  • ⚠️ Local development - Works but shows warnings
  • CI/CD pipelines - Automated deployments fail

Why This Matters

1. LangGraph is Growing

LangGraph is becoming the standard for production AI agent deployments. The incompatibility locks out a significant user base.

2. Protobuf 6.x is the New Standard

Google's protobuf library has moved to version 6.x (current: 6.33.0). Most modern gRPC-based tools now require it:

  • grpcio>=1.75.0 → requires protobuf 6.x
  • langgraph-api>=0.5.0 → requires protobuf 6.x
  • Future versions will increasingly adopt this

3. The Constraint is Unnecessary

Mem0ai doesn't actually use protobuf in its core functionality. It's only a transitive dependency through:

  • qdrant-client (vector database)
  • Possibly grpcio (if used)

The HTTP API client (which is what users actually interact with) has no protobuf dependency.

Verification That Protobuf 6.x Works

We've tested mem0ai with protobuf 6.33.0 in local development:

$ pip list | grep -E "(mem0|protobuf)"
mem0ai           1.0.0
protobuf         6.33.0

$ python -c "from mem0 import AsyncMemoryClient; print('✓ Works')"
✓ Works

Result: Everything works perfectly. The HTTP API functions correctly despite the version warning.

Suggested Fix

Update the protobuf constraint in mem0ai to support both major versions:

Option 1: Wide Range (Recommended)

# In mem0ai's pyproject.toml or setup.py
"protobuf>=5.29.0,<7.0.0"  # Support both 5.x and 6.x

Option 2: Protobuf 6+ Only

"protobuf>=6.31.1,<7.0.0"  # Move to protobuf 6.x

Testing

Please test with:

  • protobuf 5.29.0 (current minimum)
  • protobuf 6.33.0 (latest 6.x)
  • protobuf 6.31.1 (minimum for LangGraph)

All should work fine since mem0 uses HTTP APIs, not protobuf serialization.

Workarounds (Current)

Since mem0ai can't be deployed, users have to:

1. Use HTTP API Directly

Bypass the SDK entirely and call the REST API using httpx:

import httpx

class Mem0HttpClient:
    def __init__(self, api_key: str):
        self.client = httpx.AsyncClient(base_url="https://api.mem0.ai")
        self.headers = {"Authorization": f"Token {api_key}"}
    
    async def add(self, messages, user_id, **kwargs):
        response = await self.client.post(
            "/v1/memories/",
            json={"messages": messages, "user_id": user_id, **kwargs},
            headers=self.headers
        )
        return response.json()
    
    async def search(self, query, filters, **kwargs):
        response = await self.client.post(
            "/v2/memories/search/",
            json={"query": query, "filters": filters, **kwargs},
            headers=self.headers
        )
        return response.json()

This works but defeats the purpose of having an SDK.

2. Force Install (Not Production-Safe)

pip install --no-deps mem0ai
pip install <all mem0 dependencies manually>

This is fragile and not suitable for automated deployments.

3. Fork and Patch

Fork mem0ai and modify the protobuf constraint locally. Not sustainable.

References

  • LangGraph Deployments: https://docs.langchain.com/langgraph-platform/
  • Protobuf 6.x Migration: https://protobuf.dev/support/cross-version-runtime-guarantee/
  • Related Issue: (Link to any existing protobuf-related issues if found)

Related Dependencies

For reference, here are mem0ai's dependencies that might be affected:

# Current mem0ai dependencies
openai>=1.90.0
posthog>=3.5.0
protobuf>=5.29.0,<6.0.0  # ← THE ISSUE
pydantic>=2.7.3
pytz>=2024.1
qdrant-client>=1.9.1
sqlalchemy>=2.0.31

Only qdrant-client potentially uses protobuf (for gRPC vector search). All other functionality is HTTP-based.

Proposed Timeline

This is blocking production deployments for LangGraph users. A patch release with updated protobuf constraints would be greatly appreciated.

Suggested version: mem0ai==1.0.1 with protobuf>=5.29.0,<7.0.0

Additional Context

Why We Need This

We're building an AI agent platform on LangGraph that needs:

  • Long-term memory across conversations (mem0's core value prop)
  • Production deployment on LangGraph Cloud
  • Session-scoped and user-scoped memories

Currently, we've had to implement a custom HTTP client to work around this limitation. We'd love to use the official SDK once the protobuf constraint is updated.

Test Case

To verify the fix works, test this installation sequence:

# Fresh environment
python -m venv test_env
source test_env/bin/activate

# Install langgraph-api first (gets protobuf 6.x)
pip install langgraph-api==0.5.7

# Then install mem0ai (should work with updated constraint)
pip install mem0ai==1.0.1  # Future version

# Verify no conflicts
pip check

# Test functionality
python -c "from mem0 import AsyncMemoryClient; print('✓ Compatible!')"

Thank You!

Thank you for considering this fix. Mem0 is a fantastic tool and updating this constraint will make it accessible to the growing LangGraph ecosystem. Happy to provide more details or test pre-release versions if helpful!

chelouche9 avatar Nov 07 '25 21:11 chelouche9

Hey @chelouche9 thanks for reporting this let me add this to timeline!

parthshr370 avatar Nov 12 '25 13:11 parthshr370