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

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.5
File Size Uploaded Provenance Actions
cmdop-3.7.5.tar.gz 40.0 kB Without provenance Details for cmdop-3.7.5.tar.gz

Built distribution (wheel)

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

Total release size: 89.9 kB

Release files / cmdop-3.7.5.tar.gz

Download URL cmdop-3.7.5.tar.gz
Size 40.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bbbaa82f40762e5b8cbd445c56b93e93b54535121aec83bb89da2b0d08ad083b
BLAKE2b-256 checksum
How to use checksums
36bf4e7e67070c768fb0768e7726ae8820e52e973a20bef94f002bba215d5cb9
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.5-py3-none-any.whl

Download URL cmdop-3.7.5-py3-none-any.whl
Size 50.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65db43f14dfd3587eb458628b3bf21842e6a5c970430bc840641667b32326336
BLAKE2b-256 checksum
How to use checksums
76eb31eed5cf3daf7b8e1a1eb3f79fd4e13401bd9f4259946a918178d3c36699
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.5

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