Skip to main content

droidlock

Multi-agent Android emulator & device lease manager: one Android emulator per agent session, for any coding agent, without agents fighting over adb or Gradle.

CI License

Why

When multiple coding agents or parallel sessions run Android builds and tests on the same machine, they collide over adb, install conflicting APKs on the same emulator, or kill each other's AVDs.

droidlock solves this for parallel sessions and cross-agent work:

  • Session-level isolation across parallel sessions of the same agent or different agents running side by side.
  • A universal adb shim (~/.local/bin/adb) that detects the active agent session when the agent exposes a recognized session variable, acquires or adopts its lease, and delegates to the droidlock adb guard.
  • Native plugins & hooks for OpenCode and Antigravity (covering ./gradlew device tasks, Maestro, Flutter, React Native, Expo, and automatic lease release on turn end).
  • Agent skills (SKILL.md) for 10 popular coding agents, plus native plugins for OpenCode and Antigravity, and droidlock run for any other agent or custom workflow.
  • An interactive installer that auto-detects which agents you have installed and lets you pick which ones to configure.

Supported Agents

droidlock includes built-in auto-detection and tailored integration for 12 popular agents. The universal adb shim is installed for every agent; it auto-acquires leases for recognized sessions, and any other agent or script can use droidlock run:

Agent Auto-detected via What droidlock installs
Claude Code ~/.claude / claude SKILL.md (uses CLAUDE_CODE_SESSION_ID / CLAUDE_PID) + universal adb shim
Cursor ~/.cursor / cursor SKILL.md + universal adb shim
Codex CLI ~/.codex / codex SKILL.md (uses CODEX_SESSION_ID) + universal adb shim
OpenCode ~/.config/opencode / opencode TypeScript plugin + universal adb shim
Hermes Agent ~/.hermes / hermes SKILL.md + universal adb shim
Gemini CLI ~/.gemini / gemini SKILL.md + universal adb shim
Antigravity ~/.gemini/config / agy Native plugin (plugin.json, hooks.json, hook.py, SKILL.md) + universal adb shim
Kiro ~/.kiro / kiro SKILL.md + universal adb shim
VS Code (Copilot Chat) ~/.vscode / code SKILL.md (~/.copilot/skills/droidlock/SKILL.md) + universal adb shim
GitHub Copilot CLI ~/.copilot / copilot SKILL.md + universal adb shim
JetBrains IDEs (Copilot) ~/.config/JetBrains / ~/.config/github-copilot SKILL.md + universal adb shim
Pi ~/.pi/agent / pi SKILL.md + universal adb shim
Any other agent Universal adb shim / CLI Shim installed; use droidlock run for device work

See docs/agents.md for full details per agent and how to use droidlock with any other agent.

Install

Requirements: Linux or macOS, Python 3.11+ (standard library only, zero external dependencies), and the Android SDK (platform-tools, emulator) with at least one AVD.

# Interactive installer (detects installed agents and lets you toggle them):
./install.sh

# Non-interactive options:
./install.sh --dry-run                       # preview what would change
./install.sh --yes                           # install for all detected agents
./install.sh --agents opencode,antigravity,pi --yes
./install.sh --agents all --yes

Then allow your AVDs and verify the setup from a normal user terminal:

droidlock admin discover --all --yes          # or ./install.sh --yes --discover
droidlock admin doctor

Run droidlock admin from your own terminal: agent hooks/permissions intentionally block agents from running admin commands.

How it works

Agent session A ── adb ... ────────> universal adb shim ──> droidlock lease + adb guard ──> emulator-5554
                └─ ./gradlew ... ──> plugin / hook ───────> ANDROID_SERIAL + lease ──────> Gradle guard

Agent session B ── adb ... ────────> universal adb shim ──> "held by session A" (refused)
  • Lease: an exclusive, temporary reservation for one AVD (owner, agent, session, serial, expiry).
  • Universal adb shim: detects the active agent session when the agent exposes a recognized session variable, adopts or acquires a lease, and delegates to the droidlock adb wrapper. Outside a recognized session it delegates to the wrapper without acquiring a lease.
  • Plugins & hooks: rewrite Gradle / Maestro / Flutter device commands with DROIDLOCK_LEASE and ANDROID_SERIAL, block adb emu kill / adb kill-server / droidlock admin, and release the lease on idle/stop without stopping the AVD.
  • Any agent via CLI: any agent or script can also wrap commands explicitly with droidlock run --where kind=emulator -- <command>.

Limits

This is a guardrail, not a sandbox: absolute-path adb, Android Studio's own deploy, and tools that talk to the adb server directly bypass it. See docs/limits.md.

Documentation

Upstream and license

droidlock is an unofficial downstream distribution based on banksman (Apache-2.0), developed by Evgenii Plokhov and contributors. It is not affiliated with or endorsed by the banksman project. The upstream snapshots are docs/upstream-README.md and docs/upstream-CHANGELOG.md; the attribution is in NOTICE and THIRD_PARTY_NOTICES.md.

droidlock is licensed under the Apache License 2.0. See LICENSE.


Resumen en español

droidlock es un gestor multi-agente de emuladores y dispositivos Android (Apache-2.0), basado en banksman. Garantiza un emulador Android exclusivo por sesión de agente sin que varios agentes peleen por adb o Gradle.

./install.sh              # selector interactivo de agentes detectados
./install.sh --yes        # instalar automáticamente para los agentes detectados
droidlock admin discover --all --yes
droidlock admin doctor

Incluye detección automática e integración para Claude Code, Cursor, Codex CLI, OpenCode, Hermes Agent, Gemini CLI, Antigravity, Kiro, VS Code (Copilot Chat), GitHub Copilot CLI, JetBrains IDEs y Pi: 10 agentes usan SKILL.md, y OpenCode y Antigravity usan plugins nativos. El shim universal de adb se instala para todos y auto-adquiere leases para las sesiones reconocidas; cualquier otro agente o script puede usar droidlock run. Es un guardrail, no un sandbox. Licencia Apache-2.0 con atribución a banksman en NOTICE y THIRD_PARTY_NOTICES.md.

Metadata

Release files for droidlock 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for droidlock 0.3.0
File Size Uploaded Provenance Actions
droidlock-0.3.0.tar.gz 487.4 kB With provenance Details for droidlock-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for droidlock 0.3.0
File Interpreter ABI Platform Actions
droidlock-0.3.0-py3-none-any.whl Python 3 none any Details for droidlock-0.3.0-py3-none-any.whl

Total release size: 722.8 kB

Release files / droidlock-0.3.0.tar.gz

Download URL droidlock-0.3.0.tar.gz
Size 487.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f517bb539879c1e1497f57b287b190646ea7a534fbc7b1ac50fb17784bf50d5a
BLAKE2b-256 checksum
How to use checksums
a07ec4dbe080c70f481a05327c40746ac3891ac438c33a57de7a56d1ef3717d7
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 Dec 1, 2026.

Transparency log

Release files / droidlock-0.3.0-py3-none-any.whl

Download URL droidlock-0.3.0-py3-none-any.whl
Size 235.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
abb747f9eb51263666dd3d8503f400ac648025799dbbe43c982df7de4eb1bb6e
BLAKE2b-256 checksum
How to use checksums
ccef181aface39591cdfa4740a3ebd2def7648dd7511597db5c1a1ec1e8760cd
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 Dec 1, 2026.

Transparency log

Security for droidlock 0.3.0

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.

Select from 2 files

Attestation for droidlock-0.3.0.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 Dec 1, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page