Datasets:
File size: 1,467 Bytes
4ef198a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Verbatim copy of the quickstart block in Drums-Labs/drumsd docs/install.md section 3 (v0.2.1 docs, main 2026-11-22).
import drums
with drums.connect() as client: # DRUMS_URL, DRUMS_TOKEN; closes this client's envs at the end
client.reset_metrics() # cost from now on (the window otherwise includes idle time)
with client.create(task="e0df059f") as env: # an OSWorld task id (8+ characters), a JSON path, or a dict
env.wait_valid() # this episode's gates passed (5 s after ready)
obs = env.observe() # obs.png (1920x1080 PNG), obs.meta (instruction, ...)
env.step("pyautogui.hotkey('ctrl', 'alt', 't')") # pyautogui code, or an action dict
with env.fork(4, keep_state=False) as kids: # 4 independent copies; their saved state is deleted with them
for k in kids:
k.step({"type": "execute", "command": ["ls", "Desktop"]})
r = k.verify(strict=False) # the task's checker
print(k.id, r.score, r.valid, r.invalid_reasons)
state = env.save() # later: client.create(from_state=state)
client.delete_state(state) # or let its lease delete it (30 min unused)
print(client.metrics()["cost"]) # USD per valid episode / verified reward, this window
|