agentflight_diff_cassettes
Compares a baseline golden cassette against a candidate to detect agent behavioral regressions, tool sequence divergence, new tool failures, loops, and token or cost deltas after model or prompt upgrades.
Instructions
Compare a baseline golden AgentFlight cassette against a candidate cassette to detect behavioral regressions.
Purpose
Performs semantic trajectory diffing across model, prompt, or tool definition upgrades. Evaluates tool sequence divergence using Levenshtein distance and Longest Common Subsequence (LCS), identifies newly introduced tool failures, flags recursive loop regressions, and calculates token spend and USD cost deltas.
When to use
After upgrading LLM foundation models, prompt templates, or system instructions to verify agent behavior parity.
In CI/CD pipelines to block regressions when agent trajectory similarity drops below threshold or costs spike.
When NOT to use
Do NOT use to inspect single cassette integrity; use
agentflight_verify_cassetteinstead.Do NOT use to convert cassettes to telemetry traces; use
agentflight_export_otelinstead.
Behavior & Side Effects
Read-only: Reads both cassette files from disk without altering them.
Deterministic & Idempotent: Repeated invocations with identical cassettes yield exact identical diff metrics.
Returns structured diff metrics including similarity score (0.0 to 1.0), regression alerts, and cost deltas.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"baseline_path": "<baseline_path>",
"candidate_path": "<candidate_path>"
},
"name": "agentflight_diff_cassettes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| baseline_path | Yes | Filesystem path to the golden reference baseline cassette (.flight.json or .flight.jsonl). | |
| candidate_path | Yes | Filesystem path to the candidate cassette to evaluate against the baseline (.flight.json or .flight.jsonl). | |
| similarity_threshold | No | Minimum acceptable trajectory similarity coefficient in the range [0.0, 1.0]. Defaults to 0.80. | |
| max_cost_increase_pct | No | Maximum tolerated percentage increase in USD cost before triggering a cost regression alert. Defaults to 50.0. | |
| max_token_increase_pct | No | Maximum tolerated percentage increase in total tokens before triggering a token blowout alert. Defaults to 50.0. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| passed | Yes | True if candidate satisfies similarity and cost/token thresholds without critical regressions. | |
| similarity | Yes | Trajectory similarity coefficient between 0.0 and 1.0 based on normalized sequence alignment. | |
| baseline_id | No | Identifier or filename of baseline cassette. | |
| regressions | No | Detailed list of identified behavioral regressions (new tool errors, loop states, missing tools). | |
| token_delta | No | Net difference in total tokens consumed. | |
| candidate_id | No | Identifier or filename of candidate cassette. | |
| cost_delta_usd | No | USD cost variance between candidate and baseline trajectories. | |
| cost_increase_pct | No | Percentage increase in USD cost. | |
| token_increase_pct | No | Percentage increase in total token consumption. |