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.7.3

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.7.3
File Size Uploaded Provenance Actions
cmdop-3.7.3.tar.gz 39.9 kB Without provenance Details for cmdop-3.7.3.tar.gz

Built distribution (wheel)

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

Total release size: 89.7 kB

Release files / cmdop-3.7.3.tar.gz

Download URL cmdop-3.7.3.tar.gz
Size 39.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cac72f78ab6ca484fd9ce8dde60f74ed7ca13a42d951c2e7d06246aa2a458b87
BLAKE2b-256 checksum
How to use checksums
ee6f478f28b7c80b280b41cefa1a7463ccf146a532bd79618d4039d23b59a69a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL cmdop-3.7.3-py3-none-any.whl
Size 49.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3bf457677b4b20bbbc8c8a570a422bf70d13045fd3d53e735f15fb4daed5056e
BLAKE2b-256 checksum
How to use checksums
a086388ee2fcba455cc75dcb645aec7dd3ee29ff7a217d3035df625e20a2acce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for cmdop 3.7.3

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