dejima — Python client
Thin Python client for the Dejima API: run a fleet of AI coding agents on hardware you own.
Alpha (0.x). The API is stable in shape (
v1/-prefixed) but fields may change until1.0. This client is hand-written over the REST surface and mirrorsopenapi.yaml; the only non-generated piece is the PTYSessionhelper.
Install
pip install dejima-sdk # REST client
pip install 'dejima[ws]' # + WebSocket PTY attach()
Quickstart
from dejima import Client
# host/token from $DEJIMA_HOST and $DEJIMA_TOKEN, or pass explicitly:
dj = Client(host="100.84.12.7:7273")
isl = dj.create_island(repo="git@github.com:you/foo.git", agent="claude-code")
print(isl["name"], isl["state"])
# add a second agent on its own worktree
dj.add_agent(isl["name"], type="codex")
# one-shot command
out = dj.exec(isl["name"], ["git", "status", "--short"])
print(out["stdout"], "exit", out["exit_code"])
# fleet view
for i in dj.list_islands():
print(i["name"], i["state"], len(i.get("agents", [])), "agents")
print(dj.overview()) # daemon health, VM memory, rollup
Interactive sessions
attach() opens the multi-attach PTY stream (needs the ws extra). The daemon
speaks a small JSON-envelope protocol over the WebSocket — Session hides that,
so you deal in raw bytes:
with dj.attach(isl["name"]) as s: # or agent="p2"
s.resize(40, 120)
s.send(b"ls -la\n")
print(s.recv()) # bytes of PTY output, or None when closed
dj.attach_terminal("t1") does the same for an operator host terminal.
API coverage
The client covers the full v1 surface:
- Islands — list/create/get/update/delete, hibernate/wake/reset/upgrade, clone, resources, workspace-ready, events.
- Agents — list/add/get/update/remove, configure (provider/model).
- Exec & files — exec, file read/write, logs.
- Port broker — scopes (list/grant/revoke), intake/export/write.
- Capability broker — grants (list/grant/revoke), execute.
- MCP broker — grants (list/grant/revoke),
mcp_call. - Credentials — Claude push/status, GitHub identities + repos, LLM providers.
- Operator tokens — create/list/revoke (owner-only; role + island scope).
- Events — webhook subscribe/list/unsubscribe.
- Activity — team activity feed (
activity, filterable). - Daemon — overview, agent-types, healthz, audit (filters + jsonl/csv export), clients, sessions-revoke, panic, admin-update, image-build, SSH account keys.
- Host terminals — list/create/delete/relabel +
attach_terminal. - Sessions —
attach/attach_terminal(PTY) andsession_url.
Every non-2xx response raises dejima.DejimaError (.status, .message).
Auth
- Operator (unix socket / tailnet) needs no token.
- Autonomy path (an agent driving its own/child islands) uses a per-island
bearer token — set
DEJIMA_TOKENor passtoken=.
Development
pip install -e '.[dev]'
pytest
Tests run against a stdlib http.server stub — no running daemon required.
Metadata
Release files for dejima-sdk 0.8.92
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dejima_sdk-0.8.92.tar.gz | 15.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dejima_sdk-0.8.92-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.7 kB
Release files / dejima_sdk-0.8.92.tar.gz
| Download URL | dejima_sdk-0.8.92.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4621f0b0a7a2795fdd7645d6e5277981f64d3358d20ea38b515455df60b41c0
|
|
BLAKE2b-256 checksum How to use checksums |
b53861426fbac2b9ae139250897d7acf38a427482e90cc4f3cd162dc2f54368a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / dejima_sdk-0.8.92-py3-none-any.whl
| Download URL | dejima_sdk-0.8.92-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f3a02c2f0b87fd430cb27e01f61f6a0f3a7045bf63baa425e8c9262b430c113
|
|
BLAKE2b-256 checksum How to use checksums |
287289033a76909e4b521b334332f8c512b12b0850ba652407721f157eda58d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|