feat: Add LangGraph integration#80
Conversation
…angchain Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
WalkthroughAdds a LangGraph integration package and README, implements a LangGraph-to-NeMo Flow callback handler with JSON-safe serialization and mark emission, updates the LangChain callback handler to run inline and improve name resolution, updates packaging extras to add ChangesLangGraph Integration and Enhancement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@python/tests/integrations/langgraph/test_langgraph_integration.py`:
- Around line 92-116: The test_graph_callbacks currently runs the async path by
calling asyncio.run() inside a synchronous test; split this into two tests: keep
the existing synchronous path as test_sync_graph_callbacks using sync_graph and
graph.invoke(..., config={"callbacks":[NemoFlowCallbackHandler()]}), and add a
new async test test_async_graph_callbacks marked with `@pytest.mark.asyncio` that
uses async_graph and awaits async_graph.ainvoke(...,
config={"callbacks":[NemoFlowCallbackHandler()]}), preserving the same scope
context and assertions (result == {"value": 2"} and
events_to_strings(subscribed_events) == expected_events) and remove the
asyncio.run usage.
- Around line 40-48: In _build_graph replace the unnecessary cast by passing the
TypedDict type directly to StateGraph: remove cast(Any, State) and call
StateGraph(State); update the constructor call in _build_graph (which registers
nodes "increment" with aincrement/increment, adds edges START -> "increment" and
"increment" -> END, then calls builder.compile()) so it uses StateGraph(State)
instead of StateGraph(cast(Any, State)).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: a9f73762-e9fb-41ad-aaf6-fe8a4933de90
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
pyproject.tomlpython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/README.mdpython/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: License Diff / Run
- GitHub Check: Python / Test (linux-arm64)
- GitHub Check: Python / Test (windows-arm64)
- GitHub Check: Python / Test (macos-arm64)
- GitHub Check: Python / Test (linux-amd64)
- GitHub Check: Documentation / Build
- GitHub Check: Python / Test (windows-amd64)
🧰 Additional context used
📓 Path-based instructions (28)
**/*.py
📄 CodeRabbit inference engine (.agents/skills/test-python-binding/SKILL.md)
Format changed Python wrapper and test files with
uv run ruff format python
**/*.py: Use Ruff with rule sets E, F, W, I for Python linting
Use Ruff formatter for Python code with line length 120 and double quotes
Usetyfor Python type checking
Use snake_case naming convention for Python code
Include SPDX license headers in all Python source files using Python comment syntax
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{rs,py,go,js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use
SONAR_IGNORE_START/SONAR_IGNORE_ENDmarkers only for documented false positives that cannot be resolved in code; keep ignored blocks small, add explanatory comments, and require reviewer sign-off
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
python/nemo_flow/**/*.py
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Use
snake_casenaming convention for Python API implementations and wrappers
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.py
**/*.{md,markdown,py,sh,bash,js,ts,java,cpp,go,rust}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep package names, repo references, and build commands current in documentation
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langgraph/README.mdpython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{md,markdown,py,sh,bash}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langgraph/README.mdpython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{md,markdown,py,sh,bash,js,ts,example}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Example commands must match current package names and paths
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langgraph/README.mdpython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
**/{integrations,integration,*-integration}/**
📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)
**/{integrations,integration,*-integration}/**: Keep NeMo Flow optional in framework integrations
Preserve the framework's original behavior when NeMo Flow is absent
Wrap tool and LLM paths at the correct framework boundary
Integration pattern must followdocs/integrate-frameworks/adding-scopes.md
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langgraph/README.mdpython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
{docs/**,examples/**,crates/adaptive/**,python/nemo_flow/**,go/nemo_flow/**,**/{example,component}.{ts,tsx,js,rs,py,go}}
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Any new adaptive component kind must have documentation, examples, and binding coverage across all supported languages
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langgraph/README.mdpython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.py
**/*.{js,ts,tsx,jsx,py,rs,go,java,c,cpp,h,cc,cxx,cs,rb,php,swift,kt}
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changed files must be formatted with the language-native formatter
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
python/**/*.py
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
python/**/*.py: If Python language surface changed, always run Python test target even when Rust core did not change
For Python changes, useuv run ruff format pythonto format Python files
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{py,js,ts,tsx,go,rs,md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Format changed files with the language-native formatter before the final lint/test pass
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langgraph/README.mdpython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{rs,py,js,ts,tsx,go}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
During iteration, prefer
uv run pre-commit run --files <changed files...>for targeted validation
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.pypython/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
python/nemo_flow/**/*
⚙️ CodeRabbit configuration file
python/nemo_flow/**/*: Review Python wrapper changes for typed API consistency, contextvars-based scope isolation, async behavior, and parity with the native extension.
Stubs and runtime implementations should stay aligned.
Files:
python/nemo_flow/integrations/langgraph/__init__.pypython/nemo_flow/integrations/langgraph/README.mdpython/nemo_flow/integrations/langchain/callbacks.pypython/nemo_flow/integrations/langgraph/callbacks.py
**/*.{md,rst,html,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
**/*.{md,rst,html,txt}: Always spellNVIDIAin all caps. Do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol afterNVIDIAwhen referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names withNVIDIAon first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms withs, not an apostrophe, such asGPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such asCPU,GPU,PC,API, andUIusually do not need to be spelled out for developer audiences.
Files:
python/nemo_flow/integrations/langgraph/README.md
**/*.{md,rst,html}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
Link the first mention of a product name when the destination helps the reader.
Files:
python/nemo_flow/integrations/langgraph/README.md
**/*.{md,rst,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
**/*.{md,rst,txt}: SpellNVIDIAin all caps. Do not useNvidia,nvidia, orNV.
Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as 'here' or 'read more.'
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce.
Preferrefer tooverseewhen the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical documentation.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented documentation unless the source, platform, or legal guidance explicitly requires them.
Do not add trademark symbols to NeMo Flow learning documentation by default.
Do not rewrite API names, package names, command flags, or code literals for style reasons.
Files:
python/nemo_flow/integrations/langgraph/README.md
**/*.{md,markdown,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)
**/*.{md,markdown,rst}: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Use monospace formatting for code elements, commands, parameters, package names, and expressions
Use monospace formatting for directories, file names, and paths
Use angle brackets inside monospace for variables inside paths, such as/home/<username>/.login
Use quotation marks for error messages and strings in documentation
Use bold formatting for UI buttons, menus, fields, and labels in documentation
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use in documentation
Use italics for publication titles in documentation
Use plain text formatting for keyboard shortcuts in documentation
Prefer[NVIDIA/NeMo](link)format for GitHub repository references over generic phrases like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text in documentation
Avoid generic link anchors such as 'here,' 'this page,' and 'read more' in documentation
Include the acronym in link text if a linked term includes an acronym
Do not link long sentences or multiple sentences in documentation
Avoid links that pull readers away from a procedure unles...
Files:
python/nemo_flow/integrations/langgraph/README.md
**/*.{html,md}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Include SPDX license headers in HTML and Markdown files using HTML comment syntax
Files:
python/nemo_flow/integrations/langgraph/README.md
**/README.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update relevant crate or package README when that surface changed
Relevant package or crate README.md files must be updated when examples or binding guidance changes
Files:
python/nemo_flow/integrations/langgraph/README.md
**/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Run Markdown link checking via
lycheeforREADME.md,CONTRIBUTING.md, anddocs/through pre-commit hooks
Files:
python/nemo_flow/integrations/langgraph/README.md
**/*.{md,txt,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
**/*.{md,txt,rst}: Ensure commands, package names, file paths, and APIs in documentation are correct and not stale; flag incorrect or outdated information as blocking issues
Ensure examples and procedures in documentation will execute successfully with current APIs and commands
Use consistent user-facing terminology throughout documentation that matches current repo terminology
Capitalize NVIDIA correctly in all documentation and public-facing text
Format code, commands, paths, and filenames as inline code (monospace) in documentation
Use descriptive anchor text for links instead of bare URLs or weak labels like 'here' in documentation
Prefer active voice, present tense, short sentences, and plain English in documentation
Structure documentation procedures as imperative steps that are easy to scan and not too long for a single sequence
Prefer 'after' instead of 'once' for temporal references in documentation
Use 'can' instead of 'may' when describing possibility (rather than permission) in documentation
Avoid ambiguous numeric dates and ordinal dates in documentation body text
Files:
python/nemo_flow/integrations/langgraph/README.md
{README.md,docs/index.md,**/README.md}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
Update entry-point documentation (README.md, docs/index.md, package READMEs, binding-level source READMEs) whenever public behavior changes
Files:
python/nemo_flow/integrations/langgraph/README.md
**/*.toml
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Include SPDX license headers in TOML files using TOML comment syntax
Files:
pyproject.toml
{Cargo.toml,setup.py,setup.cfg,pyproject.toml,go.mod,go.sum,package.json,package-lock.json,yarn.lock,pom.xml,*.gradle}
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update repository manifest files (Cargo.toml, setup.py, go.mod, package.json, etc.) with new package/crate names during rename operations
Files:
pyproject.toml
{Cargo.toml,pyproject.toml,go/nemo_flow/go.mod,package.json,package-lock.json,crates/node/package.json}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Maintain consistent package names, import paths, and module names across Rust, Python, Go, Node, and WebAssembly workspaces in NeMo Flow
Files:
pyproject.toml
**/test_*.py
📄 CodeRabbit inference engine (.agents/skills/test-python-binding/SKILL.md)
Run focused
pytestfirst when you know the affected area usingpytest -k "<pattern>"
Files:
python/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
{crates/**/tests/**,python/tests/**,go/nemo_flow/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_flow/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
python/tests/integrations/langchain/test_callbacks.pypython/tests/integrations/langgraph/test_langgraph_integration.py
**/{tests,test}/**/*{integration,smoke}*.py
📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)
Relevant integration tests or smoke path must pass before contribution
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
🪛 Ruff (0.15.12)
python/nemo_flow/integrations/langgraph/callbacks.py
[warning] 20-20: Dynamically typed expressions (typing.Any) are disallowed in value
(ANN401)
[warning] 22-25: Use contextlib.suppress(Exception) instead of try-except-pass
Replace try-except-pass with with contextlib.suppress(Exception): ...
(SIM105)
[error] 24-25: try-except-pass detected, consider logging the exception
(S110)
[warning] 24-24: Do not catch blind exception: Exception
(BLE001)
[warning] 36-36: Dynamically typed expressions (typing.Any) are disallowed in interrupt
(ANN401)
[warning] 53-53: Dynamically typed expressions (typing.Any) are disallowed in on_interrupt
(ANN401)
[warning] 67-67: Dynamically typed expressions (typing.Any) are disallowed in on_resume
(ANN401)
[warning] 87-87: Do not catch blind exception: Exception
(BLE001)
python/tests/integrations/langgraph/test_langgraph_integration.py
[warning] 40-40: Boolean-typed positional argument in function definition
(FBT001)
[warning] 40-40: Boolean default positional argument in function definition
(FBT002)
[warning] 94-94: Boolean-typed positional argument in function definition
(FBT001)
🔇 Additional comments (14)
python/nemo_flow/integrations/langchain/callbacks.py (2)
25-26: Inline callback execution is correctly enforced.
run_inline = Trueis the right change to preserve deterministic scope push/pop ordering.
45-49: Chain name precedence is implemented correctly.Preferring callback-provided
nameand then falling back to serialized data is a safe and backward-compatible resolution order.python/tests/integrations/langchain/test_callbacks.py (4)
52-53: Good targeted assertion for inline callback behavior.This directly guards the expected handler configuration for async callback manager execution semantics.
75-86: Callback-provided name precedence is well covered.This test precisely validates the new
nameoverride path introduced inon_chain_start.
55-159: Scope lifecycle coverage is solid.Start/end/error mapping, parent propagation, noop-on-missing-start, and fallback naming are all exercised with clear assertions.
164-198: No-op and exception-swallowing paths are appropriately tested.These tests protect the integration’s non-intrusive behavior when NeMo Flow is unavailable or push/pop fails.
pyproject.toml (1)
82-90: LGTM! Proper dependency composition.The self-referencing extras pattern (
nemo-flow[langchain]) correctly composes dependencies and ensures that installing thelanggraphextra also brings in the required LangChain integration.python/nemo_flow/integrations/langgraph/__init__.py (1)
1-12: LGTM! Correct re-export structure.The package correctly re-exports
NemoFlowMiddlewarefrom the LangChain integration and the newNemoFlowCallbackHandlerfrom the local callbacks module.python/nemo_flow/integrations/langgraph/callbacks.py (3)
20-33: LGTM! Conservative JSON serialization.The try-except pattern here is intentional for defensive serialization—if
_prepare_outputsfails, the function falls back to basic type checking andrepr(). This ensures mark emission never fails due to serialization issues.
53-78: LGTM! Correct lifecycle hook implementation.Both
on_interruptandon_resumeproperly extract event metadata, emit NeMo Flow marks via_emit_graph_mark, and returnNoneas required by theGraphCallbackHandlerprotocol.
80-88: LGTM! Appropriate error resilience.Catching broad
Exceptionhere is correct—mark emission should never crash the LangGraph workflow. Debug logging preserves troubleshooting capability while maintaining resilience.python/tests/integrations/langgraph/test_langgraph_integration.py (2)
61-71: LGTM! Proper fixture cleanup.The fixture correctly registers a uniquely-named event subscriber and ensures cleanup via
yield, preventing test pollution.
119-161: LGTM! Comprehensive lifecycle validation.The test thoroughly validates interrupt/resume mark emission, serialization of interrupt payloads, checkpoint namespace preservation, and integration metadata tagging.
python/nemo_flow/integrations/langgraph/README.md (1)
60-68: ⚡ Quick winThe
create_agentfunction exists inlangchain.agentsand is part of the public LangChain API, as confirmed by official LangChain documentation. The code shown is correct and requires no changes.> Likely an incorrect or invalid review comment.
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@python/tests/integrations/langgraph/test_langgraph_integration.py`:
- Around line 52-60: The tests request a non-existent fixture name "graph";
update the two test functions to request the correct explicit fixtures: change
the parameter of test_sync(...) to use sync_graph (the fixture function named
sync_graph that returns CompiledStateGraph with use_async=False) and change the
parameter of test_async(...) to use async_graph (the fixture async_graph that
returns CompiledStateGraph with use_async=True); ensure the function signatures
for test_sync and test_async reference these exact fixture names so pytest can
resolve them.
- Around line 94-103: Tests test_sync and test_async request a non-existent
fixture named graph causing FixtureLookupError; update their parameter names to
use the existing fixtures sync_graph and async_graph respectively (or add a
parametrized graph fixture if preferred), and change the Test class __init__
method to define _expected_events as a class attribute (move the list out of
__init__ into a class-level _expected_events) so test discovery doesn't
instantiate the test class incorrectly; update references to _expected_events
accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: c14582ed-5ffc-47c4-91b6-f21a25f3610c
📒 Files selected for processing (1)
python/tests/integrations/langgraph/test_langgraph_integration.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (13)
**/*.py
📄 CodeRabbit inference engine (.agents/skills/test-python-binding/SKILL.md)
Format changed Python wrapper and test files with
uv run ruff format python
**/*.py: Use Ruff with rule sets E, F, W, I for Python linting
Use Ruff formatter for Python code with line length 120 and double quotes
Usetyfor Python type checking
Use snake_case naming convention for Python code
Include SPDX license headers in all Python source files using Python comment syntax
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/test_*.py
📄 CodeRabbit inference engine (.agents/skills/test-python-binding/SKILL.md)
Run focused
pytestfirst when you know the affected area usingpytest -k "<pattern>"
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{rs,py,go,js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use
SONAR_IGNORE_START/SONAR_IGNORE_ENDmarkers only for documented false positives that cannot be resolved in code; keep ignored blocks small, add explanatory comments, and require reviewer sign-off
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{md,markdown,py,sh,bash,js,ts,java,cpp,go,rust}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep package names, repo references, and build commands current in documentation
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{md,markdown,py,sh,bash}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{md,markdown,py,sh,bash,js,ts,example}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Example commands must match current package names and paths
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/{integrations,integration,*-integration}/**
📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)
**/{integrations,integration,*-integration}/**: Keep NeMo Flow optional in framework integrations
Preserve the framework's original behavior when NeMo Flow is absent
Wrap tool and LLM paths at the correct framework boundary
Integration pattern must followdocs/integrate-frameworks/adding-scopes.md
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/{tests,test}/**/*{integration,smoke}*.py
📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)
Relevant integration tests or smoke path must pass before contribution
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{js,ts,tsx,jsx,py,rs,go,java,c,cpp,h,cc,cxx,cs,rb,php,swift,kt}
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changed files must be formatted with the language-native formatter
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
python/**/*.py
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
python/**/*.py: If Python language surface changed, always run Python test target even when Rust core did not change
For Python changes, useuv run ruff format pythonto format Python files
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{py,js,ts,tsx,go,rs,md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Format changed files with the language-native formatter before the final lint/test pass
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{rs,py,js,ts,tsx,go}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
During iteration, prefer
uv run pre-commit run --files <changed files...>for targeted validation
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
{crates/**/tests/**,python/tests/**,go/nemo_flow/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_flow/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
🪛 Ruff (0.15.12)
python/tests/integrations/langgraph/test_langgraph_integration.py
[warning] 40-40: Boolean-typed positional argument in function definition
(FBT001)
[warning] 40-40: Boolean default positional argument in function definition
(FBT002)
[warning] 94-94: Missing return type annotation for special method __init__
Add return type annotation: None
(ANN204)
Signed-off-by: David Gardner <dagardner@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@python/tests/integrations/langgraph/test_langgraph_integration.py`:
- Around line 115-124: The async test method test_async is defined as async def
but missing the pytest-asyncio marker, so add the `@pytest.mark.asyncio` decorator
immediately above the test_async definition and ensure pytest is imported in the
file; apply this to the test_async method that calls async_graph.ainvoke and
checks result/events (and adjust any existing imports to include pytest if not
present).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: b5725d12-c54b-4847-8763-f2ec0d7dc0bc
📒 Files selected for processing (1)
python/tests/integrations/langgraph/test_langgraph_integration.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (13)
**/*.py
📄 CodeRabbit inference engine (.agents/skills/test-python-binding/SKILL.md)
Format changed Python wrapper and test files with
uv run ruff format python
**/*.py: Use Ruff with rule sets E, F, W, I for Python linting
Use Ruff formatter for Python code with line length 120 and double quotes
Usetyfor Python type checking
Use snake_case naming convention for Python code
Include SPDX license headers in all Python source files using Python comment syntax
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/test_*.py
📄 CodeRabbit inference engine (.agents/skills/test-python-binding/SKILL.md)
Run focused
pytestfirst when you know the affected area usingpytest -k "<pattern>"
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{rs,py,go,js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use
SONAR_IGNORE_START/SONAR_IGNORE_ENDmarkers only for documented false positives that cannot be resolved in code; keep ignored blocks small, add explanatory comments, and require reviewer sign-off
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{md,markdown,py,sh,bash,js,ts,java,cpp,go,rust}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep package names, repo references, and build commands current in documentation
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{md,markdown,py,sh,bash}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{md,markdown,py,sh,bash,js,ts,example}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Example commands must match current package names and paths
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/{integrations,integration,*-integration}/**
📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)
**/{integrations,integration,*-integration}/**: Keep NeMo Flow optional in framework integrations
Preserve the framework's original behavior when NeMo Flow is absent
Wrap tool and LLM paths at the correct framework boundary
Integration pattern must followdocs/integrate-frameworks/adding-scopes.md
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/{tests,test}/**/*{integration,smoke}*.py
📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)
Relevant integration tests or smoke path must pass before contribution
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{js,ts,tsx,jsx,py,rs,go,java,c,cpp,h,cc,cxx,cs,rb,php,swift,kt}
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changed files must be formatted with the language-native formatter
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
python/**/*.py
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
python/**/*.py: If Python language surface changed, always run Python test target even when Rust core did not change
For Python changes, useuv run ruff format pythonto format Python files
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{py,js,ts,tsx,go,rs,md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Format changed files with the language-native formatter before the final lint/test pass
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
**/*.{rs,py,js,ts,tsx,go}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
During iteration, prefer
uv run pre-commit run --files <changed files...>for targeted validation
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
{crates/**/tests/**,python/tests/**,go/nemo_flow/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_flow/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
python/tests/integrations/langgraph/test_langgraph_integration.py
🪛 Ruff (0.15.12)
python/tests/integrations/langgraph/test_langgraph_integration.py
[warning] 40-40: Boolean-typed positional argument in function definition
(FBT001)
[warning] 40-40: Boolean default positional argument in function definition
(FBT002)
[warning] 94-94: Missing return type annotation for special method __init__
Add return type annotation: None
(ANN204)
🔇 Additional comments (5)
python/tests/integrations/langgraph/test_langgraph_integration.py (5)
40-49: Remove the unnecessarycast(Any, State).
StateGraphacceptsTypedDictdirectly per LangGraph documentation. The cast toAnydefeats type checking without runtime benefit.def _build_graph(use_async: bool = False) -> CompiledStateGraph: - # The cast here avoids a ty linting error - builder = StateGraph(cast(Any, State)) + builder = StateGraph(State) # type: ignore[arg-type]If
tycomplains, a targeted type ignore is cleaner than casting away all type information.
93-102: Test class__init__will causeAttributeErrorat runtime.Pytest doesn't call
__init__when instantiating test classes for collection. Whentest_syncortest_asyncruns,self._expected_eventswon't exist. Convert to a class attribute:class TestGraphCallbacks: - def __init__(self): - self._expected_events = [ - "scope.start.request", - "scope.start.LangGraph", - "scope.start.increment", - "scope.end.increment", - "scope.end.LangGraph", - "scope.end.request", - ] + _expected_events = [ + "scope.start.request", + "scope.start.LangGraph", + "scope.start.increment", + "scope.end.increment", + "scope.end.LangGraph", + "scope.end.request", + ]
169-169: 💤 Low valueMissing newline at end of file.
Add a trailing newline to comply with POSIX conventions and avoid diff noise.
1-5: LGTM!SPDX license header and module docstring are correctly in place.
127-169: LGTM!The interrupt/resume lifecycle test properly validates mark event emission, payload serialization, and metadata. Good coverage of the callback handler's interrupt/resume behavior.
Salonijain27
left a comment
There was a problem hiding this comment.
Approved from a dependency point of view
|
/merge |
Overview
langgraphextraDetails
Where should the reviewer start?
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
New Features
langgraphextra and exposed middleware/callbacks for NeMo Flow observability.Bug Fixes
Documentation
Tests