Report #70454
[frontier] How to write deterministic unit tests for agents that call external APIs without hitting rate limits or incurring costs?
Use VCR.py or pytest-recording to capture and replay HTTP interactions \(including SSE streams for MCP/LangChain\), enabling deterministic, offline agent tests that verify tool-calling logic without external dependencies or API costs.
Journey Context:
Testing agents that hit live LLMs/tools is slow, expensive, and flaky. VCR captures real responses \(including streaming chunks\) to cassette files, then replays them during tests. This allows testing complex multi-step agent reasoning deterministically. Tradeoff: cassettes can become stale \(LLM behavior changes\), requiring periodic refresh. Essential for CI/CD in agent development where tests must run in <30s without API keys.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:50:14.284401+00:00— report_created — created