Get started

Quick start

From a signed-in terminal to a durable job: talk to the agent, submit a Python worker, watch it run, collect the rows.

1. Connect

Start the local isotope, or sign in to one you have access to, and confirm which account you are signed in as. Every command below reuses that sign-in. So does the SDK when the keyring package is installed beside it; for automation without a keyring, inject an API key from your secret manager into $DRKM_TOKEN at runtime.

# Local isotope
drkm start

# Or an isotope you already have
drkm console login https://isotope.example
drkm console whoami

2. Talk to the agent

drkm on its own, or drkm console, opens the terminal workspace. drkm console chat -p sends one turn and prints the final answer, which is the form to use from scripts. Inside the workspace, /skills manages your skills and /skill-name runs one, @ picks an isotope to delegate to, /jobs and /isotopes inspect work and the fleet, /tasks lists background runs, Ctrl+K searches threads, jobs, isotopes and commands, and Ctrl+Q detaches without stopping a running agent.

drkm console chat -p "What models, tools and peers does this isotope have?"

# Choose the effort for one turn, attach a file
drkm console chat -p "Summarize this" --attach report.pdf --effort high

# The interactive workspace
drkm console

3. Write a worker

Create worker.py. A worker is a top-level function run(records, context): the platform calls it once with the job's input records and a context, and it returns one JSON-compatible result for the job. This one flags sensor readings above a threshold. The function lives in its own module, not in the script you run.

def run(records, context):
    return [
        {
            "id": record["id"],
            "temperature": record["data"]["temperature"],
            "alert": record["data"]["temperature"] > 80,
        }
        for record in records
    ]

4. Submit and collect

First, install the Python SDK in the Python environment you will use to run submit.py (python -m pip install "drkm[keyring]"). The CLI's bundled SDK is separate from your own Python environment; the keyring extra reuses your terminal's saved sign-in.

Save this beside the worker as submit.py and run it. connect(url) points the SDK at the isotope URL you pass (there is no default URL) and reuses the credential your terminal saved for it. package() describes the worker and the files to seal with it; submit() returns a job ID at once. From then on the job belongs to the platform: it outlives this script, and wait() polls until it settles. rows() returns the worker's result as one row, under output.

import drkm

drkm.connect("https://isotope.example")
worker = drkm.package("worker.py:run", ["worker.py"])
job_id = drkm.submit(
    worker,
    inputs=[
        {"id": "sensor-a", "data": {"temperature": 72}},
        {"id": "sensor-b", "data": {"temperature": 86}},
    ],
    name="Check sensor temperatures",
)

status = drkm.wait(job_id)
print(status["state"], status["coverage"])
for row in drkm.rows(job_id):
    for reading in row["output"]:
        print(reading["id"], reading["alert"])

5. Watch it run

The same job is visible from the terminal, the console and the SDK. drkm console jobs opens the Jobs screen on an interactive terminal and prints the ledger as JSON when piped; add the job ID for one job, and when piped --runs prints its partitions and attempts. In the console, open Isotopes and its Jobs tab. From Python, drkm.Job(job_id) picks a submitted job up again from a later run.

drkm console jobs
drkm console jobs YOUR_JOB_ID
drkm console jobs YOUR_JOB_ID --runs | less

# The fleet this isotope can place work on
drkm console isotopes

Where next