Add trace-based behavioral tests with Monocle Test Tools - #2
Draft
imohammedansari wants to merge 1 commit into
Draft
Add trace-based behavioral tests with Monocle Test Tools#2imohammedansari wants to merge 1 commit into
imohammedansari wants to merge 1 commit into
Conversation
imohammedansari
added a commit
that referenced
this pull request
Jul 8, 2026
1 offline fluent test (only one recorded trace) + 1 live test. OpenAI-native search (no separate tool spans); asserts agent + output + token/duration budgets. Hallucination eval deferred. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
imohammedansari
force-pushed
the
monocle-test-tools
branch
from
July 8, 2026 22:03
e232d81 to
b550c23
Compare
imohammedansari
force-pushed
the
monocle-test-tools
branch
3 times, most recently
from
July 9, 2026 20:14
36c085b to
b2b5f2a
Compare
imohammedansari
force-pushed
the
monocle-test-tools
branch
2 times, most recently
from
July 9, 2026 22:52
27e80ca to
e23128d
Compare
Trace-based tests under monocle-test/ asserting against the agent's Monocle execution traces (agent, tools, output, token/duration budget).
imohammedansari
force-pushed
the
monocle-test-tools
branch
from
July 9, 2026 23:34
e23128d to
392cf83
Compare
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.
Summary
Adds a behavioral test suite that asserts against Open Deep Research's Monocle execution traces: which agent ran, what it was asked, what it returned, and its token and duration cost. Additive only, under
tests/monocle/, with no app-code changes.Why
The repo's existing tests are evaluation harnesses that score final reports over a benchmark with LangSmith and LLM judges. They exercise output quality, not what a real agent run actually did: which agent handled the request, what it returned, and what it cost. This adds that behavioral coverage, so if a later prompt, model, or route change alters routing, output, or token cost, a test catches it.
How it works
It uses Monocle Test Tools. The offline tests load a recorded trace from file with
with_trace_source("file", trace_path=...), which is fast, needs no keys, and is deterministic. They then assert with the fluent API:called_agent,contains_output/contains_any_output,under_token_limit,under_duration. The live test drives the real agent end to end and asserts on structure and budget only.The point of loading from file is that the same assertions run in both modes. You pin a check against a recorded trace while iterating (fast, no keys, deterministic), then run the identical check against a live run for real regression coverage. The offline tests and the live test here share the same fluent assertions for exactly this reason.
Open Deep Research runs its search inside the model call (OpenAI-native web search), so its traces carry no
agentic.toolspans; behavior is validated through the agent invocation, the output, and the workflow budget.Changes (all under
tests/monocle/)test_opendeepresearch.py: 4 offline file-loaded tests, one per curated question (Earth's seasons, renewable vs nonrenewable energy, ocean tides, TCP vs UDP), plus 1 live test (TCP vs UDP, guarded byOPENAI_API_KEY).conftest.py: Monocle setup,.envloading,run_opendeepresearch().traces/: 4 recorded traces, one per question.requirements.txt,README.md.