Bbednarski/nmf 41 hermes middleware nemoflow optional#29551
Closed
bbednarski9 wants to merge 3 commits into
Closed
Bbednarski/nmf 41 hermes middleware nemoflow optional#29551bbednarski9 wants to merge 3 commits into
bbednarski9 wants to merge 3 commits into
Conversation
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
…vents, so NeMo-Flow tool spans can close for built-ins that bypass model_tools.handle_function_call. Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Collaborator
|
Follows up on #28611 (same author, draft NeMo-Flow PR). This is a cleaner, non-draft version that adds the NeMo-Flow observability plugin as an optional in-tree plugin. Note: adds new files under |
This was referenced May 21, 2026
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR extends Hermes' native middleware hooks into an observer-grade telemetry surface and adds an optional NeMo-Flow observability plugin that consumes those hooks without making NeMo-Flow a required Hermes dependency.
The main problem this solves is telemetry fidelity. Before this change, observer plugins could see some LLM/tool activity, but several important lifecycle edges were lossy or hard to correlate: provider request IDs, turn IDs, tool-call IDs, approval decisions, blocked tools, Hermes-owned built-in tools, subagent boundaries, session finalization, and interrupted tool execution. That made it difficult for ATIF/ATOF exporters or other observability backends to reconstruct complete trajectories from public Hermes middleware alone.
This approach keeps the core Hermes contract backend-neutral. The middleware additions are additive fields on existing hooks, while the NeMo-Flow integration lives as a peer observability plugin. Existing plugins can ignore the new fields, and users only opt into NeMo-Flow if the optional package is installed and the plugin is enabled.
Related Issue
Fixes #
Type of Change
Changes Made
telemetry_schema_version = "hermes.observer.v1"and additive correlation fields across Hermes middleware hooks inhermes_cli/plugins.py,model_tools.py,agent/conversation_loop.py,agent/tool_executor.py,agent/agent_runtime_helpers.py,tools/approval.py,tools/delegate_tool.py,cli.py, andgateway/run.py.turn_id,api_request_id,tool_call_id, request/response payloads, timestamps, duration, status, error type/message, approval metadata, session boundary reason, and subagent parent/child lineage.status="blocked"so observers can close tool spans even when execution is skipped by guardrails, approval denial, or plugin policy.model_tools.handle_function_call, including built-in agent-loop tools, context-engine tools, memory-provider tools, and delegate paths.KeyboardInterruptduring tool execution so interrupted terminal spans close withstatus="cancelled"instead of leaving incomplete ATOF/ATIF trajectories.hermes.session.endrecordsinterrupted=trueandreason="keyboard_interrupt"before shutdown finalization.plugins/observability/nemo_flow/plugin.yamlplugins/observability/nemo_flow/__init__.pyplugins/observability/nemo_flow/README.mdHow to Test
Run the focused unit tests for the middleware/plugin paths:
Verify the latest cancellation regression path:
Local result:
15 passed.Run an end-to-end Hermes + NeMo-Flow smoke with local Ollama and inspect generated ATOF/ATIF:
/private/tmp/hermes-nemo-flow-e2e-dkhpmg/nemo-flow/atof/interrupted-sleep-fixed-atof.jsonl/private/tmp/hermes-nemo-flow-e2e-dkhpmg/nemo-flow/atif/interrupted-sleep-fixed-atif-20260520_171847_6b77ed.jsonscope startscope endwithstatus="cancelled"hermes.session.endmark withinterrupted=trueandreason="keyboard_interrupt"Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passqwen3.6:35b, Phoenix/ATIF visualization smokeDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A