Skip to main content

CairnML

CI PyPI Monthly downloads Python GitHub stars License

CairnML Agent

CairnML Agent runs the jobs of a CairnML queue on this machine. It takes one job at a time from its queue, prepares the job's environment, runs it and reports the result back to the server.

Features

  • Takes jobs from one or more queues.
  • Runs each job in its own Docker container. Docker is required; jobs in a Python virtual environment on the host need --allow-venv, which is off by default.
  • Gives the agent the GPUs you choose with --gpus.
  • Gives every job its own short-lived token, so a job never receives the agent's own token.
  • Is enrolled once by an admin, who signs in when the browser opens.

Prerequisites

  • Python 3.9 or newer
  • A running CairnML server
  • An admin account on that server, since only admins can enrol an agent
  • Docker (required; see --allow-venv for the exception)

Installation

python3 -m venv .venv
. .venv/bin/activate
pip install cairnml-agent

Connect to your server

cairnml-agent init http://cairnml

The argument is the server's address. The web app is at <address>/cairnml and the API at <address>/cairnml/api, which the command works out itself, so there are no ports to give. Your browser opens the sign-in page: sign in as an admin. The browser sign-in receives its reply on 127.0.0.1:8765, the only redirect address the identity provider accepts; if another program holds that port, the command signs in with a code instead. A non-admin is refused, and no configuration is written. The configuration is stored in ~/cairnml-agent.conf; the agent's git credentials and extra package indexes are set there by hand.

The agent enrols as its own device, with its own key (~/.cairnml/agent/device.key), apart from the SDK's cairnml init. --name names the machine, --force enrols it again (the previous device is revoked) and -F <file> uses another configuration file.

Check the machine

cairnml-agent doctor

It prints one line per check and the next step for each failure: the configuration names a server, the server answers, Docker is installed, the Docker daemon runs for this user, and the server has a GitHub App. A missing GitHub App is a warning: jobs from github.com repositories are refused until it is set up. Warnings do not change the exit status (0 when no check fails, 1 otherwise). The checks change nothing. -F <file> checks another configuration file.

Start the agent

cairnml-agent daemon --queue default
Option What it does
--queue NAME The queue to take jobs from
--docker Run each job in a container (required unless --allow-venv is given)
--allow-venv Allow jobs in a Python virtual environment on this host. Off by default: such a job can read the agent's device key
--gpus 0 The GPUs the agent may use

Run cairnml-agent daemon --help for the rest.

Trust model

The agent runs the code of every job that reaches its queue, so decide who may enqueue jobs before you start it.

  • Docker (--docker) is the isolated mode. A job runs in its own container, which does not see the agent's device key (~/.cairnml/agent/device.key). The job gets its own token, never the agent's. Use it for any setup where jobs come from more than one person.
  • Virtual environment (--allow-venv) is not isolated. A job runs as the agent's own user, so it can read the device key, whatever the file permissions. The key signs in as the admin who enrolled the agent, with a token that lasts until the device is revoked. The agent prints a warning when it starts this way and still runs the job. Use it only for code you fully trust.
  • The agent keeps its folder (~/.cairnml/agent) readable by its owner only (mode 0700), and the key in it is 0600. The agent does not put the key or its folder into a job's environment.
  • A task's own Docker arguments cannot give its container host access. By default the agent drops switches such as --privileged, --cap-add, --device, host namespaces (--pid, --ipc, --network), mounts and volumes (-v, --mount), and host files (--env-file, --log-opt). The list is forbidden_docker_args in the agent configuration. Changing it is an administrator decision, and an empty list turns the check off.
  • The agent refuses to start a job whose cache or mount folder would contain the device key (the key, its folder or a folder above them, such as the home folder). Choose cache folders outside ~/.cairnml/agent.

Check it

The Workers page of the web app lists this machine once it is running. Send a job to the queue, for example with Task.enqueue from the SDK, and it starts on this machine.

Next steps

Continue with the CairnML examples.

Having problems

  1. Check the open issues.
  2. If your problem is not listed, open a new issue with the command you ran and the full error message.

License

Apache License 2.0, see LICENSE. Unofficial fork of ClearML Agent, see DISCLAIMER.md.

Metadata

Release files for cairnml-agent 0.0.2

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

Source distribution (sdist)

Source distribution for cairnml-agent 0.0.2
File Size Uploaded Provenance Actions
cairnml_agent-0.0.2.tar.gz 1.2 MB With provenance Details for cairnml_agent-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cairnml-agent 0.0.2
File Interpreter ABI Platform Actions
cairnml_agent-0.0.2-py3-none-any.whl Python 3 none any Details for cairnml_agent-0.0.2-py3-none-any.whl

Total release size: 2.6 MB

Release files / cairnml_agent-0.0.2.tar.gz

Download URL cairnml_agent-0.0.2.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
dd221ba616ce100bc24d943c9a2a05005e5e15c61b79271ac9836a91aaaa5ec5
BLAKE2b-256 checksum
How to use checksums
407667b477e439b8f5654ea4ae1d9f864982c5f4fd06d0ffa0ba97de13a6040a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / cairnml_agent-0.0.2-py3-none-any.whl

Download URL cairnml_agent-0.0.2-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4cad19bd60860dc371e3436458ad4f908379105b5b40b9ab1535294076dc673e
BLAKE2b-256 checksum
How to use checksums
88829054683b5d3b082a403fb942abc5ce4ffeed4814dff4df6b4384a8b1884f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for cairnml-agent 0.0.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cairnml_agent-0.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

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