Mem0's get_all() returns data in format {"results": [...]}, not a direct list.
Also, agent_id is at the top level of each memory, not in metadata.
Changes:
- Add _extract_memories_from_response() to handle both new and old response formats
- Add _check_agent_id_match() to check agent_id at both top-level and in metadata
- Update get_all_memories, delete_memory, delete_all_memories to use new helpers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mem0's get_all() method may return a list containing either strings
(older version format) or dictionaries (newer version format). This
fix adds proper type checking to handle both cases gracefully.
- get_all_memories: Skip string items, only process dict items
- delete_memory: Add type checking before accessing dict methods
- delete_all_memories: Add type checking before accessing dict methods
Fixes: 'str' object has no attribute 'get' error
Co-authored-by: zhuchao <zhuchaowe@163.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
- Replace ShellMiddleware with LocalShellBackend
- Update AgentMemoryMiddleware to MemoryMiddleware with new signature
- Update CustomSkillsMiddleware to use new SkillsMiddleware signature
- Add LocalContextMiddleware for local context
- Update CompositeBackend to use routing
- Update dependencies: langgraph-checkpoint-postgres to 3.0.4
Breaking Changes:
- agent/deep_assistant.py: Major refactoring to adapt to new deepagents API
- pyproject.toml: Version bump
- deepagents: 0.2.8 -> 0.4.3
- deepagents-cli: 0.0.11 -> 0.0.25
- langgraph-checkpoint-postgres: 2.0.25 -> 3.0.4 (for compatibility with langgraph-checkpoint 3.x)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: add .worktrees/ to .gitignore
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(memory): add memory management API endpoints
Add new /api/v1/memory endpoints for viewing and managing user memories:
- GET /api/v1/memory - list all memories for a bot
- DELETE /api/v1/memory/{memory_id} - delete single memory
- DELETE /api/v1/memory - delete all memories for a bot
Also add delete_memory and delete_all_memories methods to Mem0Manager.
Issue: #1844
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: zhuchao <zhuchaowe@163.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Add db_url property to MemoriManager that falls back to
CHECKPOINT_DB_URL setting, and pass it explicitly from
fastapi_app.py to ensure Memori can create sync connections.
This fixes the error "Either db_pool or db_url must be provided"
when recalling memories.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Move init_global_memori from deep_assistant.py to fastapi_app.py
lifespan function for proper application-level initialization.
This ensures Memori is initialized once at startup and closed at
shutdown, rather than checking and potentially initializing on every
agent creation.
Changes:
- fastapi_app.py: Add Memori init/close in lifespan
- deep_assistant.py: Simplify to only get memori_manager
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Remove __debug__ conditional that exposed tracebacks in production
- Simplify error response structure to {"error": str(e)}
- Remove redundant exception handling in init_agent()
- Remove unnecessary traceback logging
- Reduce code from ~30 lines to ~10 lines
Fixes security vulnerability where __debug__ is always True
unless Python runs with -O flag, causing full tracebacks
to be sent to clients in production.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Enhance exception handling in agent_task() to capture and send structured error messages via SSE stream
- Add [DONE] marker to outer exception handler to ensure proper stream termination
- Improve MCP tool loading error handling in init_agent() to prevent cascading failures
- Add detailed error logging with traceback for debugging
Fixes RemoteProtocolError that occurred when MCP tool calls failed,
which previously caused incomplete chunked read errors and connection drops.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>