ClearML Agent
ClearML Agent is a Python library that provides auto-magical DevOps capabilities for Deep Learning. It serves as a worker to execute machine learning tasks remotely, integrating with the ClearML Python package and ClearML Server. The library maintains an active release cadence with frequent updates.
Warnings
- breaking Python 3.5 support was removed in `clearml-agent` v1.9.3. Ensure you are using Python 3.6 or newer.
- breaking As of `clearml-agent` v1.1.0, the agent no longer tries to use the demo server by default. Attempting to run without explicit server configuration will fail.
- gotcha When running tasks in Docker mode, the agent by default installs all required Python packages. To use a pre-built Docker image without additional installations, you must explicitly disable this behavior.
- gotcha Git credentials for cloning repositories can be complex, involving different configuration options and environment variables for various Git providers (GitHub, GitLab, Bitbucket, Azure DevOps).
- gotcha If running the agent in virtual environment mode (pip, conda, poetry), the agent itself cannot be launched from an *already activated* virtual environment. It needs to create its own isolated environments.
Install
-
pip install clearml-agent
Quickstart
# 1. Install ClearML Agent
pip install clearml-agent
# 2. Initialize the agent (interactive setup for server connection and git credentials)
# You'll be prompted to paste ClearML credentials and optionally configure Git.
# Ensure CLEARML_API_ACCESS_KEY and CLEARML_API_SECRET_KEY are set as environment variables
# or paste them when prompted.
# os.environ['CLEARML_API_ACCESS_KEY'] = os.environ.get('CLEARML_API_ACCESS_KEY', 'YOUR_ACCESS_KEY')
# os.environ['CLEARML_API_SECRET_KEY'] = os.environ.get('CLEARML_API_SECRET_KEY', 'YOUR_SECRET_KEY')
clearml-agent init
# 3. Start the ClearML Agent daemon (listening for tasks)
# For simple virtual environment mode (default):
# clearml-agent daemon
# For Docker mode (recommended for complex environments):
clearml-agent daemon --docker