agentdevlabs
Python SDK for Agent Dev Labs Capture & Replay. wrap(client) records the calls your app makes through an OpenAI or
Anthropic client. Your provider key stays with your app.
pip install agentdevlabs
import openai
from agentdevlabs import wrap
client = wrap(openai.OpenAI())
Set up with a coding agent
- Check that
AGENT_DEV_LABS_TOKENis set in.env. If it isn't, stop and ask the user for it. Never create a token or write one into code, and never commit.env. The SDK reads the process environment, not.envitself, so make sure the app loads it. In Python callload_dotenv()from python-dotenv before wrapping the client, or export the variable. - Install
agentdevlabsand the provider SDK (openaioranthropic) with the project's own package manager. - Wrap the provider client where it is created:
wrap(openai.OpenAI())orwrap(anthropic.Anthropic()). LeaveAGENT_DEV_LABS_MODEunset unless the user asks, because it outranks the devkit toggle. - Run the app twice. The first call shows as captured and the second as replayed in the console's Logs; ask the user to look there, since you can't sign in.
Settings are environment variables only:
| Variable | Meaning |
|---|---|
AGENT_DEV_LABS_TOKEN |
Your workspace token. Without it the client runs unwrapped. |
AGENT_DEV_LABS_MODE |
auto, capture, replay or off, in any case. Overrides the server's mode. Any other value runs as auto, with one warning naming it. |
AGENT_DEV_LABS_DISABLED |
1, true, yes or on turns the SDK off; 0, false, no, off or empty leaves it on. Any other value turns it off, with one warning naming it. Beats every other setting. |
AGENT_DEV_LABS_API_URL |
The API to talk to. |
AGENT_DEV_LABS_REPLAY_SPEED |
How fast a replayed stream plays: realtime (the default), fast (10x), instant, or a number to divide the recorded pace by. |
AGENT_DEV_LABS_GROUP |
Names a trace group: calls are captured into it and replays use only its recordings. Letters, digits, ., _, / and -, up to 100. |
AGENT_DEV_LABS_CACHE_DIR |
Where replayed captures are cached, encrypted. Defaults to your OS cache directory. |
Replay in CI
Record a group on your machine, then replay only that group in CI. A call with no recording in the group fails with an error naming the cache key and the group (or saying the group doesn't exist), so CI never reaches the provider.
The group name uses letters, digits, ., _, / and -, up to 100 characters; anything else fails at startup. AGENT_DEV_LABS_TOKEN in CI must be a replay-only service token, which an owner or admin creates in the console's Access tokens page.
AGENT_DEV_LABS_GROUP=checkout-flow AGENT_DEV_LABS_MODE=capture pytest # once, locally
# .github/workflows/test.yml
name: test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv sync
- run: uv run pytest
env:
AGENT_DEV_LABS_TOKEN: ${{ secrets.AGENT_DEV_LABS_TOKEN }}
AGENT_DEV_LABS_GROUP: checkout-flow
AGENT_DEV_LABS_MODE: replay
Project rules: a worked example
A travel agent's system prompt carries today's date, a session UUID and a request id, so Monday's recording never matches on Tuesday. In the console's Project rules page, three masks make the calls match:
[0-9]{4}-[0-9]{2}-[0-9]{2}masks the date.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}masks the session UUID.req_[A-Za-z0-9]+masks the request id.
A mask changes only what matching reads, so the recording still holds the original text. To see which mask a pair of calls needs, open a trace, choose "Why didn't this replay?" on step 1 and "Try this rule" on a suggestion.
A card number the user typed should never be uploaded, so add a redact pattern such as [0-9]{4} [0-9]{4} [0-9]{4} [0-9]{4}. The SDK replaces it with [redacted] before upload; matching still uses the original, so redacting doesn't stop replays. The page's "Try it" box shows both results on a sample request that never leaves the browser.
Calls already recorded keep the rules they were captured with: after saving a rule, capture them again.
License and privacy
Apache-2.0. The SDK sends nothing beyond the capture and replay events described above: no usage analytics or telemetry.
Versions
Versions follow semantic versioning. Before 1.0, a minor release (0.1 to 0.2) may break your code; the changelog says how, and the API supports only the latest 0.x minor. From 1.0, the API supports the previous major version for 12 months after a new major ships. See the changelog.
Metadata
Release files for agentdevlabs 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentdevlabs-0.1.1.tar.gz | 73.2 kB | Without provenance | Details for agentdevlabs-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentdevlabs-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for agentdevlabs-0.1.1-py3-none-any.whl |
Total release size: 118.3 kB
Release files / agentdevlabs-0.1.1.tar.gz
| Download URL | agentdevlabs-0.1.1.tar.gz |
|---|---|
| Size | 73.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8778fb3e42962c5841f3b37efee8044c235587681a9290931bfd6cc68ebede9e
|
|
BLAKE2b-256 checksum How to use checksums |
f984931d1f39622efa904da594b14d55b4ec0a50d370a6a1e7341c0eec581072
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / agentdevlabs-0.1.1-py3-none-any.whl
| Download URL | agentdevlabs-0.1.1-py3-none-any.whl |
|---|---|
| Size | 45.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96ef407ce2f8bf0ff156fbb3811de52d856b7dc85188809a434ffbfbd4c62b17
|
|
BLAKE2b-256 checksum How to use checksums |
8e180f8e09a8034adc195cdf29dc64eccd1a6dfd4d61fce3b42ac3ff847f75ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for agentdevlabs 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.