Skip to content

feat: Add Deep Agents integration#90

Open
dagardner-nv wants to merge 23 commits into
NVIDIA:mainfrom
dagardner-nv:david-deepagents-int-p2
Open

feat: Add Deep Agents integration#90
dagardner-nv wants to merge 23 commits into
NVIDIA:mainfrom
dagardner-nv:david-deepagents-int-p2

Conversation

@dagardner-nv
Copy link
Copy Markdown
Contributor

@dagardner-nv dagardner-nv commented May 12, 2026

Overview

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

Where should the reviewer start?

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • Closes #

Summary by CodeRabbit

  • New Features

    • Deep Agents integration: observability for agent runs, tool calls, filesystem/sandbox ops, and human-in-the-loop events; backend instrumentation and middleware emitting start/error/end marks.
  • Documentation

    • Added setup and usage guide for the Deep Agents integration with observability examples.
  • Tests

    • New integration and end-to-end tests covering Deep Agents flows, middleware, and backend instrumentation.
  • Chores

    • Added optional dependency group for Deep Agents; regenerated third-party attribution/licenses.

Review Change Stack

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>
… interupts

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
@dagardner-nv dagardner-nv self-assigned this May 12, 2026
@dagardner-nv dagardner-nv added lang:python PR changes/introduces Python code Feature a new feature labels May 12, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Walkthrough

Adds a Deep Agents observability integration: event utilities, middleware, backend wrappers, LangGraph callback handler, package wiring (add_nemo_flow_integration), docs, tests, and updated attributions and CI/build syncs.

Changes

Deep Agents NeMo Flow Integration

Layer / File(s) Summary
Observability event data and emission
python/nemo_flow/integrations/deepagents/_events.py
Tool/backend categorization; JSON-safe summarization; builders for tool/backend event payloads; unified emit_mark to send standardized NeMo Flow marks.
Backend observability wrapper
python/nemo_flow/integrations/deepagents/backend.py
NemoFlowDeepAgentsBackend and NemoFlowDeepAgentsSandboxBackend proxy filesystem and execute methods, emitting start/error/end marks; observe_backend factory selects appropriate wrapper and validates sandbox timeouts.
LangGraph callback handler
python/nemo_flow/integrations/deepagents/callbacks.py
NemoFlowDeepAgentsCallbackHandler correlates Graph Interrupt/Resume events for HITL, tracks pending keys, and emits human_in_the_loop marks with phase and payload metadata.
Tool call middleware
python/nemo_flow/integrations/deepagents/middleware.py
NemoFlowDeepAgentsMiddleware emits skill/configured marks and wraps sync/async tool calls to emit start/error/end marks with normalized args, tool kind, and result/error payloads.
Package integration and helper
python/nemo_flow/integrations/deepagents/__init__.py
add_nemo_flow_integration merges kwargs/overrides, normalizes skills/subagent summaries, optionally instruments subagents, wraps backends via observe_backend, injects middleware, and re-exports integration symbols.
Integration documentation
python/nemo_flow/integrations/deepagents/README.md
New README with setup, usage example, and enumerated observable events captured by the integration.
Test fixtures and integration tests
python/tests/conftest.py, python/tests/integrations/deepagents/test_deepagents_integration.py
Shared subscribed_events fixture and comprehensive tests covering middleware, callback HITL handling, backend observation (sync/async), sandbox behavior, wiring, and an end-to-end agent test.
Dependencies and license attributions
pyproject.toml, ATTRIBUTIONS-Python.md
Adds deepagents optional-dependency (includes nemo-flow[langgraph]); regenerates attributions with many new/updated entries and license formatting adjustments.
CI and build sync updates
.github/workflows/*, justfile
Pre-commit/CI/justfile uv sync now includes langgraph and deepagents extras; CI Test job adds Windows ARM64 vcpkg OpenSSL provisioning step.
Existing test module updates
python/tests/integrations/langchain/test_middleware.py, python/tests/integrations/langgraph/test_langgraph_integration.py
Moves subscribed_events fixture to shared conftest, updates BaseChatModel import path, and removes unused Iterator import.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description includes required checklist confirmations but lacks substantive content in Details, reviewer guidance, and related issues sections. Add details about the Deep Agents integration changes, point reviewer to key files (e.g., middleware.py, backend.py), and link the related issue number.
Docstring Coverage ⚠️ Warning Docstring coverage is 16.48% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title follows Conventional Commits format with type 'feat', a clear and concise summary, under 72 characters, and no trailing period.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the size:XL PR is extra large label May 12, 2026
Signed-off-by: David Gardner <dagardner@nvidia.com>
[skip ci]

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>
@dagardner-nv
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Signed-off-by: David Gardner <dagardner@nvidia.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@ATTRIBUTIONS-Python.md`:
- Around line 645-659: Several attribution blocks (e.g., the "## anthropic
(0.101.0)" section and its LICENSE code fence) violate MD022/MD031/MD040; update
the generator/template that emits these blocks to ensure a blank line before and
after each heading and before/after fenced code blocks, and emit fenced code
blocks with an explicit language (e.g., use ```text for LICENSE contents) so
lint rules are satisfied; then re-generate the affected sections (including
other listed ranges) and run the repo formatter on changed Markdown files (per
the project rule for **/*.{py,js,ts,tsx,go,rs,md}) to ensure consistent
formatting.

In `@python/nemo_flow/integrations/deepagents/middleware.py`:
- Around line 122-139: The method _emit_tool_mark is missing an explicit return
type annotation; update its signature to include a return type of None (e.g.,
def _emit_tool_mark(... ) -> None:) so the function's void nature is explicit
for linters and type checkers; locate the _emit_tool_mark method in
middleware.py and add the -> None annotation to its signature without changing
the body.
🪄 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: 1b49494b-9580-43bf-8ffc-d78d6a068946

📥 Commits

Reviewing files that changed from the base of the PR and between 3e09970 and aa3b66e.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • ATTRIBUTIONS-Python.md
  • pyproject.toml
  • python/nemo_flow/integrations/deepagents/README.md
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • python/tests/conftest.py
  • python/tests/integrations/deepagents/test_deepagents_integration.py
  • python/tests/integrations/langchain/test_middleware.py
  • python/tests/integrations/langgraph/test_langgraph_integration.py
💤 Files with no reviewable changes (1)
  • python/tests/integrations/langgraph/test_langgraph_integration.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (29)
**/*.{md,rst,html,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

**/*.{md,rst,html,txt}: Always spell NVIDIA in all caps. Do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol after NVIDIA when 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 with NVIDIA on 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 with s, not an apostrophe, such as GPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such as CPU, GPU, PC, API, and UI usually do not need to be spelled out for developer audiences.

Files:

  • python/nemo_flow/integrations/deepagents/README.md
  • ATTRIBUTIONS-Python.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/deepagents/README.md
  • ATTRIBUTIONS-Python.md
**/*.{md,rst,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,rst,txt}: Spell NVIDIA in all caps. Do not use Nvidia, nvidia, or NV.
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.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once.
Prefer refer to over see when 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/deepagents/README.md
  • ATTRIBUTIONS-Python.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/deepagents/README.md
  • ATTRIBUTIONS-Python.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/deepagents/README.md
  • ATTRIBUTIONS-Python.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/deepagents/README.md
**/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Run Markdown link checking via lychee for README.md, CONTRIBUTING.md, and docs/ through pre-commit hooks

Files:

  • python/nemo_flow/integrations/deepagents/README.md
  • ATTRIBUTIONS-Python.md
**/*.{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/deepagents/README.md
  • python/tests/integrations/langchain/test_middleware.py
  • python/tests/conftest.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • ATTRIBUTIONS-Python.md
  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/README.md
  • python/tests/integrations/langchain/test_middleware.py
  • python/tests/conftest.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • ATTRIBUTIONS-Python.md
  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/README.md
  • python/tests/integrations/langchain/test_middleware.py
  • python/tests/conftest.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • ATTRIBUTIONS-Python.md
  • python/tests/integrations/deepagents/test_deepagents_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 follow docs/integrate-frameworks/adding-scopes.md

Files:

  • python/nemo_flow/integrations/deepagents/README.md
  • python/tests/integrations/langchain/test_middleware.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/README.md
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
**/*.{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/deepagents/README.md
  • ATTRIBUTIONS-Python.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/deepagents/README.md
**/*.{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/deepagents/README.md
  • python/tests/integrations/langchain/test_middleware.py
  • python/tests/conftest.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • ATTRIBUTIONS-Python.md
  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/README.md
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
**/*.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
**/*.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
Use ty for 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/langchain/test_middleware.py
  • python/tests/conftest.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_integration.py
**/test_*.py

📄 CodeRabbit inference engine (.agents/skills/test-python-binding/SKILL.md)

Run focused pytest first when you know the affected area using pytest -k "<pattern>"

Files:

  • python/tests/integrations/langchain/test_middleware.py
  • python/tests/integrations/deepagents/test_deepagents_integration.py
**/*.{rs,py,go,js,ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use SONAR_IGNORE_START / SONAR_IGNORE_END markers 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/langchain/test_middleware.py
  • python/tests/conftest.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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/langchain/test_middleware.py
  • python/tests/conftest.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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, use uv run ruff format python to format Python files

Files:

  • python/tests/integrations/langchain/test_middleware.py
  • python/tests/conftest.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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/langchain/test_middleware.py
  • python/tests/conftest.py
  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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_middleware.py
  • python/tests/conftest.py
  • python/tests/integrations/deepagents/test_deepagents_integration.py
python/nemo_flow/**/*.py

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Use snake_case naming convention for Python API implementations and wrappers

Files:

  • python/nemo_flow/integrations/deepagents/callbacks.py
  • python/nemo_flow/integrations/deepagents/_events.py
  • python/nemo_flow/integrations/deepagents/__init__.py
  • python/nemo_flow/integrations/deepagents/backend.py
  • python/nemo_flow/integrations/deepagents/middleware.py
{README*,CHANGELOG*,docs/**/*.{md,rst,txt},examples/**/*,*.md}

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update documentation, examples, and getting-started guides with new package/module/crate names after rename operations

Files:

  • ATTRIBUTIONS-Python.md
**/{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/deepagents/test_deepagents_integration.py
🪛 markdownlint-cli2 (0.22.1)
ATTRIBUTIONS-Python.md

[warning] 647-647: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 651-651: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 651-651: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 1524-1524: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 1528-1528: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 1528-1528: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 1601-1601: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 1605-1605: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 1605-1605: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 1910-1910: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 1914-1914: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 1914-1914: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 1958-1958: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 1962-1962: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 1962-1962: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 2261-2261: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 2265-2265: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 2265-2265: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 2471-2471: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 2475-2475: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 2475-2475: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 2501-2501: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 2505-2505: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 2505-2505: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 2759-2759: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 2763-2763: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 2763-2763: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 2969-2969: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 2973-2973: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 2973-2973: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 3715-3715: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 3719-3719: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 3719-3719: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 3829-3829: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 3833-3833: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 3833-3833: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 3869-3869: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 3873-3873: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 3873-3873: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 5507-5507: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 5511-5511: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 5511-5511: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 5540-5540: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 5544-5544: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 5544-5544: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 5573-5573: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 5577-5577: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 5577-5577: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 7238-7238: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 7242-7242: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 7242-7242: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 9317-9317: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 9321-9321: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 9321-9321: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 9383-9383: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 9387-9387: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 9387-9387: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🪛 Ruff (0.15.12)
python/nemo_flow/integrations/deepagents/callbacks.py

[warning] 20-20: Dynamically typed expressions (typing.Any) are disallowed in *args

(ANN401)


[warning] 20-20: Dynamically typed expressions (typing.Any) are disallowed in **kwargs

(ANN401)


[warning] 57-57: Dynamically typed expressions (typing.Any) are disallowed in value

(ANN401)


[warning] 70-70: Dynamically typed expressions (typing.Any) are disallowed in interrupt

(ANN401)


[warning] 76-76: Dynamically typed expressions (typing.Any) are disallowed in value

(ANN401)


[warning] 86-86: Dynamically typed expressions (typing.Any) are disallowed in value

(ANN401)

python/nemo_flow/integrations/deepagents/_events.py

[warning] 72-72: Dynamically typed expressions (typing.Any) are disallowed in value

(ANN401)


[warning] 85-85: Too many return statements (7 > 6)

(PLR0911)


[warning] 85-85: Dynamically typed expressions (typing.Any) are disallowed in value

(ANN401)


[warning] 114-114: Dynamically typed expressions (typing.Any) are disallowed in result

(ANN401)


[warning] 147-147: Dynamically typed expressions (typing.Any) are disallowed in result

(ANN401)


[warning] 187-187: Do not catch blind exception: Exception

(BLE001)

python/nemo_flow/integrations/deepagents/__init__.py

[warning] 21-21: Dynamically typed expressions (typing.Any) are disallowed in **overrides

(ANN401)


[warning] 74-74: Dynamically typed expressions (typing.Any) are disallowed in subagent

(ANN401)


[warning] 74-74: Dynamically typed expressions (typing.Any) are disallowed in _instrument_subagent

(ANN401)


[warning] 92-92: Dynamically typed expressions (typing.Any) are disallowed in subagent

(ANN401)


[warning] 111-111: Dynamically typed expressions (typing.Any) are disallowed in value

(ANN401)

python/nemo_flow/integrations/deepagents/backend.py

[warning] 41-41: Dynamically typed expressions (typing.Any) are disallowed in __getattr__

(ANN401)


[warning] 170-170: Dynamically typed expressions (typing.Any) are disallowed in _call_sync

(ANN401)


[warning] 200-200: Dynamically typed expressions (typing.Any) are disallowed in _call_async

(ANN401)


[warning] 237-237: Async function definition with a timeout parameter

(ASYNC109)


[warning] 247-247: Avoid specifying long messages outside the exception class

(TRY003)


[warning] 251-251: Dynamically typed expressions (typing.Any) are disallowed in backend

(ANN401)

python/nemo_flow/integrations/deepagents/middleware.py

[warning] 44-44: Unused method argument: state

(ARG002)


[warning] 44-44: Dynamically typed expressions (typing.Any) are disallowed in state

(ANN401)


[warning] 44-44: Unused method argument: runtime

(ARG002)


[warning] 44-44: Dynamically typed expressions (typing.Any) are disallowed in runtime

(ANN401)


[warning] 48-48: Unused method argument: state

(ARG002)


[warning] 48-48: Dynamically typed expressions (typing.Any) are disallowed in state

(ANN401)


[warning] 48-48: Unused method argument: runtime

(ARG002)


[warning] 48-48: Dynamically typed expressions (typing.Any) are disallowed in runtime

(ANN401)


[warning] 115-118: Use ternary operator tool_args = raw_args if isinstance(raw_args, Mapping) else {"value": raw_args} instead of if-else-block

Replace if-else-block with tool_args = raw_args if isinstance(raw_args, Mapping) else {"value": raw_args}

(SIM108)


[warning] 122-122: Missing return type annotation for private function _emit_tool_mark

Add return type annotation: None

(ANN202)


[warning] 129-129: Dynamically typed expressions (typing.Any) are disallowed in result

(ANN401)

python/tests/integrations/deepagents/test_deepagents_integration.py

[warning] 32-32: Dynamically typed expressions (typing.Any) are disallowed in func

(ANN401)


[warning] 32-32: Dynamically typed expressions (typing.Any) are disallowed in args

(ANN401)


[warning] 32-32: Unused function argument: kwargs

(ARG001)


[warning] 32-32: Dynamically typed expressions (typing.Any) are disallowed in **kwargs

(ANN401)


[warning] 32-32: Dynamically typed expressions (typing.Any) are disallowed in execute_side_effect

(ANN401)


[warning] 142-142: Unused function argument: request

(ARG001)


[warning] 143-143: Avoid specifying long messages outside the exception class

(TRY003)


[warning] 145-146: Use a single with statement with multiple contexts instead of nested with statements

(SIM117)

🔇 Additional comments (50)
python/tests/integrations/langchain/test_middleware.py (1)

15-15: Import update is clean and low-risk.

No concerns with this change in the test module.

pyproject.toml (1)

87-90: Optional dependency group addition looks correct.

The new deepagents extra is well-scoped and appropriately version-bounded.

ATTRIBUTIONS-Python.md (1)

1956-1964: ⚡ Quick win

No action needed. The deepagents 0.5.9 package is correctly attributed with the MIT license in the file. The note about no license file in the locked artifact is contextual information indicating the license is sourced from package metadata rather than a bundled file—a common pattern. The attribution is complete and compliant.

python/tests/conftest.py (1)

18-30: LGTM!

The fixture implementation is clean and follows pytest best practices. Using uuid4() for subscriber names prevents collisions in parallel test runs, and the yield-based teardown ensures deregistration even if tests fail.

python/nemo_flow/integrations/deepagents/README.md (2)

6-49: LGTM!

The setup instructions and usage example are clear and well-structured. The code blocks are properly introduced with complete sentences, following documentation guidelines.


51-67: LGTM!

The feature documentation clearly describes the integration's observability scope and remote async subagent limitations.

python/nemo_flow/integrations/deepagents/_events.py (6)

34-69: LGTM!

The categorization helpers correctly map Deep Agents tool and backend names to semantic categories with appropriate fallbacks.


72-82: LGTM!

The json_safe function correctly handles nested structures and edge cases, with appropriate fallback to repr() for non-JSON-serializable values.


85-107: LGTM!

The summarize_value function appropriately handles different value types and extracts relevant attributes from message-like objects for observability payloads.


110-138: LGTM!

The tool_event_data builder correctly extracts relevant fields from tool arguments and includes optional result/error information.


141-161: LGTM!

The backend_event_data builder provides consistent payload structure for backend method calls.


164-188: LGTM!

The broad exception catch at line 187 is appropriate for observability code. It ensures mark emission failures never disrupt application flow while preserving diagnostic information via debug logging.

python/nemo_flow/integrations/deepagents/callbacks.py (7)

20-22: LGTM!

The initialization correctly sets up the HITL tracking state and delegates to the parent handler.


24-36: LGTM!

The mark emission logic correctly distinguishes HITL interrupts from other graph interrupts, with safe state tracking using discard().


38-45: LGTM!

The HITL mark emission correctly wraps the shared emit_mark utility with appropriate metadata.


47-54: LGTM!

The key generation correctly handles the checkpoint namespace as a sequence while properly excluding string types.


56-60: LGTM!

The string normalization helper is straightforward and correct.


62-67: LGTM!

The HITL interrupt detection correctly validates the interrupts collection and delegates to payload checking.


69-89: LGTM!

The HITL payload detection correctly validates the nested Deep Agents human-in-the-loop structure with appropriate type guards.

python/nemo_flow/integrations/deepagents/middleware.py (5)

29-42: LGTM!

The initialization correctly stores configuration and converts sequences to lists for safe mutation.


44-50: LGTM!

The lifecycle hooks correctly emit configuration marks. The unused state and runtime parameters are part of the middleware protocol signature.


52-68: LGTM!

The synchronous tool wrapper correctly emits lifecycle marks with proper error handling that preserves exceptions.


70-86: LGTM!

The async tool wrapper mirrors the sync implementation with correct await handling.


88-109: LGTM!

The configuration mark emission correctly builds a payload from available configuration and only emits when data is present.

python/nemo_flow/integrations/deepagents/backend.py (8)

32-42: LGTM!

The wrapper initialization and delegation pattern correctly implements the transparent proxy pattern with __wrapped__ and __getattr__.


44-98: LGTM!

The filesystem method wrappers correctly delegate to the instrumented call helpers with appropriate sync/async handling.


100-110: LGTM!

The file transfer methods are correctly implemented.


112-161: LGTM!

The convenience methods correctly wrap the base methods with appropriate event name overrides, and single-file download correctly extracts the first result.


163-191: LGTM!

The synchronous call wrapper correctly emits lifecycle marks with proper error handling.


193-221: LGTM!

The async call wrapper mirrors the sync implementation with correct await handling.


224-248: LGTM!

The sandbox backend wrapper correctly preserves the sandbox protocol while adding observability. The timeout validation at line 246-247 prevents invalid configurations from being passed to backends that don't support per-command timeouts.


251-257: LGTM!

The factory function correctly selects the appropriate wrapper based on the backend's protocol support, avoiding double-wrapping.

python/nemo_flow/integrations/deepagents/__init__.py (8)

16-36: LGTM!

The function correctly merges kwargs and overrides, and processes configuration sequences with appropriate helpers.


37-48: LGTM!

The backend instrumentation logic correctly handles already-wrapped backends and conditional wrapping based on the instrument_backend flag.


50-60: LGTM!

The middleware injection correctly uses the deduplication helper to avoid adding duplicate middleware.


62-65: LGTM!

The subagent instrumentation correctly applies instrumentation conditionally and returns the modified kwargs.


68-71: LGTM!

The middleware deduplication correctly prevents adding duplicate NeMo Flow middleware instances.


74-89: LGTM!

The subagent instrumentation correctly preserves non-dict subagents while adding middleware to dict-based subagents.


92-108: LGTM!

The subagent summary builder correctly handles both mapping and object-style subagents, extracting relevant metadata for observability.


111-118: LGTM!

The sequence normalization helper correctly handles strings, sequences, and other values, converting them to a consistent string sequence format.

python/tests/integrations/deepagents/test_deepagents_integration.py (10)

30-41: LGTM!

The mock fixture correctly handles both sync and async tool execution. The unused kwargs parameter is part of the side effect signature.


44-69: LGTM!

The test fixtures and helper functions are well-structured and provide clean assertion utilities.


72-109: LGTM!

The parametrized test provides excellent coverage of different Deep Agents tool categories with appropriate assertions on mark structure and metadata.


112-134: LGTM!

The async tool call test correctly validates async tool wrapping with appropriate mark assertions.


137-152: LGTM!

The error handling test correctly validates that error marks are emitted before re-raising exceptions.


155-171: LGTM!

The configuration mark test correctly validates that middleware emits configured skills, subagents, and backend information.


174-214: LGTM!

The HITL test comprehensively validates human-in-the-loop interrupt detection and mark emission with correct payload structure.


217-243: LGTM!

The fallback test correctly validates that non-HITL interrupts emit generic LangGraph marks without Deep Agents-specific metadata.


246-291: LGTM!

The backend instrumentation tests provide good coverage of both sync and async backend operations with appropriate mark assertions.


294-341: LGTM!

The sandbox protocol and integration wiring tests provide comprehensive validation of backend wrapping and kwargs transformation logic.

Comment thread ATTRIBUTIONS-Python.md
Comment thread python/nemo_flow/integrations/deepagents/middleware.py
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
…nts-int-p2

Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
…nts-int-p2

Signed-off-by: David Gardner <dagardner@nvidia.com>
@dagardner-nv dagardner-nv marked this pull request as ready for review May 12, 2026 23:38
@dagardner-nv dagardner-nv requested review from a team as code owners May 12, 2026 23:38
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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 @.github/workflows/ci_python.yml:
- Around line 113-127: Add the same "Install Windows ARM64 OpenSSL" step that's
in the Test job into the Package job so packaging uses the identical OpenSSL
provisioning; copy the PowerShell block that clones vcpkg (branch 2026.04.27),
bootstraps it, runs vcpkg.exe install openssl:arm64-windows-static-md, sets
$opensslDir, and exports OPENSSL_DIR, OPENSSL_STATIC, VCPKG_ROOT and
VCPKGRS_TRIPLET to GITHUB_ENV within the Package job steps (ensure the step name
and environment variable names match the Test job: OPENSSL_DIR, OPENSSL_STATIC,
VCPKG_ROOT, VCPKGRS_TRIPLET).
- Around line 119-121: Replace the tag-based vcpkg clone with the explicit
commit SHA: change the git clone invocation that uses "--branch 2026.04.27" to
use the full commit SHA "56bb2411609227288b70117ead2c47585ba07713" (the command
referencing vcpkgRoot and the subsequent bootstrap/vcpkg.exe steps remain the
same) so the workflow pins vcpkg to that exact commit for reproducible builds.

In `@python/nemo_flow/integrations/deepagents/middleware.py`:
- Around line 113-119: The code currently uses request.tool_call.get("args")
which converts missing or falsy values to {}, losing legitimate falsy payloads
like 0, false, or "". Change the logic to detect presence of the "args" key
rather than truthiness: if "args" in request.tool_call set raw_args =
request.tool_call["args"] else raw_args = {}. Then keep the existing
normalization: if isinstance(raw_args, Mapping) assign tool_args = raw_args else
tool_args = {"value": raw_args}; this preserves falsy payloads while still
defaulting when the key is absent.
🪄 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: 390ef4f0-4c22-4be4-8b1e-91fb22df2fd9

📥 Commits

Reviewing files that changed from the base of the PR and between aa3b66e and 47b225e.

📒 Files selected for processing (5)
  • .github/workflows/ci_check.yml
  • .github/workflows/ci_python.yml
  • justfile
  • python/nemo_flow/integrations/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_integration.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (21)
.github/workflows/**/*.{yml,yaml}

📄 CodeRabbit inference engine (.agents/skills/maintain-ci/SKILL.md)

.github/workflows/**/*.{yml,yaml}: Put permissions: on each job that needs token access in GitHub Actions workflows
Avoid workflow-level permissions unless the repository intentionally centralizes them and the inheritance tradeoff is documented
Keep third-party actions pinned to full commit SHAs and preserve the readable version comment after the SHA
Prefer action-native or ecosystem-native caching over generic actions/cache in GitHub Actions workflows
Use lockfiles or dependency manifests to drive cache invalidation in GitHub Actions workflows
Keep deploy and publish permissions isolated to the jobs that need them
Read both caller and callee when a workflow uses workflow_call in GitHub Actions
Put release-tag validation in the earliest practical caller job when the pipeline has tag-based publish behavior
Keep release-tag policy aligned with RELEASING.md: raw SemVer tags only, no leading v
contents: read is the default minimum for checkout-based build, test, docs, and packaging jobs
pull-requests: read is required for PR metadata lookup jobs in GitHub Actions workflows
pages: write and id-token: write should be limited to Pages deployment jobs and any caller that invokes them through a reusable workflow
For reusable workflows, the caller must grant every permission the called jobs require and the callee cannot elevate beyond what the caller provides
Prefer astral-sh/setup-uv cache support with cache-dependency-glob anchored to uv.lock for Python dependency caching
Prefer Swatinem/rust-cache with explicit shared-key and workspaces instead of ad hoc target-directory caching
Avoid caching generated outputs that can hide stale behavior unless the repo already relies on them deliberately
Ensure each job has the minimum permissions it needs during GitHub Actions CI review
Ensure reusable workflow callers grant only the scopes their callees require
Ensure every external action is pinned to a full SHA in GitHub Actions workflows
Ensure cache ...

Files:

  • .github/workflows/ci_check.yml
  • .github/workflows/ci_python.yml
{.github/**/*.{yml,yaml},*.patch,scripts/**/*,*.sh,*.bat,Dockerfile*}

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update CI configuration, patch files, and build scripts with new functional identifiers after rename operations

Files:

  • .github/workflows/ci_check.yml
  • .github/workflows/ci_python.yml
{.github/workflows/*.{yml,yaml},.gitlab-ci.yml}

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

Ensure CI workflow references match local package names and installation methods

Files:

  • .github/workflows/ci_check.yml
  • .github/workflows/ci_python.yml
{.github/**,.gitlab-ci.yml,.pre-commit-config.yaml,justfile,scripts/**}

⚙️ CodeRabbit configuration file

{.github/**,.gitlab-ci.yml,.pre-commit-config.yaml,justfile,scripts/**}: Review automation changes for reproducibility, pinned versions where appropriate, secret handling, and consistency with the documented validation matrix.
Pay attention to commands that need generated native artifacts, FFI libraries, or platform-specific environment variables.

Files:

  • .github/workflows/ci_check.yml
  • .github/workflows/ci_python.yml
  • justfile
justfile

📄 CodeRabbit inference engine (.agents/skills/update-project-version/SKILL.md)

justfile: Keep set_project_version, set_cargo_workspace_version, and set_node_package_version helper functions aligned with actual version fields when editing helper code
Reuse set_npm_package_version helper function for both Node and WebAssembly packaging recipes

Files:

  • justfile
**/*.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
Use ty for 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/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_integration.py
**/*.{rs,py,go,js,ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use SONAR_IGNORE_START / SONAR_IGNORE_END markers 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/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_integration.py
python/nemo_flow/**/*.py

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Use snake_case naming convention for Python API implementations and wrappers

Files:

  • python/nemo_flow/integrations/deepagents/middleware.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/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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 follow docs/integrate-frameworks/adding-scopes.md

Files:

  • python/nemo_flow/integrations/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/middleware.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/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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, use uv run ruff format python to format Python files

Files:

  • python/nemo_flow/integrations/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/middleware.py
  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/middleware.py
**/test_*.py

📄 CodeRabbit inference engine (.agents/skills/test-python-binding/SKILL.md)

Run focused pytest first when you know the affected area using pytest -k "<pattern>"

Files:

  • python/tests/integrations/deepagents/test_deepagents_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/deepagents/test_deepagents_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/deepagents/test_deepagents_integration.py
🧠 Learnings (1)
📚 Learning: 2026-05-03T04:23:07.497Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Flow PR: 46
File: .github/workflows/ci_rust.yml:31-64
Timestamp: 2026-05-03T04:23:07.497Z
Learning: In GitHub Actions workflow YAML, it’s valid to conditionally disable a service container by setting the service container’s `image` to an empty string (`''`) via a matrix variable (e.g., `redis_service_image: ''`). This intentionally makes the runner skip service initialization for that matrix entry rather than failing the job. When reviewing workflows, don’t flag this as an error if the workflow uses an empty `image` to disable the service on specific matrix entries (e.g., OS-specific setups); verify the `image` is sourced from the matrix variable and that the service is only expected to be available when a non-empty image is provided.

Applied to files:

  • .github/workflows/ci_check.yml
  • .github/workflows/ci_python.yml
🪛 Ruff (0.15.12)
python/nemo_flow/integrations/deepagents/middleware.py

[warning] 44-44: Unused method argument: state

(ARG002)


[warning] 44-44: Dynamically typed expressions (typing.Any) are disallowed in state

(ANN401)


[warning] 44-44: Unused method argument: runtime

(ARG002)


[warning] 44-44: Dynamically typed expressions (typing.Any) are disallowed in runtime

(ANN401)


[warning] 48-48: Unused method argument: state

(ARG002)


[warning] 48-48: Dynamically typed expressions (typing.Any) are disallowed in state

(ANN401)


[warning] 48-48: Unused method argument: runtime

(ARG002)


[warning] 48-48: Dynamically typed expressions (typing.Any) are disallowed in runtime

(ANN401)


[warning] 115-118: Use ternary operator tool_args = raw_args if isinstance(raw_args, Mapping) else {"value": raw_args} instead of if-else-block

Replace if-else-block with tool_args = raw_args if isinstance(raw_args, Mapping) else {"value": raw_args}

(SIM108)


[warning] 129-129: Dynamically typed expressions (typing.Any) are disallowed in result

(ANN401)

python/tests/integrations/deepagents/test_deepagents_integration.py

[warning] 37-37: Dynamically typed expressions (typing.Any) are disallowed in func

(ANN401)


[warning] 37-37: Dynamically typed expressions (typing.Any) are disallowed in args

(ANN401)


[warning] 37-37: Unused function argument: kwargs

(ARG001)


[warning] 37-37: Dynamically typed expressions (typing.Any) are disallowed in **kwargs

(ANN401)


[warning] 37-37: Dynamically typed expressions (typing.Any) are disallowed in execute_side_effect

(ANN401)


[warning] 52-52: Dynamically typed expressions (typing.Any) are disallowed in _tools

(ANN401)


[warning] 52-52: Dynamically typed expressions (typing.Any) are disallowed in *_args

(ANN401)


[warning] 52-52: Dynamically typed expressions (typing.Any) are disallowed in **_kwargs

(ANN401)


[warning] 154-154: Unused function argument: request

(ARG001)


[warning] 155-155: Avoid specifying long messages outside the exception class

(TRY003)


[warning] 157-158: Use a single with statement with multiple contexts instead of nested with statements

(SIM117)


[warning] 336-336: Boolean-typed positional argument in function definition

(FBT001)

🔇 Additional comments (3)
justfile (1)

653-653: Good parity between build and test env sync.

Adding --extra deepagents in both paths keeps Python build/test environments aligned and avoids CI-only drift.

Also applies to: 782-782

.github/workflows/ci_check.yml (1)

112-112: Pre-commit environment update looks correct.

Including --extra deepagents here is consistent with the new integration test/dependency surface.

python/tests/integrations/deepagents/test_deepagents_integration.py (1)

84-410: Solid integration coverage for the new Deep Agents surface.

This suite exercises sync/async paths, error emission, backend wrapping, callback events, and an end-to-end agent flow with mark assertions.

Comment thread .github/workflows/ci_python.yml
Comment thread .github/workflows/ci_python.yml Outdated
Comment thread python/nemo_flow/integrations/deepagents/middleware.py Outdated
Signed-off-by: David Gardner <dagardner@nvidia.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/nemo_flow/integrations/deepagents/middleware.py`:
- Around line 88-110: The call to emit_mark in _emit_agent_configuration is
unguarded and can raise, breaking agent/tool execution for observability-only
failures; wrap the emit_mark(...) call in a try/except that catches Exception,
logs the error via the middleware logger (or a safe fallback like printing) and
otherwise suppresses the exception so flow continues unchanged, keeping the
existing data composition (using _agent_name, _skills, _subagents, _backend_name
and mark_base_name("skill")) intact; apply the same defensive pattern to the
other emit_mark sites noted around lines 123-140 to make mark emission
failure-safe across the middleware.
🪄 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: 919ead58-8673-4c65-93e9-60e40b1764f8

📥 Commits

Reviewing files that changed from the base of the PR and between 47b225e and 9b7e117.

📒 Files selected for processing (2)
  • .github/workflows/ci_python.yml
  • python/nemo_flow/integrations/deepagents/middleware.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (17)
.github/workflows/**/*.{yml,yaml}

📄 CodeRabbit inference engine (.agents/skills/maintain-ci/SKILL.md)

.github/workflows/**/*.{yml,yaml}: Put permissions: on each job that needs token access in GitHub Actions workflows
Avoid workflow-level permissions unless the repository intentionally centralizes them and the inheritance tradeoff is documented
Keep third-party actions pinned to full commit SHAs and preserve the readable version comment after the SHA
Prefer action-native or ecosystem-native caching over generic actions/cache in GitHub Actions workflows
Use lockfiles or dependency manifests to drive cache invalidation in GitHub Actions workflows
Keep deploy and publish permissions isolated to the jobs that need them
Read both caller and callee when a workflow uses workflow_call in GitHub Actions
Put release-tag validation in the earliest practical caller job when the pipeline has tag-based publish behavior
Keep release-tag policy aligned with RELEASING.md: raw SemVer tags only, no leading v
contents: read is the default minimum for checkout-based build, test, docs, and packaging jobs
pull-requests: read is required for PR metadata lookup jobs in GitHub Actions workflows
pages: write and id-token: write should be limited to Pages deployment jobs and any caller that invokes them through a reusable workflow
For reusable workflows, the caller must grant every permission the called jobs require and the callee cannot elevate beyond what the caller provides
Prefer astral-sh/setup-uv cache support with cache-dependency-glob anchored to uv.lock for Python dependency caching
Prefer Swatinem/rust-cache with explicit shared-key and workspaces instead of ad hoc target-directory caching
Avoid caching generated outputs that can hide stale behavior unless the repo already relies on them deliberately
Ensure each job has the minimum permissions it needs during GitHub Actions CI review
Ensure reusable workflow callers grant only the scopes their callees require
Ensure every external action is pinned to a full SHA in GitHub Actions workflows
Ensure cache ...

Files:

  • .github/workflows/ci_python.yml
{.github/**/*.{yml,yaml},*.patch,scripts/**/*,*.sh,*.bat,Dockerfile*}

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update CI configuration, patch files, and build scripts with new functional identifiers after rename operations

Files:

  • .github/workflows/ci_python.yml
{.github/workflows/*.{yml,yaml},.gitlab-ci.yml}

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

Ensure CI workflow references match local package names and installation methods

Files:

  • .github/workflows/ci_python.yml
{.github/**,.gitlab-ci.yml,.pre-commit-config.yaml,justfile,scripts/**}

⚙️ CodeRabbit configuration file

{.github/**,.gitlab-ci.yml,.pre-commit-config.yaml,justfile,scripts/**}: Review automation changes for reproducibility, pinned versions where appropriate, secret handling, and consistency with the documented validation matrix.
Pay attention to commands that need generated native artifacts, FFI libraries, or platform-specific environment variables.

Files:

  • .github/workflows/ci_python.yml
**/*.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
Use ty for 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/deepagents/middleware.py
**/*.{rs,py,go,js,ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use SONAR_IGNORE_START / SONAR_IGNORE_END markers 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/deepagents/middleware.py
python/nemo_flow/**/*.py

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Use snake_case naming convention for Python API implementations and wrappers

Files:

  • python/nemo_flow/integrations/deepagents/middleware.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/deepagents/middleware.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/deepagents/middleware.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/deepagents/middleware.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 follow docs/integrate-frameworks/adding-scopes.md

Files:

  • python/nemo_flow/integrations/deepagents/middleware.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/deepagents/middleware.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/deepagents/middleware.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, use uv run ruff format python to format Python files

Files:

  • python/nemo_flow/integrations/deepagents/middleware.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/deepagents/middleware.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/deepagents/middleware.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/deepagents/middleware.py
🧠 Learnings (1)
📚 Learning: 2026-05-03T04:23:07.497Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Flow PR: 46
File: .github/workflows/ci_rust.yml:31-64
Timestamp: 2026-05-03T04:23:07.497Z
Learning: In GitHub Actions workflow YAML, it’s valid to conditionally disable a service container by setting the service container’s `image` to an empty string (`''`) via a matrix variable (e.g., `redis_service_image: ''`). This intentionally makes the runner skip service initialization for that matrix entry rather than failing the job. When reviewing workflows, don’t flag this as an error if the workflow uses an empty `image` to disable the service on specific matrix entries (e.g., OS-specific setups); verify the `image` is sourced from the matrix variable and that the service is only expected to be available when a non-empty image is provided.

Applied to files:

  • .github/workflows/ci_python.yml
🪛 Ruff (0.15.12)
python/nemo_flow/integrations/deepagents/middleware.py

[warning] 44-44: Unused method argument: state

(ARG002)


[warning] 44-44: Dynamically typed expressions (typing.Any) are disallowed in state

(ANN401)


[warning] 44-44: Unused method argument: runtime

(ARG002)


[warning] 44-44: Dynamically typed expressions (typing.Any) are disallowed in runtime

(ANN401)


[warning] 48-48: Unused method argument: state

(ARG002)


[warning] 48-48: Dynamically typed expressions (typing.Any) are disallowed in state

(ANN401)


[warning] 48-48: Unused method argument: runtime

(ARG002)


[warning] 48-48: Dynamically typed expressions (typing.Any) are disallowed in runtime

(ANN401)


[warning] 130-130: Dynamically typed expressions (typing.Any) are disallowed in result

(ANN401)

🔇 Additional comments (4)
.github/workflows/ci_python.yml (2)

113-129: Mirror this OpenSSL provisioning in Package for windows-arm64.

Line 113 adds the bootstrap only in Test. Package still builds windows-arm64 artifacts without the same OpenSSL setup, so packaging can fail on release/tag runs.


113-129: Good hardening on Windows ARM64 OpenSSL bootstrap.

Line 120 now pins vcpkg to a full commit SHA, which improves reproducibility and supply-chain determinism for this path.

python/nemo_flow/integrations/deepagents/middleware.py (2)

111-121: Args normalization here is solid for falsy payloads.

The raw_args is None guard preserves 0, False, and "" instead of collapsing them to {}.


44-50: This concern is based on incorrect assumptions about the class hierarchy.

NemoFlowMiddleware does not define before_agent or abefore_agent—these methods are inherited from langchain.agents.middleware.AgentMiddleware. The deepagents overrides intentionally add Deep Agents-specific telemetry (_emit_agent_configuration) without delegating to a parent implementation that doesn't exist at that override point. Where deepagents does wrap base behavior (e.g., wrap_tool_call, awrap_tool_call), it correctly calls super().

Comment on lines +88 to +110
def _emit_agent_configuration(self) -> None:
data: dict[str, Any] = {}
if self._agent_name is not None:
data["agent_name"] = self._agent_name

if self._skills is not None:
data["skills"] = list(self._skills)

if self._subagents is not None:
data["subagents"] = list(self._subagents)

if self._backend_name is not None:
data["backend"] = self._backend_name

if data:
emit_mark(
mark_base_name("skill"),
"skill",
"configured",
data,
metadata={"agent_name": self._agent_name} if self._agent_name is not None else None,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Make mark emission failure-safe to avoid breaking tool/agent execution.

emit_mark(...) is on the hot path and currently unguarded. If mark emission raises, this middleware can fail agent/tool flows for observability-only reasons.

Proposed minimal hardening
+import logging
+
+logger = logging.getLogger(__name__)
+
 class NemoFlowDeepAgentsMiddleware(NemoFlowMiddleware):
@@
     def _emit_agent_configuration(self) -> None:
@@
         if data:
-            emit_mark(
-                mark_base_name("skill"),
-                "skill",
-                "configured",
-                data,
-                metadata={"agent_name": self._agent_name} if self._agent_name is not None else None,
-            )
+            self._safe_emit_mark(
+                mark_base_name("skill"),
+                "skill",
+                "configured",
+                data,
+                metadata={"agent_name": self._agent_name} if self._agent_name is not None else None,
+            )
@@
     def _emit_tool_mark(
@@
     ) -> None:
         if kind is not None:
-            emit_mark(
+            self._safe_emit_mark(
                 mark_base_name(kind),
                 kind,
                 phase,
                 tool_event_data(tool_name, tool_args, result=result, error=error),
                 metadata={"agent_name": self._agent_name} if self._agent_name is not None else None,
             )
+
+    def _safe_emit_mark(
+        self,
+        base_name: str,
+        scope: str,
+        phase: str,
+        data: Mapping[str, Any],
+        *,
+        metadata: Mapping[str, Any] | None = None,
+    ) -> None:
+        try:
+            emit_mark(base_name, scope, phase, data, metadata=metadata)
+        except Exception:
+            logger.debug("DeepAgents mark emission failed", exc_info=True)

As per coding guidelines, “Keep NeMo Flow optional in framework integrations” and “Preserve the framework's original behavior when NeMo Flow is absent.”

Also applies to: 123-140

🤖 Prompt for 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.

In `@python/nemo_flow/integrations/deepagents/middleware.py` around lines 88 -
110, The call to emit_mark in _emit_agent_configuration is unguarded and can
raise, breaking agent/tool execution for observability-only failures; wrap the
emit_mark(...) call in a try/except that catches Exception, logs the error via
the middleware logger (or a safe fallback like printing) and otherwise
suppresses the exception so flow continues unchanged, keeping the existing data
composition (using _agent_name, _skills, _subagents, _backend_name and
mark_base_name("skill")) intact; apply the same defensive pattern to the other
emit_mark sites noted around lines 123-140 to make mark emission failure-safe
across the middleware.

@willkill07 willkill07 added this to the 0.2.0 milestone May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature a new feature lang:python PR changes/introduces Python code size:XL PR is extra large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants