Migrate Zep Cloud integration from v2 to v3 API#1122
Migrate Zep Cloud integration from v2 to v3 API#1122rapids-bot[bot] merged 7 commits intoNVIDIA:developfrom
Conversation
Updates the Zep Cloud plugin to use the new v3 API with significant architectural changes from session-based to thread-based memory management. Breaking changes: - Dependency updated from zep-cloud~=2.2.0 to zep-cloud~=3.0 - Session-based APIs replaced with thread-based APIs - Memory operations now use conversation_id from NAT context as thread_id Key changes to ZepEditor: - add_items(): Uses thread.add_messages() instead of memory.add() - Automatic user creation with _ensure_user_exists() - Message API changed from role_type to role parameter - Thread creation/existence handling with robust error handling - Support for ignore_roles parameter (e.g., exclude assistant messages) - search(): Uses thread.get_user_context() instead of memory.search_sessions() - Returns pre-formatted context from Zep's knowledge graph - Supports "basic" (fast) and "summary" (comprehensive) modes - Context optimized for LLM consumption with facts and timestamps - remove_items(): Uses thread.delete() instead of memory.delete() - Changed parameter from session_id to thread_id Multi-thread support: - Thread IDs sourced from Context.get().conversation_id - Enables isolated memory per UI conversation - Fallback to "default_zep_thread" when no context available New examples: - examples/memory/zep/ with basic and advanced configurations - Integration tests for both workflow types - Documentation covering installation, usage, and Zep-specific parameters 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: jackaldenryan <jackaldenryan@gmail.com>
WalkthroughBumps Changes
Sequence DiagramsequenceDiagram
participant Caller
participant ZepEditor
participant ZepAPI as Zep v3 API
rect rgb(230,245,255)
note right of Caller: add_items(items, **kwargs)
Caller->>ZepEditor: add_items(items, **kwargs)
ZepEditor->>ZepEditor: _ensure_user_exists(user_id)\nderive thread_id from Context or default
ZepEditor->>ZepAPI: thread.create(thread_id, user_id) (handle 409)
ZepAPI-->>ZepEditor: thread or 409
ZepEditor->>ZepAPI: thread.add_messages(messages, ignore_roles?)
ZepAPI-->>ZepEditor: ack
end
rect rgb(235,255,235)
note right of Caller: search(user_id, thread_id, mode)
Caller->>ZepEditor: search(user_id=..., thread_id=..., mode=...)
ZepEditor->>ZepAPI: thread.get_user_context(thread_id, mode)
ZepAPI-->>ZepEditor: formatted context
ZepEditor->>Caller: MemoryItem(with metadata: mode, thread_id)
end
rect rgb(255,240,240)
note right of Caller: remove_items(thread_id OR user_id)
Caller->>ZepEditor: remove_items(thread_id=... OR user_id=...)
alt delete specific thread
ZepEditor->>ZepAPI: thread.delete(thread_id)
ZepAPI-->>ZepEditor: deletion result / error
else delete all user threads
ZepEditor->>ZepAPI: thread.list(user_id) -> for each: thread.delete(...)
ZepAPI-->>ZepEditor: deletions results
end
ZepEditor->>Caller: ack / error
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Areas needing extra attention:
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Update uv.lock to resolve conflicts with recent dependency updates from develop branch including fastapi v0.120.1 and other packages. Regenerated uv.lock with zep-cloud v3.8.0 to ensure compatibility with both the Zep v3 migration and the latest develop changes.
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/nvidia_nat_zep_cloud/pyproject.toml (1)
1-1: Add SPDX header to TOML file.All {**/*.toml} must start with the SPDX Apache-2.0 header. Add the header and keep years current (2024–2025).
Apply:
+# SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + [build-system]As per coding guidelines.
🧹 Nitpick comments (5)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (5)
16-17: Add a module docstring.Provide a concise Google‑style module docstring.
Apply:
from __future__ import annotations +"""Zep Cloud v3 memory editor for nat plugin. Implements thread-based memory operations against AsyncZep.""" + import asyncioAs per coding guidelines.
33-35: Use “nat” in code comments/docstrings, not “NAT”.Per repo convention, use “nat” for API namespace; reserve “NAT” for env var prefixes.
Apply:
- Wrapper class that implements NAT interfaces for Zep v3 Integrations Async. + Wrapper class that implements nat interfaces for Zep v3 asynchronous integrations. - Uses thread-based memory management with automatic user creation. + Uses thread-based memory management with automatic user creation.As per coding guidelines.
81-90: Minor: include thread_id in logs for traceability.Add thread_id to add_messages/creation logs for easier debugging.
Example:
-logger.info("Ensuring Zep thread exists") +logger.info("Ensuring Zep thread exists (thread_id=%s)", thread_id) @@ -logger.info(f"Queueing add_messages for thread with {len(messages)} messages") +logger.info("Queueing add_messages (thread_id=%s, count=%d)", thread_id, len(messages))Operational hygiene.
Also applies to: 118-121, 139-147
110-116: Harden message construction against missing keys.Guard against absent content/role to avoid KeyError.
Apply:
- for msg in conversation: - # Create Message - role field instead of role_type in V3 - message = Message(content=msg["content"], role=msg["role"]) - messages.append(message) + for msg in conversation: + content = msg.get("content") + role = msg.get("role") + if not content or not role: + continue + messages.append(Message(content=content, role=role))Defensive coding.
Also applies to: 117-121
78-90: Tests needed for v3 flows (user/thread lifecycle).Please add tests covering: user not found → create; thread already exists (409); add_messages with ignore_roles; search 404 path; remove_items missing thread_id.
I can scaffold pytest + httpx/AsyncZep fakes if helpful.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
packages/nvidia_nat_zep_cloud/pyproject.toml(1 hunks)packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
packages/*/pyproject.toml
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
packages/*/pyproject.toml: Each package under packages/ must contain a pyproject.toml
packages/*/pyproject.toml must declare a dependency on nvidia-nat or a package starting with nvidia-nat-
Dependencies in pyproject.toml should use ~= with two-digit versions (e.g., ~=1.0)
Files:
packages/nvidia_nat_zep_cloud/pyproject.toml
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)
Files:
packages/nvidia_nat_zep_cloud/pyproject.tomlpackages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{**/pyproject.toml,uv.lock}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
New dependencies must be added to both pyproject.toml (alphabetically) and uv.lock via ‘uv pip install --sync’
Files:
packages/nvidia_nat_zep_cloud/pyproject.toml
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
packages/nvidia_nat_zep_cloud/pyproject.tomlpackages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_zep_cloud/pyproject.tomlpackages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{src/**/*.py,packages/*/src/**/*.py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{src/**/*.py,packages/*/src/**/*.py}: All importable Python code must live under src/ or packages//src/
All public APIs must have Python 3.11+ type hints on parameters and return values
Prefer typing/collections.abc abstractions (e.g., Sequence over list)
Use typing.Annotated for units or metadata when useful
Treat pyright warnings as errors during development
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/*/src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
If a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧬 Code graph analysis (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (2)
src/nat/builder/context.py (2)
Context(117-315)conversation_id(185-192)packages/nvidia_nat_mem0ai/src/nat/plugins/mem0ai/mem0_editor.py (3)
add_items(44-69)search(71-103)remove_items(105-115)
🪛 Ruff (0.14.2)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
58-58: Do not catch blind exception: Exception
(BLE001)
74-74: Do not catch blind exception: Exception
(BLE001)
128-128: Do not catch blind exception: Exception
(BLE001)
150-150: Unused method argument: query
(ARG002)
150-150: Unused method argument: top_k
(ARG002)
215-215: Avoid specifying long messages outside the exception class
(TRY003)
🔇 Additional comments (1)
packages/nvidia_nat_zep_cloud/pyproject.toml (1)
24-24: Dep bump looks right; sync the lockfile.zep-cloud is correctly updated to ~=3.0 and dependencies remain alphabetized. Please also update uv.lock and verify resolution.
Run:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
Outdated
Show resolved
Hide resolved
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
Outdated
Show resolved
Hide resolved
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
Outdated
Show resolved
Hide resolved
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
Outdated
Show resolved
Hide resolved
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
Outdated
Show resolved
Hide resolved
|
/ok to test f3728d0 |
@willkill07, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
Improves code quality, exception handling, and API consistency based on
CodeRabbit review comments.
Key improvements:
- Add return type annotations (-> None) to __init__ and remove_items
- Replace broad Exception catches with specific Zep SDK exceptions
(NotFoundError, ApiError) with proper status code checking
- Optimize add_items with tracking sets to prevent redundant API calls
for user/thread creation
- Add user_id validation with fallback to "default_user"
- Improve logging: use debug for routine checks, structured logging with
context parameters
- Fix remove_items to support both thread_id and user_id parameters
- When user_id provided: deletes all threads for that user using
client.user.get_threads() and parallel deletion
- When thread_id provided: deletes specific thread
- Fixes bug where delete_memory_tool passes user_id but old
implementation only accepted thread_id
- Add noqa: ARG002 to search method for unused interface parameters
- Add validation for required user_id in search method
- Simplify user creation: only set email/names for "default_user",
otherwise just pass user_id (fields not required by Zep API)
All ruff checks pass. Implementation now matches patterns from other
memory providers (Mem0Editor, RedisEditor) for consistency.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: jackaldenryan <jackaldenryan@gmail.com>
5d35ba2 to
f803d3f
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (1)
237-246: Accept conversation_id alias and enforce mutual exclusivity.Align public interface with prior feedback; reject both args set at once.
Apply:
- if "thread_id" in kwargs: + # Alias for public interface + if "conversation_id" in kwargs and "thread_id" not in kwargs: + kwargs["thread_id"] = kwargs.pop("conversation_id") + + if "thread_id" in kwargs and "user_id" in kwargs: + raise ValueError("Provide only one of thread_id or user_id.") + + if "thread_id" in kwargs:
🧹 Nitpick comments (5)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (5)
131-134: Defensive role mapping (support legacy role_type).Avoid KeyError and ease transition by falling back to role_type.
Apply:
- for msg in conversation: - # Create Message - role field instead of role_type in V3 - message = Message(content=msg["content"], role=msg["role"]) + for msg in conversation: + # Create Message - prefer v3 'role', fallback to legacy 'role_type' + role = msg.get("role") or msg.get("role_type") or "user" + content = msg.get("content", "") + message = Message(content=content, role=role) messages.append(message)
112-118: Compute thread_id once; minor clarity/perf.Context doesn’t change inside the loop; move thread_id derivation above it.
Apply:
- # Iteratively insert memories into Zep using threads - for memory_item in items: - conversation = memory_item.conversation - user_id = memory_item.user_id or "default_user" # Validate user_id - - # Get thread_id from NAT context (unique per UI conversation) - thread_id = Context.get().conversation_id - - # Fallback to default thread ID if no conversation_id available - if not thread_id: - thread_id = "default_zep_thread" + # Resolve thread id once per batch + thread_id = Context.get().conversation_id or "default_zep_thread" + + # Iteratively insert memories into Zep using threads + for memory_item in items: + conversation = memory_item.conversation + user_id = memory_item.user_id or "default_user"Also applies to: 155-165
35-37: Avoid “NAT” abbreviation in docstrings; spell out product name.Guideline: do not use these abbreviations in documentation. Replace with “NeMo Agent Toolkit” or “the toolkit”.
Example:
-Wrapper class that implements NAT interfaces for Zep v3 Integrations Async. +Wrapper class that implements NeMo Agent Toolkit interfaces for Zep v3 integrations (async). @@ -Uses conversation_id from NAT context as thread_id for multi-thread support. +Uses conversation_id from the toolkit context as thread_id for multi-thread support. @@ -Uses conversation_id from NAT context as thread_id for multi-thread support. +Uses conversation_id from the toolkit context as thread_id for multi-thread support.As per coding guidelines.
Also applies to: 91-93, 169-171
262-262: Shorten ValueError message (TRY003).Trim message per ruff.
Apply:
- raise ValueError("Either thread_id or user_id is required.") + raise ValueError("thread_id or user_id required.")
87-99: Prefer Sequence for input collections.Use read-only abstractions for parameters.
Apply:
-from __future__ import annotations +from __future__ import annotations @@ -from zep_cloud.types import Message +from zep_cloud.types import Message +from collections.abc import Sequence @@ - async def add_items(self, items: list[MemoryItem], **kwargs) -> None: + async def add_items(self, items: Sequence[MemoryItem], **kwargs) -> None:As per coding guidelines.
Also applies to: 16-26
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{src/**/*.py,packages/*/src/**/*.py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{src/**/*.py,packages/*/src/**/*.py}: All importable Python code must live under src/ or packages//src/
All public APIs must have Python 3.11+ type hints on parameters and return values
Prefer typing/collections.abc abstractions (e.g., Sequence over list)
Use typing.Annotated for units or metadata when useful
Treat pyright warnings as errors during development
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/*/src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
If a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧬 Code graph analysis (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (2)
src/nat/builder/context.py (2)
Context(118-316)conversation_id(186-193)packages/nvidia_nat_mem0ai/src/nat/plugins/mem0ai/mem0_editor.py (3)
add_items(44-69)search(71-103)remove_items(105-115)
🪛 Ruff (0.14.2)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
81-81: Use logging.exception instead of logging.error
Replace with exception
(TRY400)
84-84: Use logging.exception instead of logging.error
Replace with exception
(TRY400)
148-148: Use logging.exception instead of logging.error
Replace with exception
(TRY400)
188-188: Avoid specifying long messages outside the exception class
(TRY003)
221-221: Use logging.exception instead of logging.error
Replace with exception
(TRY400)
262-262: Avoid specifying long messages outside the exception class
(TRY003)
🔇 Additional comments (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (1)
39-45: Constructor typing/docstring look good.Explicit return type and concise docstring comply with guidelines.
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
Outdated
Show resolved
Hide resolved
Addresses additional CodeRabbit review feedback for better error
handling and reduced PII exposure in logs.
Critical bug fixes:
- Fix ApiError.status_code access: use e.response_data.get("status_code")
instead of e.status_code (which doesn't exist on ApiError objects)
- Affects conflict detection (409) in _ensure_user_exists and add_items
- Without this fix, 409 conflicts would not be properly detected
- Change logger.error to logger.exception when swallowing errors
(thread creation failures) to capture full traceback
Documentation improvements:
- Remove "norole" from ignore_roles documentation (not a valid role)
- Valid roles are: system, assistant, user, function, tool
Logging improvements:
- Reduce PII exposure: change user_id logging from info to debug level
- Remove user_id from final deletion log message
- Add noqa: TRY400 to logger.error calls that re-raise per policy
All ruff checks pass.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: jackaldenryan <jackaldenryan@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (1)
65-71: Remove realistic PII for the default_user.Use a non-deliverable domain and neutral names to avoid storing PII.
Apply:
- email = "jane.doe@example.com" - first_name = "Jane" - last_name = "Doe" - await self._client.user.add( - user_id=user_id, email=email, first_name=first_name, last_name=last_name - ) + email = "default_user@users.invalid" + await self._client.user.add( + user_id=user_id, email=email, first_name="User", last_name="Default" + )
🧹 Nitpick comments (7)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (7)
91-92: Avoid “NAT” abbreviation in docstrings (docs policy).Replace “NAT context” with “NeMo Agent Toolkit context”.
Apply:
- Uses conversation_id from NAT context as thread_id for multi-thread support. + Uses conversation_id from the NeMo Agent Toolkit context as the thread_id for multi-thread support. @@ - Uses conversation_id from NAT context as thread_id for multi-thread support. + Uses conversation_id from the NeMo Agent Toolkit context as the thread_id for multi-thread support.As per coding guidelines.
Also applies to: 170-171
87-101: Validate ignore_roles against allowed values.Prevent bad roles from reaching the SDK; fail fast with a clear error.
Apply:
+from collections.abc import Sequence @@ -class ZepEditor(MemoryEditor): +ALLOWED_ZEP_ROLES: set[str] = {"system", "assistant", "user", "function", "tool"} + +class ZepEditor(MemoryEditor): @@ - async def add_items(self, items: list[MemoryItem], **kwargs) -> None: + async def add_items(self, items: Sequence[MemoryItem], **kwargs) -> None: @@ - ignore_roles = kwargs.get("ignore_roles", None) + ignore_roles = kwargs.get("ignore_roles", None) + if ignore_roles is not None: + invalid = sorted(set(ignore_roles) - ALLOWED_ZEP_ROLES) + if invalid: + raise ValueError(f"invalid ignore_roles: {invalid}") @@ - add_messages_params = {"thread_id": thread_id, "messages": messages} + add_messages_params = {"thread_id": thread_id, "messages": messages} if ignore_roles is not None: add_messages_params["ignore_roles"] = ignore_rolesAs per coding guidelines (prefer Sequence over list).
Also applies to: 159-163
121-129: Avoid ensuring user when conversation is empty.Skip early; then ensure user only when needed.
Apply:
- # Ensure user exists before creating thread (only once per user) - if user_id not in ensured_users: - await self._ensure_user_exists(user_id) - ensured_users.add(user_id) - - # Skip if no conversation data - if not conversation: - continue + # Skip if no conversation data + if not conversation: + continue + + # Ensure user exists before creating thread (only once per user) + if user_id not in ensured_users: + await self._ensure_user_exists(user_id) + ensured_users.add(user_id)
131-134: Defensive parsing of message dicts.Guard against missing keys and unknown roles; drop invalid messages instead of raising.
Apply:
- for msg in conversation: - # Create Message - role field instead of role_type in V3 - message = Message(content=msg["content"], role=msg["role"]) - messages.append(message) + for msg in conversation: + role = msg.get("role") + content = msg.get("content") + if not role or not content: + logger.debug("Skipping message with missing role/content") + continue + if role not in ALLOWED_ZEP_ROLES: + logger.debug("Skipping message with invalid role=%s", role) + continue + messages.append(Message(content=content, role=role))
81-85: Log structured SDK error details.Prefer response_data over str(e) for ApiError.
Apply:
- logger.error("Failed creating Zep user: %s", str(e)) # noqa: TRY400 + logger.error("Failed creating Zep user: %s", getattr(e, "response_data", str(e))) # noqa: TRY400 @@ - logger.error("Failed fetching Zep user: %s", str(e)) # noqa: TRY400 + logger.error("Failed fetching Zep user: %s", getattr(e, "response_data", str(e))) # noqa: TRY400 @@ - logger.error("get_user_context failed (thread_id=%s): %s", thread_id, str(e)) # noqa: TRY400 + logger.error( + "get_user_context failed (thread_id=%s): %s", + thread_id, + getattr(e, "response_data", str(e)), + ) # noqa: TRY400Also applies to: 221-222
16-26: Add a concise module docstring.Public modules should have a Google‑style docstring summary.
Apply:
from __future__ import annotations import asyncio import logging + +""" +Zep Cloud v3 memory editor integration for the NeMo Agent Toolkit. + +Provides thread-based memory operations (ingest, search/context, delete) +using the AsyncZep client with user provisioning and minimal PII. +"""As per coding guidelines.
262-262: Trim ValueError messages to satisfy TRY003.Keep them short.
Apply:
- raise ValueError("user_id is required.") + raise ValueError("user_id required.") @@ - raise ValueError("Either thread_id or user_id is required.") + raise ValueError("thread_id or user_id required.")Also applies to: 188-189
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{src/**/*.py,packages/*/src/**/*.py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{src/**/*.py,packages/*/src/**/*.py}: All importable Python code must live under src/ or packages//src/
All public APIs must have Python 3.11+ type hints on parameters and return values
Prefer typing/collections.abc abstractions (e.g., Sequence over list)
Use typing.Annotated for units or metadata when useful
Treat pyright warnings as errors during development
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/*/src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
If a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧠 Learnings (1)
📚 Learning: 2025-10-22T22:02:12.903Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-10-22T22:02:12.903Z
Learning: Applies to **/*.py : When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
Applied to files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧬 Code graph analysis (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (2)
src/nat/builder/context.py (2)
Context(118-316)conversation_id(186-193)packages/nvidia_nat_mem0ai/src/nat/plugins/mem0ai/mem0_editor.py (3)
add_items(44-69)search(71-103)remove_items(105-115)
🪛 Ruff (0.14.2)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
188-188: Avoid specifying long messages outside the exception class
(TRY003)
262-262: Avoid specifying long messages outside the exception class
(TRY003)
🔇 Additional comments (2)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (2)
237-261: Good PII posture in logs.User identifiers are now logged at debug level and counts at info. Nice.
39-47: Constructor typing and setup look good.Return type annotation present and docstring concise.
|
/ok to test 81aa219 |
|
@jackaldenryan looks like formatting check has failed. If you can, install the pre-commit hooks and run all so we can get CI to run e2e |
- Fix yapf formatting for user.add() call in _ensure_user_exists - Update search() docstring to clarify user_id usage and mode defaults Addresses CI Pipeline / Check failure and latest CodeRabbit feedback. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: jackaldenryan <jackaldenryan@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (1)
33-266: Package missing required tests directory.Per coding guidelines, packages containing Python code must have a
tests/directory at the same level aspyproject.toml. Thepackages/nvidia_nat_zep_cloud/package contains Python code insrc/but lacks the requiredtests/directory.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{src/**/*.py,packages/*/src/**/*.py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{src/**/*.py,packages/*/src/**/*.py}: All importable Python code must live under src/ or packages//src/
All public APIs must have Python 3.11+ type hints on parameters and return values
Prefer typing/collections.abc abstractions (e.g., Sequence over list)
Use typing.Annotated for units or metadata when useful
Treat pyright warnings as errors during development
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/*/src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
If a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧠 Learnings (2)
📚 Learning: 2025-10-22T22:02:12.903Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-10-22T22:02:12.903Z
Learning: Applies to **/*.py : When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
Applied to files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
📚 Learning: 2025-10-22T22:02:12.903Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-10-22T22:02:12.903Z
Learning: Applies to **/*.py : When catching and logging without re-raising, use logger.exception() to capture full stack trace
Applied to files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧬 Code graph analysis (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (2)
src/nat/builder/context.py (2)
Context(118-316)conversation_id(186-193)packages/nvidia_nat_mem0ai/src/nat/plugins/mem0ai/mem0_editor.py (3)
add_items(44-69)search(71-103)remove_items(105-115)
🪛 Ruff (0.14.2)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
192-192: Avoid specifying long messages outside the exception class
(TRY003)
266-266: Avoid specifying long messages outside the exception class
(TRY003)
🔇 Additional comments (3)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (3)
1-31: LGTM: Header and imports are correct.The SPDX header, copyright years, and imports are properly structured for Zep v3 integration.
33-46: LGTM: Class initialization is well-structured.The class docstring and
__init__method properly document the Zep v3 integration with correct type annotations.
88-166: LGTM: Thread-based memory insertion is well-implemented.The method correctly:
- Uses sets to track created threads and ensured users, avoiding redundant operations
- Validates user_id with sensible fallback
- Derives thread_id from NAT Context with fallback
- Handles ApiError with proper status code checking
- Supports ignore_roles parameter for filtering
|
/ok to test cb007b3 |
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (2)
63-71: Critical: Replace realistic PII with non-deliverable placeholder data.Lines 65-67 still use realistic personal information (
jane.doe@example.com,Jane,Doe) for the default user, creating a compliance/privacy risk. This issue was flagged in previous reviews.Apply this diff:
if user_id == "default_user": - email = "jane.doe@example.com" - first_name = "Jane" - last_name = "Doe" + email = "default_user@users.invalid" + first_name = "Default" + last_name = "User"Based on coding guidelines.
33-265: Package requires tests directory per coding guidelines.This package contains Python code (
src/nat/plugins/zep_cloud/zep_editor.py) but lacks atests/directory. Per coding guidelines: "if a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml."Create
packages/nvidia_nat_zep_cloud/tests/and add unit tests covering:
_ensure_user_exists(): user exists, NotFoundError→create, ApiError handlingadd_items(): thread creation, message ingestion, ignore_roles supportsearch(): context retrieval, mode parameter, fallback behaviorremove_items(): thread deletion, user deletionBased on coding guidelines.
🧹 Nitpick comments (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (1)
176-188: Update docstring to be more precise about API contract.The docstring has improved but could be clearer:
Lines 180-182: While it now states "required for response construction," explicitly note that
user_idis NOT passed to the Zep API (only used to populate the returned MemoryItem).Lines 182-184: The mode description is better but consider rewording for clarity: "Retrieval mode. Zep v3's server-side default is 'summary' when not specified; this implementation explicitly passes mode='basic' (NAT's chosen default) for faster performance (P95 < 200ms)."
Consider this diff:
kwargs: Zep-specific keyword arguments. - - user_id (str, required for response construction): Used only to construct the - returned MemoryItem. Zep v3's thread.get_user_context() only requires thread_id. + - user_id (str, required): Used solely to populate the returned MemoryItem; + NOT passed to Zep's API (thread.get_user_context requires only thread_id). - mode (str, optional): Retrieval mode. Zep server default is "summary". This - implementation uses mode="basic" (NAT's default) for performance (P95 < 200ms). + implementation explicitly passes mode="basic" for NAT's performance target (P95 < 200ms). "summary" provides more comprehensive memory at the cost of latency.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{src/**/*.py,packages/*/src/**/*.py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{src/**/*.py,packages/*/src/**/*.py}: All importable Python code must live under src/ or packages//src/
All public APIs must have Python 3.11+ type hints on parameters and return values
Prefer typing/collections.abc abstractions (e.g., Sequence over list)
Use typing.Annotated for units or metadata when useful
Treat pyright warnings as errors during development
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/*/src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
If a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧠 Learnings (2)
📚 Learning: 2025-10-22T22:02:12.903Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-10-22T22:02:12.903Z
Learning: Applies to **/*.py : When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
Applied to files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
📚 Learning: 2025-10-22T22:02:12.903Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-10-22T22:02:12.903Z
Learning: Applies to **/*.py : When catching and logging without re-raising, use logger.exception() to capture full stack trace
Applied to files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧬 Code graph analysis (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (2)
src/nat/builder/context.py (2)
Context(118-316)conversation_id(186-193)packages/nvidia_nat_mem0ai/src/nat/plugins/mem0ai/mem0_editor.py (3)
add_items(44-69)search(71-103)remove_items(105-115)
🪛 Ruff (0.14.2)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
191-191: Avoid specifying long messages outside the exception class
(TRY003)
265-265: Avoid specifying long messages outside the exception class
(TRY003)
🔇 Additional comments (3)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (3)
1-30: LGTM: Header, imports, and logger setup are correct.The SPDX header, copyright year (2024-2025), imports, and logger initialization follow coding guidelines and best practices.
33-46: LGTM: Class definition and constructor are well-typed and documented.The class definition,
__init__method with return type annotation, and Google-style docstring follow all coding guidelines.
88-166: LGTM: Memory ingestion is well-structured with proper error handling.The
add_itemsmethod correctly:
- Validates
user_idwith a sensible fallback- Deduplicates user and thread creation using tracking sets
- Retrieves
thread_idfrom NAT Context- Handles
ApiErrorwith properresponse_datainspection- Uses
logger.exception()when swallowing errors (line 149)- Supports optional
ignore_rolesparameter
Clarify that Zep v3's thread.get_user_context() only requires thread_id, not user_id. The user_id parameter is used only for constructing the returned MemoryItem in our implementation. Also clarify mode parameter defaults: Zep server default is "summary" while this NAT implementation intentionally uses "basic" as the default for better performance (P95 < 200ms). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: jackaldenryan <jackaldenryan@gmail.com>
5f29ee9 to
2bd4a2a
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (1)
65-67: Critical: Replace realistic PII with non-deliverable placeholder data.Lines 65-67 still use realistic personal information (
jane.doe@example.com,Jane,Doe) for the default user, creating a compliance/privacy risk. Use a non-deliverable domain and neutral names.Apply this diff:
- email = "jane.doe@example.com" - first_name = "Jane" - last_name = "Doe" + email = "default_user@users.invalid" + first_name = "Default" + last_name = "User"Based on coding guidelines.
🧹 Nitpick comments (2)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (2)
191-191: Shorten ValueError message to comply with TRY003.The error message exceeds the recommended length. Use a more concise phrasing.
Apply this diff:
- raise ValueError("user_id is required.") + raise ValueError("user_id required.")As per static analysis hints.
265-265: Shorten ValueError message to comply with TRY003.The error message exceeds the recommended length. Use a more concise phrasing.
Apply this diff:
- raise ValueError("Either thread_id or user_id is required.") + raise ValueError("thread_id or user_id required.")As per static analysis hints.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{src/**/*.py,packages/*/src/**/*.py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{src/**/*.py,packages/*/src/**/*.py}: All importable Python code must live under src/ or packages//src/
All public APIs must have Python 3.11+ type hints on parameters and return values
Prefer typing/collections.abc abstractions (e.g., Sequence over list)
Use typing.Annotated for units or metadata when useful
Treat pyright warnings as errors during development
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/*/src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
If a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧠 Learnings (2)
📚 Learning: 2025-10-22T22:02:12.903Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-10-22T22:02:12.903Z
Learning: Applies to **/*.py : When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
Applied to files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
📚 Learning: 2025-10-22T22:02:12.903Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-10-22T22:02:12.903Z
Learning: Applies to **/*.py : When catching and logging without re-raising, use logger.exception() to capture full stack trace
Applied to files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧬 Code graph analysis (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (2)
src/nat/builder/context.py (2)
Context(118-316)conversation_id(186-193)packages/nvidia_nat_mem0ai/src/nat/plugins/mem0ai/mem0_editor.py (3)
add_items(44-69)search(71-103)remove_items(105-115)
🪛 Ruff (0.14.2)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
191-191: Avoid specifying long messages outside the exception class
(TRY003)
265-265: Avoid specifying long messages outside the exception class
(TRY003)
CI Pipeline Check Failure - Unrelated to PR ChangesThe CI Pipeline / Check is currently failing due to the Markdown Link Check hook detecting 3 dead links in the documentation. These failures are unrelated to the changes in this PR, as they exist in files that were not modified by this branch. Dead Links Found:
The "Status: 0" indicates connection failures during the link check, likely due to rate limiting or bot protection on these external domains. These URLs appear to be valid and accessible in browsers but are failing in the CI environment. This PR does not touch any of these documentation files - the changes are isolated to The code changes in this PR have passed all relevant checks (yapf, ruff, and uv-lock). |
|
@willkill07 see above comment, previously the CI test was failing due to (apparently) broken links unrelated to this PR: https://github.com/NVIDIA/NeMo-Agent-Toolkit/actions/runs/18918752595/job/54008987657 |
|
Yup. Microsoft was having a fun day today. Retriggering CI |
|
/ok to test 2bd4a2a |
willkill07
left a comment
There was a problem hiding this comment.
The following suggestions should result in documentation passing
- Add proper indentation to __init__ Args section - Add blank lines before bulleted lists in docstrings for better Sphinx rendering - Applies to add_items, search, and remove_items methods Addresses willkill07's documentation formatting feedback. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: jackaldenryan <jackaldenryan@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (4)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (4)
63-71: CRITICAL: Replace realistic PII with non-deliverable placeholder data (duplicate).Lines 65-67 still use realistic personal information (
jane.doe@example.com,Jane,Doe) for the default user, creating a compliance/privacy risk. This was flagged in a previous review.Apply this diff:
if user_id == "default_user": - email = "jane.doe@example.com" - first_name = "Jane" - last_name = "Doe" + email = "default_user@users.invalid" + first_name = "Default" + last_name = "User"Based on coding guidelines.
191-193: Shorten ValueError message to comply with TRY003 (duplicate).The error message is flagged by ruff as too long.
Apply this diff:
# Validate required kwargs if "user_id" not in kwargs or not kwargs["user_id"]: - raise ValueError("user_id is required.") + raise ValueError("user_id required.")As per static analysis hints.
266-269: Shorten ValueError message to comply with TRY003 (duplicate).The error message is flagged by ruff as too long.
Apply this diff:
else: - raise ValueError("Either thread_id or user_id is required.") + raise ValueError("thread_id or user_id required.")As per static analysis hints.
33-269: Package requires tests directory per coding guidelines (duplicate).Per coding guidelines,
packages/nvidia_nat_zep_cloudcontains Python code and must have atests/directory at the package root (same level aspyproject.toml). This was flagged in a previous review but remains unresolved.Create
packages/nvidia_nat_zep_cloud/tests/with unit tests covering:
_ensure_user_exists: existing user, NotFoundError → creation, 409 conflict handlingadd_items: thread creation/deduplication, user deduplication, ignore_roles functionalitysearch: context retrieval, mode parameter, NotFoundError handlingremove_items: single thread deletion, bulk user thread deletion
🧹 Nitpick comments (4)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (4)
39-46: Apply reviewer's docstring formatting suggestion.As noted by willkill07, Sphinx prefers no blank line between the description and Args section.
Apply this diff:
Initialize class with Zep v3 AsyncZep Client. Args: - zep_client (AsyncZep): Async client instance.
88-101: Apply reviewer's docstring formatting suggestion.The add_items method logic is well-structured with proper user/thread deduplication, exception handling, and ignore_roles support. However, willkill07 suggested adding a blank line before the nested list for better Sphinx rendering.
Apply this diff:
items (list[MemoryItem]): The items to be added. kwargs (dict): Provider-specific keyword arguments. - ignore_roles (list[str], optional): List of role types to ignore when adding + messages to graph memory. Available roles: system, assistant, user,
177-186: Apply reviewer's docstring formatting suggestion.The docstring correctly describes the API contract, but willkill07 suggested adding a blank line before the nested list for consistency.
Apply this diff:
kwargs: Zep-specific keyword arguments. - user_id (str, required for response construction): Used only to construct the + returned MemoryItem. Zep v3's thread.get_user_context() only requires thread_id.
229-243: Apply reviewer's docstring formatting suggestions.The remove_items logic correctly handles both deletion modes with appropriate logging levels. However, willkill07 suggested formatting improvements for Sphinx.
Apply this diff:
Remove memory items based on provided criteria. Supports two deletion modes: + 1. Delete a specific thread by thread_id 2. Delete all threads for a user by user_id Args: kwargs: Additional parameters. - thread_id (str, optional): Thread ID to delete a specific thread. + - user_id (str, optional): User ID to delete all threads for that user.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{src/**/*.py,packages/*/src/**/*.py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{src/**/*.py,packages/*/src/**/*.py}: All importable Python code must live under src/ or packages//src/
All public APIs must have Python 3.11+ type hints on parameters and return values
Prefer typing/collections.abc abstractions (e.g., Sequence over list)
Use typing.Annotated for units or metadata when useful
Treat pyright warnings as errors during development
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/*/src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
If a package contains Python code, it must have tests in a tests/ directory at the same level as pyproject.toml
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧠 Learnings (2)
📚 Learning: 2025-10-22T22:02:12.903Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-10-22T22:02:12.903Z
Learning: Applies to **/*.py : When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
Applied to files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
📚 Learning: 2025-10-22T22:02:12.903Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-10-22T22:02:12.903Z
Learning: Applies to **/*.py : When catching and logging without re-raising, use logger.exception() to capture full stack trace
Applied to files:
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
🧬 Code graph analysis (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (2)
src/nat/builder/context.py (2)
Context(118-316)conversation_id(186-193)packages/nvidia_nat_mem0ai/src/nat/plugins/mem0ai/mem0_editor.py (3)
add_items(44-69)search(71-103)remove_items(105-115)
🪛 Ruff (0.14.2)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py
193-193: Avoid specifying long messages outside the exception class
(TRY003)
269-269: Avoid specifying long messages outside the exception class
(TRY003)
🔇 Additional comments (1)
packages/nvidia_nat_zep_cloud/src/nat/plugins/zep_cloud/zep_editor.py (1)
16-37: LGTM: Imports and class structure are well-organized.The imports correctly reference Zep v3 SDK components, NAT context for conversation_id access, and standard memory interfaces. Class docstring accurately describes the v3 thread-based approach.
|
@willkill07 addressed your comments, and ran sphinx documentation build locally with no errors. Should be ready to test again |
|
/ok to test 48dfded |
|
/merge |
Description
Zep solutions engineer here. This PR updates the Zep Cloud plugin to use the new v3 API with architectural changes from session-based to thread-based memory management, consistent with our v3 API.
The current implementation of Zep uses very outdated methods that are deprecated or marked to be deprecated, such as search_sessions.
Breaking changes:
Key changes to ZepEditor:
Multi-thread support:
🤖 Generated with Claude Code
By Submitting this PR I confirm:
Summary by CodeRabbit
New Features
Chores