drums-sdk
Python SDK for Drums: isolated desktop environments for computer-use agents and RL. Create a desktop, act in it, take screenshots, fork it into copies of the same state, and score it with a task's checker. Standard library only; Python 3.9 or later.
Full documentation: console.drums.run/docs
Five-minute start
1. Install
python3 -m venv drums-venv
drums-venv/bin/pip install drums-sdk
The package on PyPI is drums-sdk; the import name is drums.
import drums
2. Point it at your Drums
The SDK reads two environment variables. Your API key comes from API Keys in the
console; it starts with drums_sk_ and is shown once.
export DRUMS_URL=https://beta.drums.run/gw # Drums Cloud gateway; or http://127.0.0.1:7070 for a local drumsd
export DRUMS_TOKEN=drums_sk_... # your API key
Check the connection:
import drums
client = drums.connect() # reads DRUMS_URL and DRUMS_TOKEN
print(client.health()["version"])
A 401 raises drums.AuthError: the key is mistyped, revoked or expired.
3. Create a computer, screenshot, act, verify, destroy
Save as quickstart.py and run drums-venv/bin/python quickstart.py. It starts a desktop with OSWorld task
e0df059f (rename a folder on the Desktop), waits until every gate of the episode has passed, saves a screenshot,
performs the task with one action, runs the task's checker and closes the desktop.
import drums
with drums.connect() as client: # closes every desktop it created when the block ends
with client.create(task="e0df059f", ttl=900) as env: # OSWorld task id; ttl: lifetime in seconds
env.wait_valid() # every gate of this episode passed
obs = env.observe() # PNG screenshot plus metadata
open("screen.png", "wb").write(obs.png)
print("task:", obs.meta["instruction"])
env.step({"type": "execute", "shell": True,
"command": "mv ~/Desktop/todo_list_Jan_1 ~/Desktop/todo_list_Jan_2"})
reward = env.verify(strict=False) # the task's checker, with the episode's validity
print("score", reward.score, "valid", reward.valid, reward.invalid_reasons)
print("computers left:", len(client.envs())) # 0: the with-block destroyed it
Expected output (ids and sizes differ):
task: I have a directory named "todo_list_Jan_1". Can you help me change its name into "todo_list_Jan_2"?
score 1 valid True []
computers left: 0
A GUI agent acts with pyautogui instead of a shell command: env.step("pyautogui.click(960, 540)").
Use a score only when valid is True; with the default strict=True, verify() raises InvalidEpisode
for an invalid episode instead of returning a reward.
4. Go further
- Fork one desktop into N copies of the same state for group rollouts:
with env.fork(8) as kids: ...(guide) - Run a policy over many tasks: Evaluate on OSWorld
drums.aiois the asyncio variant of the same calls;drums.hybridadds shell, file and app-API tools over one desktop;python -m drums.mcpserves them to an agent over MCP (stdio).- Every method: Python SDK reference. Every endpoint: HTTP API. If something fails: Errors.
How it behaves
- Cleanup.
with drums.connect() as client:closes every desktop the client created when the block ends, and so do process exit and SIGTERM/SIGHUP. Desktops and saved states also have server-side leases (default: reaped after 30 minutes unused), so a crashed trainer does not hold a host. - Validity. Every episode starts with a gate report (isolation, mounts, network, limits, state hash, processes
alive after resume).
Reward.validisTrueonly when every gate passed and the desktop was never quarantined. - Retries. GET requests are retried while the server is unreachable (up to
retry_s, default 60 s). POST and DELETE are never retried: after a lost reply the outcome is unknown, so checkclient.envs()before trying again. - Errors. Every failure is a typed exception under
drums.DrumsErrorcarrying the server's status, message and body; errors about a desktop carry its record and gate report.
Development
git clone https://github.com/Drums-Labs/drums-python-sdk.git
cd drums-python-sdk
python3 -m unittest discover -s tests -v # runs against a fake daemon; no network
See CHANGELOG.md for what changed in each version and RELEASE.md for how a release is cut.
Metadata
Release files for drums-sdk 0.2.5
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 |
|---|---|---|---|---|
| drums_sdk-0.2.5.tar.gz | 42.3 kB | With provenance | Details for drums_sdk-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| drums_sdk-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for drums_sdk-0.2.5-py3-none-any.whl |
Total release size: 72.6 kB
Release files / drums_sdk-0.2.5.tar.gz
| Download URL | drums_sdk-0.2.5.tar.gz |
|---|---|
| Size | 42.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
305ef06b613b9177bcf3696838155481250c57844d5f4f9591482e411b6b31d8
|
|
BLAKE2b-256 checksum How to use checksums |
5d12044d6f72fbabe19524ec00ab0f947ffc3c3f9f4d52562bd1645b483df909
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / drums_sdk-0.2.5-py3-none-any.whl
| Download URL | drums_sdk-0.2.5-py3-none-any.whl |
|---|---|
| Size | 30.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e1452572117e6821ded28e3787dd7fe07c8dc329ebecd12c207dc8547d7382b
|
|
BLAKE2b-256 checksum How to use checksums |
c383fea929ec489d87b2b966e71ba99cea462af9fbe278453f248cf69b0c69f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for drums-sdk 0.2.5
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for drums_sdk-0.2.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA 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.