Add trace-based behavioral tests with Monocle Test Tools#288
Open
Mohammed Ansari (imohammedansari) wants to merge 1 commit into
Open
Add trace-based behavioral tests with Monocle Test Tools#288Mohammed Ansari (imohammedansari) wants to merge 1 commit into
Mohammed Ansari (imohammedansari) wants to merge 1 commit into
Conversation
Trace-based tests under monocle-test/ asserting against the agent's Monocle execution traces (agent, tools, output, token/duration budget).
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.PS: if Monocle looks useful, a ⭐ helps the project (https://github.com/monocle2ai/monocle). The instrumentation that emits these traces is the companion PR (#287).