Skip to main content
Now that you have an agent working, you need to write tests to ensure that the quality of your answers doesn’t degrade as you add context or change the system instructions. Add tests inline in your .agent.yml file (the same place the agent lives):
You can add as many tests as you’d like, for as many prompts as you like. For example:
Run the test from the Tests dashboard in the Oxygen IDE — open the agent file, click Run tests, and Oxygen executes each prompt the configured number of times and surfaces a final accuracy score plus any consistency errors the judge LLM finds. To automate the same run from CI, call the Tests REST API.

Understanding Consistency Tests

Since Oxygen is built for data analysis, consistency tests are optimized for numerical data and analytical insights. The evaluator intelligently handles common data analysis scenarios:

What Gets Ignored (Not Considered Errors)

Numerical Rounding (< 0.1% difference):
  • $1,081,396 vs $1,081,395.67 ✅ Consistent
  • $1,065,619 vs $1,065,618.90 ✅ Consistent
  • Different database precision settings
  • Rounding from visualization tools
Grammar & Style Variations:
  • "Revenue amounts to $1M" vs "Revenue amount to $1M" ✅ Consistent
  • Different phrasing of the same insight
  • Synonym usage in descriptions
Formatting Differences:
  • Date formats, number formatting, whitespace

What Actually Fails Tests

Material disagreements like:
  • $500,000 vs $450,000 ❌ (10% difference)
  • "Sales increased" vs "Sales decreased" ❌ (contradictory)
  • Different conclusions or incompatible recommendations
This approach ensures your tests focus on factual correctness while being practical about data analysis realities.
See the default logic: The built-in consistency evaluator uses a detailed prompt optimized for data analysis. You can view the full default prompt to understand exactly how it evaluates consistency.

Customizing Evaluation Logic

For specific use cases, you can customize how consistency is evaluated by providing a custom prompt:
When to customize:
  • Default prompt (recommended): General data analysis, handles rounding intelligently
  • Strict custom prompt: Financial calculations, compliance reports requiring exact values
  • Lenient custom prompt: Trend analysis, qualitative insights, high-level summaries
  • Modified default: Start with the default prompt source and adapt it for your domain
Example: Adapting the default prompt You can copy the default CONSISTENCY_PROMPT and modify specific rules:

Advanced Testing Options

CI/CD Integration

For automated testing in CI/CD pipelines, use the JSON output format:
This outputs machine-readable JSON like {"accuracy": 0.855} that can be parsed by your CI tools.

Quality Gates

Enforce minimum accuracy thresholds to prevent regressions:
The command will exit with code 1 if the threshold isn’t met, making it perfect for CI quality gates.

Multiple Test Management

If you have multiple tests in your agent file, control how thresholds are evaluated:
For complete documentation on testing features, see the Testing Guide. At this point, you have a working agent as well as the ability to modify and test this agent. Congratulations!