Skip to content

refactor(insights): port Analyst to Nooa - #1097

Merged
BrianNewsom merged 4 commits into
mainfrom
port-insights-analyst-to-nooa/brnewsom
Aug 6, 2026
Merged

refactor(insights): port Analyst to Nooa#1097
BrianNewsom merged 4 commits into
mainfrom
port-insights-analyst-to-nooa/brnewsom

Conversation

@BrianNewsom

@BrianNewsom BrianNewsom commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the Pydantic AI harness with a native Nooa Agent and CodeAct strategy
  • preserve the Analyst as one adaptive, read-only analysis run that returns one typed change-set for backend persistence
  • keep Opus 4.8 as the primary model through the Nooa/LiteLLM OpenAI-compatible NVIDIA gateway path, with GPT-5 mini for context summarization
  • replace Pydantic-specific event streaming and instrumentation with Nooa events and native Nooa OTLP tracing
  • remove the Pydantic AI dependencies, add Nooa, and narrow Python support to 3.12-3.13

Orchestration notes

  • Analyst intentionally remains one adaptive analyze() CodeAct run. Eval Author and Experimentalist use deterministic multi-stage orchestration; splitting Analyst would be a larger behavioral rewrite.
  • Scoped Intake reads are bound Analyst methods with inline model-facing contracts and hidden run dependencies.
  • The model performs no writes during analysis. It returns one validated AnalystResult; the existing backend then creates or updates Insights.
  • Nooa owns the 50-iteration bound, 3,600-second cell timeout, TodoManager, and 80k-token GPT-5-mini summarizer.
  • Analyst model selection remains fixed, unlike the configurable smart/mid/fast tiers used by the other Nooa agents.

Validation

  • pytest plugins/nemo-insights/tests -q: 594 passed, 1 skipped
  • Ruff lint and format checks passed
  • changed-file ty checks passed
  • uv lock --check passed with repository-pinned uv 0.9.17
  • full pre-commit: Ruff, type checking, lockfile, copyright, Helm docs, import-boundary, and merge-conflict hooks passed
  • Studio lint-staged hook was not runnable locally because the machine has Node 24 instead of the required 22.23.x and the isolated worktree has no installed lint-staged
  • live remote E2E passed against the freeplay platform: Opus 4.8 completed analysis, persisted one Insight with three trace references, and exported 35 Nooa Analyst spans in one session

Summary by CodeRabbit

  • New Features

    • Improved the Insights Analyst with typed results and scoped access to tracing, scoring, annotations, and insights.
    • Added configurable fast and smart model access through NVIDIA’s inference API.
    • Enhanced session-aware tracing, trace flushing, and secure remote endpoint handling.
    • Added verbose output for reasoning, tool activity, and code execution.
  • Bug Fixes

    • Improved CLI handling and messaging for analyst generation failures.
  • Tests

    • Expanded coverage for analyst execution, configuration, observability, and result validation.

Signed-off-by: Brian Newsom <brnewsom@nvidia.com>
@BrianNewsom
BrianNewsom requested review from a team as code owners August 5, 2026 16:46
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b0a81edb-4775-4efc-ac45-99341fb0cb8e

📥 Commits

Reviewing files that changed from the base of the PR and between 534340f and da10a35.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/analyst_backend.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/deps.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/run.py
  • plugins/nemo-insights/src/nemo_insights_plugin/cli.py
  • plugins/nemo-insights/tests/test_analyst_run.py
  • plugins/nemo-insights/tests/test_cli_profile.py
🚧 Files skipped from review as they are similar to previous changes (6)
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/analyst_backend.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/deps.py
  • plugins/nemo-insights/src/nemo_insights_plugin/cli.py
  • plugins/nemo-insights/tests/test_cli_profile.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/run.py
  • plugins/nemo-insights/tests/test_analyst_run.py

📝 Walkthrough

Walkthrough

The analyst migrated from Pydantic AI to Nooa. The change adds scoped read methods, Nooa tracing, LiteLLM model configuration, updated CLI error handling, and tests for the new execution paths.

Changes

Analyst migration

Layer / File(s) Summary
Runtime and model foundation
plugins/nemo-insights/pyproject.toml, plugins/nemo-insights/src/nemo_insights_plugin/analyst/model_config.py, plugins/nemo-insights/src/nemo_insights_plugin/analyst/observability.py, plugins/nemo-insights/src/nemo_insights_plugin/analyst/deps.py, plugins/nemo-insights/src/nemo_insights_plugin/client.py
The project now targets Python 3.12–3.13 and uses Nooa. Cached NVIDIA inference clients, native Nooa tracing, and injected runtime context are configured.
Analyst agent and read methods
plugins/nemo-insights/src/nemo_insights_plugin/analyst/agent.py, plugins/nemo-insights/src/nemo_insights_plugin/analyst/functions/*, plugins/nemo-insights/src/nemo_insights_plugin/analyst/result.py, plugins/nemo-insights/src/nemo_insights_plugin/analyst/analyst_backend.py
The analyst now uses a Nooa agent with scoped span, score, annotation, and Insight methods. It returns validated results through return_result.
Analyst execution and CLI errors
plugins/nemo-insights/src/nemo_insights_plugin/analyst/run.py, plugins/nemo-insights/src/nemo_insights_plugin/cli.py
Runs now use Analyst.analyze, enable LiteLLM parameter dropping, report Nooa events, and catch nooa.GenerationError.
Validation and integration updates
plugins/nemo-insights/tests/*, plugins/nemo-insights/examples/research-agent/tests/test_analyst_e2e.py, third_party/licenses.jsonl
Tests and examples cover the Nooa harness, tracing setup, execution events, generation errors, and the updated dependency closure and license manifest.

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant run_analyst
  participant Analyst
  participant AnalystBackend
  CLI->>run_analyst: start analyst run
  run_analyst->>Analyst: construct with deps and call analyze
  Analyst->>AnalystBackend: fetch scoped evidence
  AnalystBackend-->>Analyst: return spans, scores, annotations, or Insights
  Analyst-->>run_analyst: return validated AnalystResult
  run_analyst-->>CLI: return result or GenerationError
Loading

Possibly related PRs

Suggested reviewers: svvarom, aleckhoury

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: migrating the Insights Analyst to Nooa.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch port-insights-analyst-to-nooa/brnewsom

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@plugins/nemo-insights/src/nemo_insights_plugin/analyst/observability.py`:
- Around line 58-62: Update the tracing setup around _otlp_auth_headers so
Bearer authentication headers are only attached when the configured base_url
uses HTTPS; reject or omit authentication for remote HTTP endpoints before
calling exporters.otlp. Add coverage for a remote HTTP base_url with a Bearer
token and verify the token is not passed to the exporter.

In `@plugins/nemo-insights/src/nemo_insights_plugin/analyst/run.py`:
- Line 70: Move the _enable_litellm_drop_params() call inside the try block in
run_analyst(), before the LiteLLM import, so import failures enter the existing
cleanup scope and still close the injected client.
🪄 Autofix

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: CHILL

Plan: Enterprise

Run ID: 4702bd77-6f3b-417a-9d9f-6b4b8c3c55bc

📥 Commits

Reviewing files that changed from the base of the PR and between 6dd08d4 and d539a46.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (19)
  • plugins/nemo-insights/examples/research-agent/tests/test_analyst_e2e.py
  • plugins/nemo-insights/pyproject.toml
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/agent.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/analyst_backend.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/deps.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/functions/annotations.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/functions/insights.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/functions/spans.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/model_config.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/observability.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/result.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/run.py
  • plugins/nemo-insights/src/nemo_insights_plugin/cli.py
  • plugins/nemo-insights/src/nemo_insights_plugin/client.py
  • plugins/nemo-insights/tests/test_analyst_agent.py
  • plugins/nemo-insights/tests/test_analyst_observability.py
  • plugins/nemo-insights/tests/test_analyst_run.py
  • plugins/nemo-insights/tests/test_cli_profile.py
  • plugins/nemo-insights/tests/testbed/test_cli.py

Comment thread plugins/nemo-insights/src/nemo_insights_plugin/analyst/run.py Outdated
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 30781/39277 78.4% 62.8%
Integration Tests 18078/37229 48.6% 21.1%

Signed-off-by: Brian Newsom <brnewsom@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@plugins/nemo-insights/tests/test_analyst_observability.py`:
- Around line 74-80: Update build_intake_otlp_traces_endpoint to reject
non-HTTPS endpoints unless the host is an explicitly allowed loopback address,
while preserving valid HTTPS behavior. Ensure exporters.otlp cannot be
configured with other HTTP URLs, and add or update tests covering rejection of
non-loopback HTTP and acceptance of loopback HTTP.
🪄 Autofix

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: CHILL

Plan: Enterprise

Run ID: 989460ed-e1af-4b67-a760-c269efec6b97

📥 Commits

Reviewing files that changed from the base of the PR and between d539a46 and d65cea1.

📒 Files selected for processing (5)
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/observability.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/run.py
  • plugins/nemo-insights/tests/test_analyst_observability.py
  • plugins/nemo-insights/tests/test_analyst_run.py
  • third_party/licenses.jsonl
💤 Files with no reviewable changes (1)
  • third_party/licenses.jsonl
🚧 Files skipped from review as they are similar to previous changes (2)
  • plugins/nemo-insights/tests/test_analyst_run.py
  • plugins/nemo-insights/src/nemo_insights_plugin/analyst/observability.py

Comment thread plugins/nemo-insights/tests/test_analyst_observability.py Outdated
Signed-off-by: Brian Newsom <brnewsom@nvidia.com>

@callingmedic911 callingmedic911 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Left 1 comment, looks good otherwise

Comment thread plugins/nemo-insights/src/nemo_insights_plugin/analyst/run.py
Signed-off-by: Brian Newsom <brnewsom@nvidia.com>
@BrianNewsom
BrianNewsom enabled auto-merge August 5, 2026 23:43
@BrianNewsom
BrianNewsom added this pull request to the merge queue Aug 5, 2026
Merged via the queue into main with commit f206b4f Aug 6, 2026
59 checks passed
@BrianNewsom
BrianNewsom deleted the port-insights-analyst-to-nooa/brnewsom branch August 6, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants