Skip to content

Research: Add VCR-style record/replay mode #1

@haasonsaas

Description

@haasonsaas

Context

VCR-pattern libraries (VCR.py, polly.js, go-vcr) provide "record real API calls, replay them deterministically" patterns for integration testing.

What to yoink

  • Record mode — proxy real API calls to OpenAI/Anthropic, capture request/response pairs as "cassettes"
  • Replay mode — match incoming requests against recorded cassettes, return deterministic responses
  • Request matching — configurable matching (exact, fuzzy, header-ignoring) for finding the right recorded response
  • Cassette management — versioned, human-readable recording files (YAML/JSON) that can be committed to repos

Approach

Mocktopus is already a drop-in mock for OpenAI/Anthropic APIs. Adding VCR-style recording makes it useful for a different workflow:

  1. Record real API interactions during manual testing
  2. Replay them in CI for deterministic, zero-cost integration tests
  3. Re-record when prompts or model behavior changes

This complements the existing mock approach — mocks for unit tests, VCR for integration tests.

References

Priority

Tier 3 — Complementary testing mode

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions