Configure Daemon
Configure Mopheus daemon to turn your machine into a runtime for agent tasks.
Configure Daemon
The daemon is the core component of Mopheus runtime, responsible for receiving and executing agent tasks. After configuring the daemon, your machine becomes a runtime that can host AI agents.
Prerequisites
| Requirement | Notes |
|---|---|
| Mopheus CLI | Must be installed and logged in (see Install CLI Tools) |
| At least one Provider CLI | Install claude, kimi-code, agy, or another supported binary. Without one the daemon registers no runtimes. Note: the provider CLI itself (e.g. ClaudeCode) also needs network access to its own AI service (e.g. Anthropic API) in order to function. |
| Reachable Mopheus backend | The daemon must be able to connect outbound to your Mopheus backend address (default http://localhost:8080, or whatever you configure in MOPHEUS_SERVER_URL). No inbound port needs to be opened. |
Login
The daemon reuses the CLI's authentication, so mopheus login must succeed on this machine before the daemon can register. If you already completed this in Install CLI Tools, skip ahead to Start Daemon.
Configure Server URL
If you are using a self-hosted Mopheus instance, point the CLI at your backend:
mopheus config set server_url https://your-mopheus.example.comAuthenticate
# Option A: Interactive API Token input (create at Settings → API Tokens in web UI)
mopheus login --token
# Option B: Email + password login, CLI automatically creates a long-lived API Token
mopheus login --email your@email.com --password yourpasswordVerify login succeeded:
mopheus workspace listIf the list comes back (even empty), you are connected.
Start Daemon
mopheus daemon startRun the daemon as a regular system user. Direct root daemon launches are rejected because agent subprocesses inherit the daemon's filesystem and network privileges, and root-owned task directories later block normal-user runs. In a controlled environment that intentionally requires a root daemon process, opt in explicitly:
mopheus daemon start --allow-rootThis flag applies to the daemon process, not to management commands. A root user can still run mopheus daemon start or restart to manage an installed system-level service; Mopheus delegates those operations to systemd.
On first run, the daemon:
- Creates a stable machine ID at
~/.mopheus/daemon.id(reused on every subsequent start) - Scans for known provider CLIs (
claude,kimi-code,agy) and any custom binaries set via env var - Connects to the server and registers, listing every discovered provider CLI
- Starts accepting tasks for any compatible agent
- Sends periodic HTTP heartbeats every 30 seconds while it is running
Verify the daemon is running:
mopheus daemon statusWithin a few seconds, your machine appears under Runtimes in the sidebar, with one row per discovered provider.
Keep It Running
For development, leave the foreground mopheus daemon start process running in a terminal.
For longer-running setups, run the daemon under a process supervisor so it restarts after reboots and crashes.
Recommended: mopheus daemon install
The simplest way to set up the systemd service is mopheus daemon install. It generates the unit file and an env template for you:
# Install a systemd service (root → system service at /etc/systemd/system/mopheus-daemon.service,
# non-root → user service at ~/.config/systemd/user/mopheus-daemon.service)
mopheus daemon install
# Enable on boot and start immediately
mopheus daemon install --enable --start
# Pass extra 'daemon start' flags after --
mopheus daemon install -- --agent-idle-watchdog 0sThis writes the service unit and an env file, then runs systemctl daemon-reload. Use --enable to start on boot and --start to launch it right away. For non-root (user) services, the installer checks linger status; if disabled (default: no), run sudo loginctl enable-linger $USER so the user-level systemd service continues running after all SSH sessions are closed and starts without an active login session.
A system-level unit installed as root includes --allow-root in ExecStart, making its root daemon process an explicit opt-in. Existing systemd-owned root daemons remain compatible because Mopheus recognizes systemd invocation metadata during upgrades. User-level units do not include the flag. Prefer a user-level service unless the daemon specifically requires system-wide privileges.
Agent Task Physical Resource Telemetry and cgroup v2 Delegation
The Mopheus daemon automatically captures and persists an end-state physical resource telemetry profile (resource_telemetry) for every completed or failed agent task. The system provides two built-in telemetry modes to ensure reliable data recording across all environments:
- Kernel Mode (
cgroup_v2): On Linux systems with cgroup v2, the daemon creates dedicated kernel sub-slices for each task. Upon task termination, it reads kernel hardware counters in sub-milliseconds (under 1ms) with zero polling overhead and zero missed short-lived processes, capturing precise CPU execution time, stack/cache memory breakdowns, disk I/O throughput/IOPS, and kernel PSI pressure stall metrics. - Sampler Fallback Mode (
sampler): On macOS or Linux systems without cgroup delegation, the daemon automatically and transparently falls back to process-tree periodic sampling. Reusing the 2-second watchdog loop, it continues to record lifecycle peak physical memory (Peak Memory) and peak concurrent processes (Peak Procs), guaranteeing baseline physical telemetry even in unprivileged, zero-configuration environments.
Comparison of Telemetry Modes in Mopheus
| Telemetry Dimension / Metric | Kernel Mode (cgroup_v2, Recommended) | Sampler Fallback Mode (sampler, Default) |
|---|---|---|
Data Source Marker (source) | cgroup_v2 | sampler |
Peak Physical Memory (Peak Memory) | Kernel hardware instantaneous peak (memory.peak) | Maximum physical memory observed in 2s sampling loop (VmRSS / Resident Size) |
| Memory Structural Breakdown | Stack anon pages (anonBytes), pagecache (fileBytes), Swap peak | Not broken down (overall peak memory only) |
CPU Time & Throttling (CPU Time) | Microsecond user/system time & throttling periods | Estimated from process termination stats & sampler accumulation |
Peak Concurrency (Peak Procs) | Instantaneous maximum kernel tasks & threads (pids.peak) | Maximum concurrent child processes observed during 2s sampling |
| Disk I/O Throughput & IOPS | Read/write bytes and read/write IOPS (io.stat) | Omitted in fallback mode |
System Pressure Stall (psi) | CPU & I/O stall microsecond counters (*.pressure) | Omitted in fallback mode |
| Short-Lived Process Capture | 100% captured via hardware counters | May be missed if process lifetime is shorter than sampling interval |
| Supported Platforms & Requirements | Linux regular user with systemd cgroup delegation | macOS / Linux (zero-configuration out-of-the-box) |
How to Enable Full Kernel Mode (cgroup_v2) on Linux
When running the daemon as a regular non-root user on Linux (e.g. Ubuntu, Debian, Arch, WSL 2), configure systemd cgroup delegation in one step:
sudo mkdir -p /etc/systemd/system/user@.service.d
sudo tee /etc/systemd/system/user@.service.d/delegate.conf <<'EOF'
[Service]
Delegate=yes
EOF
sudo systemctl daemon-reloadTip: Even without this delegation configured, the Mopheus daemon operates normally in
samplerfallback mode and records baseline physical profiles without failing or interrupting agent tasks.
Manual systemd setup (fallback)
If daemon install is unavailable or you need full control, create the unit file by hand. Create an environment file to hold your configuration:
mkdir -p ~/.mopheus
tee ~/.mopheus/daemon.env > /dev/null <<'EOF'
# MOPHEUS_DAEMON_DEVICE_NAME=my-server
# MOPHEUS_WORKDIR=~/mopheus_workspace
EOF
chmod 600 ~/.mopheus/daemon.env# /etc/systemd/system/mopheus-daemon.service
[Unit]
Description=Mopheus agent runtime daemon
After=network.target
[Service]
Type=simple
ExecStart=%h/.local/bin/mopheus daemon start --foreground
Restart=always
RestartSec=5
# Wait up to 45s for in-flight tasks to finish; systemd force-kills after 50s.
Environment="MOPHEUS_DAEMON_SHUTDOWN_DRAIN_TIMEOUT=45s"
TimeoutStopSec=50s
User=mopheus
Environment="HOME=/home/mopheus"
# To tune runtime behaviour, pass parameters via environment variables:
# Environment="MOPHEUS_DAEMON_MAX_CONCURRENT_AGENT_TASKS=5"
# Environment="MOPHEUS_DAEMON_DEVICE_NAME=DBA-Workstation"
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now mopheus-daemon
journalctl -u mopheus-daemon -fConfiguration
Environment variables tune the daemon's behaviour. All have safe defaults.
Connection
| Variable | Default | Description |
|---|---|---|
MOPHEUS_SERVER_URL | http://localhost:8080 | Server URL the daemon connects to. |
MOPHEUS_TOKEN | — | API token. Usually written to the config file automatically by mopheus login; no need to set manually. |
Runtime Identity
| Variable | Default | Description |
|---|---|---|
MOPHEUS_DAEMON_ID | auto-generated on first run | Stable machine-scoped unique ID, persisted at ~/.mopheus/daemon.id. |
MOPHEUS_DAEMON_DEVICE_NAME | OS hostname | Device name shown in the runtime list and hover cards. |
MOPHEUS_AGENT_RUNTIME_NAME | — | Runtime display name. Takes precedence over device name. |
Runtime Behaviour
| Variable | Default | Description |
|---|---|---|
MOPHEUS_DAEMON_HEARTBEAT_INTERVAL | 30s | HTTP heartbeat interval. |
MOPHEUS_AGENT_TIMEOUT | 0 (disabled) | Optional daemon-side total execution timeout. When unset or 0, the server's system-level agent_task_timeout sweep is the fallback. |
MOPHEUS_AGENT_IDLE_WATCHDOG | 1h | Force-stop the agent when it has been silent this long; set to 0 to disable. |
MOPHEUS_DAEMON_MAX_CONCURRENT_AGENT_TASKS | 20 | Max number of tasks the daemon runs in parallel. |
MOPHEUS_DAEMON_SHUTDOWN_DRAIN_TIMEOUT | 0 (unlimited) | Maximum time to let in-flight tasks finish after the daemon stops claiming. At the bound, remaining tasks are cancelled and reported as daemon_shutdown. Generated systemd units set 45s. |
MOPHEUS_SANDBOX_ENABLED | true | Wrap each agent subprocess in a bubblewrap filesystem sandbox (Linux only). Unset or blank enables it; set to false or off to disable. See Filesystem Sandbox. |
MOPHEUS_SANDBOX_DENY | — | Extra absolute paths to hide from agents via an empty tmpfs overlay, comma-separated. |
Provider CLI Paths
| Variable | Default | Description |
|---|---|---|
MOPHEUS_CLAUDE_PATH | discovered via $PATH | Override path to the claude binary. |
MOPHEUS_KIMI_CODE_PATH | discovered via $PATH | Override path to the kimi-code binary. |
MOPHEUS_ANTIGRAVITY_PATH | discovered via $PATH | Override path to the agy binary. |
Working Directory and Logs
| Variable | Default | Description |
|---|---|---|
MOPHEUS_WORKDIR | ~/mopheus_workspace | Filesystem location where each task's working directory is created. |
MOPHEUS_LOG_FILE | ~/.mopheus/daemon.log | Log file path. |
MOPHEUS_LOG_LEVEL | info | Log level: debug, info, warn, error. |
Health Endpoint
The daemon exposes GET http://127.0.0.1:19515/health for local health checks. This port cannot be overridden via environment variable; it is derived internally from the CLI profile (default profile uses 19515, other profiles offset by the hash of the profile string). Use it for liveness probes in containers or service supervisors.
Stop Daemon
To stop the daemon cleanly:
mopheus daemon stopThe daemon sends a deregister request and the runtime flips to Offline in the UI.
Troubleshooting
Daemon does not appear in the Runtimes list
- Check the daemon's log output — connection errors show up immediately
- Confirm
mopheus loginsucceeded by runningmopheus ticket list - Confirm
MOPHEUS_SERVER_URLmatches the host you logged in against - If you are behind a proxy, set
HTTPS_PROXYso the WebSocket upgrade can reach the server
Runtime appears but tasks are not picked up
- Verify the provider CLI is on
$PATH(which claude) or that the override env var points at a working binary - Check that the agent's provider CLI matches what the runtime advertises — a Claude agent will not run on a
kimi-code-only runtime - Check the agent's status: if it is Error, clear the error first and re-run the task
Newly installed provider CLI does not appear in the runtime list
The daemon re-probes provider CLIs every 30 seconds, no restart is required. A newly installed CLI will be discovered automatically within one probe cycle (30 seconds). If it does not appear after a while, check that the CLI is on $PATH and is executable.
Health endpoint
# Check whether the daemon is alive
curl http://127.0.0.1:19515/health