The Python Tusk Drift SDK enables fast and deterministic API testing by capturing and replaying API calls made to/from your service. Automatically record real-world API calls, then replay them as tests using the Tusk CLI to find regressions. During replay, all outbound requests are intercepted with recorded data to ensure consistent behavior without side-effects.
For comprehensive guides and API reference, visit our full documentation.
- Initialization Guide - Set up the SDK in your Python application
- Environment Variables - Environment variables reference
- Quick Start Guide - Record and replay your first trace
- Python 3.9+
Tusk Drift currently supports the following packages and versions:
| Package | Supported Versions |
|---|---|
| Flask | >=2.0.0 |
| FastAPI | >=0.68.0 |
| Django | >=3.2.0 |
| Requests | all versions |
| HTTPX | all versions |
| aiohttp | all versions |
| urllib3 | all versions |
| grpcio (client-side only) | all versions |
| psycopg | >=3.1.12 |
| psycopg2 | all versions |
| Redis | >=4.0.0 |
| Kinde | >=2.0.1 |
| PyJWT | all versions |
| urllib.request | all versions |
If you're using packages or versions not listed above, please create an issue with the package + version you'd like an instrumentation for.
First, install the Tusk Drift CLI by following our CLI installation guide.
Use our AI agent to automatically set up Tusk Drift for your service:
cd path/to/your/service
export ANTHROPIC_API_KEY=your-api-key
tusk setupThe agent will analyze your codebase, install the SDK, instrument it into your application, create configuration files, and test the setup with recording and replay.
Alternatively, you can set up Tusk Drift manually:
-
Install the SDK:
pip install tusk-drift-python-sdk
-
Create configuration: Run
tusk initto create your.tusk/config.yamlconfig file interactively, or create it manually per the configuration docs. -
Initialize the SDK: Refer to the initialization guide to instrument the SDK in your service.
-
Record and replay: Follow the quick start guide to record and replay your first test!
Having issues?
- Check our initialization guide for common setup issues
- Create an issue or reach us at support@usetusk.ai.
Join our open source community on Slack.



