agentape
Record/replay testing for LLM agents. Think "VCR.py but for LLM SDKs" with semantic matching.
Installation
pip install agentape
Quick Start
import agentape
from openai import OpenAI
# Wrap the client
client = agentape.wrap(OpenAI())
# Record interactions
with agentape.record("tapes/my_flow.yaml"):
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}]
)
# Replay interactions (no API calls made)
with agentape.replay("tapes/my_flow.yaml"):
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}]
)
pytest Integration
import agentape
@agentape.use_tape("tapes/{test_name}.yaml")
def test_my_feature(openai_client):
response = openai_client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}]
)
assert "hello" in response.choices[0].message.content.lower()
Run tests with:
pytest tests/ --tape-mode=record # Record new tapes
pytest tests/ --tape-mode=replay # Replay existing (default)
pytest tests/ --tape-mode=off # Pass-through, no taping
License
MIT
Release files for agentape 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agentape-0.1.0.tar.gz | 17.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentape-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.4 kB
Release files / agentape-0.1.0.tar.gz
| Download URL | agentape-0.1.0.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34157b989bb1ae1b8089925330ab6b420ee9bbf595898797ae28a762fafb720b
|
|
BLAKE2b-256 checksum How to use checksums |
a6be526a53432dd2daa1eff5a21e6a0070099a97875eb4fcd12b9c8a6189b331
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / agentape-0.1.0-py3-none-any.whl
| Download URL | agentape-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2330405937f8b6446b39a26e1dcf37a5f3789c57f783fb858996a75d69ba79be
|
|
BLAKE2b-256 checksum How to use checksums |
8ecfbcdf29f410a7b3800ee09a237a3d72e657e5eec29df40aa78077ba6035b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|