Skip to content
Back to skills

Agent Tool Replay Test

ASecurity

Replay recorded agent tool/LLM trajectories against deterministic fixtures to test argument validation, errors, idempotency, and side-effect boundaries—separate from live tool-selection quality.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 22, 2026
ai-agentsgotesting

Works with

  • cursor

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned October 22, 2026

npx -y skills add alivirgo/Major-AI-Skills --skill agent-tool-replay-test --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Agent Tool Replay Test?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Agent Tool Replay Test
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/alivirgo-agent-tool-replay-test/badge)](https://www.skillsdirectory.com/skills/alivirgo-agent-tool-replay-test)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: agent-tool-replay-test
description: "Replay recorded agent tool/LLM trajectories against deterministic fixtures to test argument validation, errors, idempotency, and side-effect boundaries—separate from live tool-selection quality."
category: development
risk: safe
source: self
source_type: self
date_added: "2026-09-11"
tags: ["ai-workflows", "testing", "tool-calling", "record-replay", "cassette", "idempotency", "ci"]
tools: ["claude", "cursor", "gemini", "codex"]
---

# Agent Tool Replay Test AI Skill Guide (Claude)

## Overview & Engine Architecture

Live agents are expensive and flaky. **Record/replay at the SDK or tool boundary** gives deterministic CI: assert validation, error handling, and “must not call” policies without paying for tokens. Replay **does not** prove the model still chooses the right tools—that needs live/eval gates (`@prompt-regression-gate`).

Claude operates as a Principal Agent Test Architect for **cassettes**, **contract assertions**, **clock/ID freezing**, and **unknown-outcome** handling after timeouts.

```
┌─────────────────────────────────────────────────────────────┐
│  RECORD (once): LLM decisions ± tool results → cassette     │
│  REPLAY (CI): inject recordings; optionally run real tools  │
│  ASSERT: schemas, sequences, deny-lists, idempotency        │
└─────────────────────────────────────────────────────────────┘
```

---

## Scope

- Read tool contracts: **read-only vs mutating**.  
- Use project test runner + mocks; no production networks in `replay` mode.  
- Sanitize cassettes (no credentials)—`@ai-pii-redaction-review`.  
- Label coverage: **replay contract** ≠ **e2e model behavior**.

---

## Fixture matrix (minimum)

| Case | Expect |
| :--- | :--- |
| Success | Valid args → OK result |
| Timeout | Bounded retry policy; **unknown outcome** path |
| Permission denied | No side effect; surfaced error |
| Malformed tool JSON | Reject via `@llm-json-contract-check` |
| Partial failure | Compensating / reconcile logic |
| Unknown fields / bad IDs | Validation reject before dispatch |
| Mutating call | AuthZ + idempotency key before effect |
| Policy deny | Tool absent from allow-list never invoked |

---

## Determinism rules

- Freeze clocks/randomness; stable paths in prompts (no `uuid4()` in recorded args).  
- Modes: `record` | `replay` (CI; miss = fail, no network) | `passthrough`.  
- Prefer SDK-boundary recorders (OpenAI/Anthropic patch) over brittle raw HTTP VCR for agents.  
- Two styles: (A) stub tool results entirely; (B) replay LLM decisions but **execute** tools against safe stubs—pick explicitly.

---

## Timeout / idempotency (critical)

After a timeout on `charge`/`send_email`, state is **unknown**. Blind replay can duplicate. Require: idempotency keys, reconcile-before-retry, or human handoff (`@ai-human-handoff-contract`).

---

## Assertions to ship

- Tool sequence / `called_with` schemas  
- Forbidden tools never called  
- Budget/step caps  
- Cassette diff on prompt drift (fail or re-record deliberately)

---

## Deliverable

Fixtures + traces + “must not occur” assertions + explicit statement that selection quality is out of scope for pure replay.

## Related skills

`@llm-json-contract-check`, `@prompt-regression-gate`, `@agent-injection-boundary-test`, `@llm-cost-latency-benchmark`

## Agent Operational Directive

> **MANDATORY**: Keep replay offline in CI. Sanitize cassettes. Test validation and side-effect gates. Never blind-retry mutating calls after unknown outcomes. Separate replay coverage from model tool-selection evals.

## Sources

Cassette/agentverify/pytest-agentcontract/langchain-replay patterns; industry emphasis on SDK-level record/replay and idempotent mutating tools.

Files in this skill

  • SKILL.md3.9 KB
  • gemini.md608 B
  • gpt.md802 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.