Skip to main content

cmdop

Your computers' tools from Python, sync and async. Use the same tools AI agents call through MCP, with typed results, your agent's grant and a record of each call.

pip install cmdop

Requires Python 3.10+. Install CMDOP on a computer, bring it online on your page and create an agent token in the Agents tab. Set CMDOP_URL to your page's address (https://<address>.cmdop.dev) and CMDOP_TOKEN through your environment. The SDK does not install the machine program. Start with the read risk class.

import cmdop

with cmdop.connect() as client:
    online = next((machine for machine in client.machines() if machine["online"]), None)
    if online is None:
        raise RuntimeError("Bring a machine online on your CMDOP page.")
    info = client.machine(online["id"]).sys.info()
    print(info.os, info.arch, info.cpus)

The program prints the selected computer's OS, architecture and CPU count.

Async

import asyncio
import cmdop

async def main():
    async with cmdop.connect_async() as client:
        for machine in await client.machines():
            if machine["online"]:
                info = await client.machine(machine["id"]).sys.info()
                print(info.os, info.arch, info.cpus)

asyncio.run(main())

Commands and streaming

Inside the connected client's with block, with exec allowed for the agent and machine:

box = client.machine("<machine>")
print(box.run("uptime").stdout)
run = box.stream("printf 'hello\\n'")
for piece in run:
    print(piece.data, end="")
print(run.result.exit_code)

box.fs.read(path=...) and box.fs_read(path=...) call the same typed tool. box.screenshot() decodes the image. client.tasks_list() and client.docs_read() need no machine. Installed agents use box.agent.* and the agent risk class.

Deadlines and errors

box.run("uptime", deadline=5) limits the call to five seconds. Branch on cmdop.CmdopError.code; cmdop.CarrierError means the connection broke before an answer arrived. Do not blindly repeat writes after a connection failure. Call run.cancel() explicitly when leaving a synchronous stream early. Async streams use async for, await run.result() and await run.cancel().

Quickstart · Python API · MCP client setup · Source and issues

License: MIT.

Metadata

Release files for cmdop 3.6.1

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

Source distribution (sdist)

Source distribution for cmdop 3.6.1
File Size Uploaded Provenance Actions
cmdop-3.6.1.tar.gz 32.9 kB Without provenance Details for cmdop-3.6.1.tar.gz

Built distribution (wheel)

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

Total release size: 75.2 kB

Release files / cmdop-3.6.1.tar.gz

Download URL cmdop-3.6.1.tar.gz
Size 32.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f0d2ca18dd3f33d74a996665d8aaf0cc1363e26eff919423caa7e9fffa4d3a2f
BLAKE2b-256 checksum
How to use checksums
65b30a6d4786fbf96e1a8a2e8d60f9ef27e7fa1c2ae0a1c689c16d5d34637c59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.3

Release files / cmdop-3.6.1-py3-none-any.whl

Download URL cmdop-3.6.1-py3-none-any.whl
Size 42.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9b9b57cf7a66a17cf7b924521f0ab1638e815c18bfe5da434b0c3a080fd2f5d
BLAKE2b-256 checksum
How to use checksums
c476dc8e24b240ec6fc081a81062a9406877382c42d7433633ae9632c25d3212
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.3

Security for cmdop 3.6.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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