Inspiration

AI Agents Don't Always Fail Loudly

AI agents are increasingly being deployed to automate complex workflows, but debugging them remains a major engineering challenge.

Unlike traditional applications, AI agents can fail without throwing an exception. A customer-support agent might repeatedly call a failing API, a research agent might generate unsupported claims, or a coding agent might produce a patch that passes basic tests while introducing new bugs.

Observability platforms help developers understand execution behavior through logs, metrics, and traces. However, identifying the underlying cause of an agent failure, determining an appropriate fix, and validating that fix can still require significant manual investigation.

We started with a question:

What if an AI-powered reliability engineer could analyze agent execution traces, identify likely root causes, propose targeted repairs, and validate those repairs before they reach production?

That idea became TraceGuard AI, an AI-agent reliability and debugging platform powered by NVIDIA Nemotron through Nebius Token Factory.

Our goal was to move beyond simply detecting failures and build a workflow that connects diagnosis, repair, and verification.

Try it live: TraceGuard AI Demo


What It Does

From Agent Failure to Verified Repair

TraceGuard AI helps developers investigate failures in autonomous AI systems through a structured, six-stage workflow.

1. Trace Ingestion and Failure Detection

TraceGuard processes agent execution traces, including supported OpenTelemetry GenAI spans and native trace formats.

A deterministic rule engine examines execution behavior for potential issues such as:

  • Invalid tool calls and schema violations
  • Repeated or unsuccessful tool executions
  • Unexpected execution timeouts
  • Potential prompt injection attempts
  • Unsupported claims and suspicious outputs

This initial analysis provides structured signals for deeper investigation.

2. AI-Powered Root Cause Analysis

TraceGuard integrates NVIDIA Nemotron through Nebius Token Factory to analyze complex execution sequences.

Instead of treating every failed operation as an independent problem, the system examines relationships between trace events to identify likely initiating failures and distinguish them from downstream symptoms.

The diagnosis includes relevant trace references, an explanation of the suspected failure, and a proposed code-level repair when sufficient context is available.

3. Sandboxed Patch Verification

Generating a patch is only part of solving a problem. The proposed change also needs to be tested.

TraceGuard supports isolated replay environments using restricted subprocess execution and Docker-based sandboxing.

The verification workflow evaluates proposed changes against visible acceptance tests and separately maintained regression tests.

If a patch fixes the original issue but introduces another failure, the system can reject it rather than automatically treating the repair as successful.

4. Counterfactual Patch Analysis

For repairs involving multiple code changes, TraceGuard supports leave-one-out ablation analysis.

Individual modifications are removed and evaluated to understand their contribution to the overall repair.

This provides additional evidence about which changes are useful, unnecessary, or potentially responsible for regressions.

5. Reproducible Regression Evidence

TraceGuard can generate executable pytest regression artifacts that developers can review and integrate into existing testing workflows.

Evidence metadata and SHA-256 hashes help associate generated artifacts with the corresponding analysis and verification results.

The objective is to make repair decisions inspectable and reproducible rather than relying exclusively on an LLM-generated explanation.

6. Interactive Developer Workspace

The application provides a developer-oriented dashboard for investigating failures and reviewing proposed repairs.

Its interfaces include:

  • Multi-file codebase exploration
  • Trace inspection and failure diagnosis
  • Code-diff visualization
  • Sandbox verification results
  • Counterfactual analysis through the Causal Lab
  • Model usage and inference cost reporting
  • Voice-assisted interaction for supported workflows

Together, these capabilities provide a unified environment for understanding and validating AI-agent failures.


How We Used NVIDIA Nemotron and Nebius Token Factory

NVIDIA Nemotron is a core component of TraceGuard's semantic diagnosis workflow.

Model: nvidia/nemotron-3-super-120b-a12b

Inference Provider: Nebius Token Factory

API Integration: OpenAI-compatible inference endpoint

We selected Nemotron to investigate execution failures that cannot be reliably identified through deterministic rules alone.

For example, a trace might contain several unsuccessful API calls, but the actual defect could originate earlier in the workflow through incorrect parameter construction or an invalid state transition.

TraceGuard provides the model with structured execution context and asks it to identify likely causal relationships, reference supporting trace events, and propose focused repairs.

Rather than allowing model-generated output to directly modify an application, we combine its recommendations with deterministic validation and isolated testing.

Evaluation

We developed a benchmark containing 26 manually labeled failure scenarios to compare three diagnostic approaches:

Diagnostic Approach Accuracy
Deterministic rules only 80.8%
Nemotron only 80.8%
Hybrid rules + Nemotron 92.3%

The hybrid approach correctly diagnosed 24 of the 26 benchmark cases.

In our recorded evaluation, we also observed:

  • Median diagnostic latency: Approximately 5.9 seconds
  • Mean estimated model inference cost: Approximately $0.00093 per diagnosis
  • Evaluation scope: 26 labeled scenarios

These results reflect our benchmark configuration and should not be interpreted as guarantees of performance across all production environments.

The evaluation reinforced an important design principle: deterministic rules and language models can complement each other when their responsibilities are clearly separated.


How We Built It

TraceGuard AI combines a Python-based backend, a modern web dashboard, model inference through Nebius Token Factory, and isolated verification environments.

Backend

We built the backend using:

  • Python 3.12 for core processing and analysis
  • FastAPI for REST endpoints and workflow orchestration
  • Pydantic v2 for structured request and response validation
  • SQLite for application data and analysis records
  • Python AST for static code inspection and validation
  • Pytest for automated testing and regression verification

The backend separates trace ingestion, deterministic detection, semantic diagnosis, patch processing, and verification into distinct components.

AI Inference

We integrated NVIDIA Nemotron through the Nebius Token Factory OpenAI-compatible API.

The inference layer handles structured diagnostic requests, response validation, and corrective retries for malformed model outputs.

We designed the workflow so that model-generated recommendations are treated as hypotheses requiring verification rather than automatically trusted fixes.

Sandboxed Execution

TraceGuard supports restricted subprocess execution and Docker-based isolation for patch testing.

Docker environments can be configured with network access disabled and reduced environment-variable exposure.

These safeguards help limit the execution environment, although they are not a substitute for a fully hardened production security boundary.

Frontend

We developed the dashboard using:

  • React 18
  • TypeScript
  • Vite
  • Interactive trace and topology visualizations
  • Code-diff inspection
  • Verification result panels
  • Model usage and cost reporting

We focused on creating a practical developer tool rather than a conversational interface that hides the underlying engineering evidence.

Multi-File Testing Environment

To demonstrate more realistic debugging scenarios, we developed a sample Payment Gateway SDK containing approximately 850 lines of Python across 13 files.

The sample includes interacting modules, dependency relationships, idempotency handling, and business-rule validation.

This environment helps evaluate failures that involve more than a single isolated function.


Challenges We Ran Into

1. Preventing Repairs That Only Pass Easy Tests

One of the most important challenges was distinguishing a genuinely useful repair from a patch that merely satisfies the most obvious test cases.

A generated patch can appear correct while introducing unexpected behavior elsewhere.

To address this, we designed a verification workflow that evaluates patches against acceptance tests and separate regression tests.

During development, this approach helped identify a proposed repair that passed the visible checks but failed additional test cases.

This reinforced our decision to make verification a required part of the repair workflow.

2. Identifying Root Causes Across Multiple Trace Events

Agent failures often produce cascading symptoms.

An incorrect tool parameter might cause an API error, trigger several retries, and eventually produce a misleading final response.

Simply detecting the last failed operation does not necessarily reveal the original defect.

We combined deterministic trace analysis with Nemotron-based semantic reasoning to investigate earlier events and generate more context-aware diagnoses.

3. Balancing Model Reasoning With Deterministic Validation

Language models can interpret complex execution context, but their conclusions are not always correct.

Rules are predictable and inexpensive, but they struggle with failures requiring semantic understanding.

We addressed this by assigning complementary responsibilities to both approaches and validating generated recommendations before accepting them.

4. Building a Practical Verification Environment

Executing model-generated code introduces reliability and security concerns.

We worked on separating diagnosis from execution, restricting sandbox environments, sanitizing configuration exposure, and reporting verification failures explicitly.

We also had to account for differences between local Windows development and Linux-based container execution.


Accomplishments That We're Proud Of

1. Building a Diagnosis-to-Verification Workflow

We brought trace inspection, root-cause analysis, patch generation, sandbox testing, and regression evidence into one application.

Rather than stopping at a diagnostic explanation, TraceGuard helps developers investigate whether a proposed repair actually addresses the failure.

2. Improving Diagnostic Accuracy Through Hybrid Analysis

On our 26-case benchmark, the hybrid approach achieved 92.3% diagnostic accuracy, compared with 80.8% for either individual approach.

Although the benchmark is relatively small, the result provides encouraging evidence for combining deterministic analysis with model-based reasoning.

3. Detecting an Overfitted Repair

Our verification workflow identified a proposed patch that satisfied visible tests but failed additional regression checks.

This demonstrated why independent testing matters when evaluating AI-generated code.

4. Exploring Counterfactual Repair Validation

We implemented leave-one-out analysis to investigate the contribution of individual code changes.

This gives developers more evidence when reviewing complex repairs instead of accepting an entire patch without understanding its components.

5. Building an Automated Testing Foundation

Our reported test suite includes 52 passing automated tests covering core components such as detection, verification, and API behavior.

6. Cost-Aware Model Integration

Our evaluation recorded an estimated average inference cost below $0.001 per diagnosis using Nebius Token Factory.

This suggests that advanced semantic diagnosis may be practical for frequent developer workflows, subject to workload size, model pricing, and deployment conditions.


What We Learned

Building TraceGuard taught us that reliable AI systems need more than accurate model outputs.

1. AI-generated fixes require independent verification.

A plausible explanation or syntactically valid patch does not establish that the underlying problem has been resolved.

2. Deterministic analysis and semantic reasoning solve different problems.

Rules are effective for structural violations and predictable failure patterns. Language models are useful when understanding context, intent, and relationships between events.

Combining both can improve diagnostic coverage.

3. Observability becomes more actionable when connected to testing.

Execution traces become more useful when developers can connect them to suspected causes, proposed changes, and measurable verification outcomes.

4. Reproducibility matters.

Evidence references, regression tests, and recorded verification outcomes make it easier for developers to review and challenge automated recommendations.

5. Human oversight remains essential.

TraceGuard is designed to assist developers in investigating and validating repairs, not to assume that an AI-generated patch should be deployed without review.


What's Next for TraceGuard AI

We see TraceGuard as a foundation for more reliable AI-agent development workflows.

1. GitHub Actions Integration

We plan to develop a CI integration that detects relevant agent test failures, initiates trace analysis, and attaches proposed repairs and verification evidence to pull requests for developer review.

2. Hierarchical Model Routing

We want to explore using smaller models for routine anomaly triage while reserving larger reasoning models for complex, multi-file failures.

This could improve cost efficiency and reduce latency for common debugging tasks.

3. Kubernetes and OpenTelemetry Integration

We plan to expand telemetry ingestion through Kubernetes-compatible collectors and OpenTelemetry integrations, enabling broader analysis of agent workflows in distributed environments.

4. Larger Evaluation Benchmarks

Our current evaluation is an initial benchmark.

Future work includes expanding the dataset, introducing more realistic failure scenarios, comparing additional models, and measuring false-positive rates, repair success rates, and regression detection performance.

5. Developer Approval and Audit Workflows

We want to strengthen human review, evidence tracking, and approval controls so teams can incorporate automated diagnosis into existing engineering processes.


Closing Thoughts

TraceGuard AI is built around a simple principle: detecting a failure is useful, understanding its cause is better, and verifying the repair is essential.

By combining NVIDIA Nemotron's reasoning capabilities, Nebius Token Factory inference, deterministic analysis, and sandboxed regression testing, we explored how AI-assisted debugging can become more evidence-driven and reliable.

Our long-term vision is to help developers build AI agents that are not only capable, but also easier to understand, debug, and maintain.

TraceGuard AI: Diagnose. Repair. Verify.

Built With

Share this project:

Updates

Submission history