Comma Agents
@comma-agents/daemon

Server

Daemon server creation and configuration.

Server

The daemon is a WebSocket server that hosts strategy runs and communicates with clients through the typed protocol. Use createDaemon when embedding the server, or the CLI to run it as a managed process.

import {
  createDaemon,
  createLogger,
  loadDaemonConfig,
} from "@comma-agents/daemon";

const config = loadDaemonConfig();
const logger = createLogger({ level: config.logLevel });
const daemon = createDaemon({ config, logger });

await daemon.start();
console.log(daemon.url);

Daemon

The daemon instance interface.

Prop

Type

CreateDaemonOptions

Options for createDaemon.

Prop

Type

DaemonConfig

Resolved daemon configuration.

Prop

Type

DaemonConfigFile

The on-disk config file shape (Zod-inferred).

Prop

Type

LoadConfigOptions

Options for loadDaemonConfig.

Prop

Type

Configuration precedence

loadDaemonConfig resolves each setting from the following sources, from highest to lowest priority:

  1. COMMA_DAEMON_* environment variables
  2. The JSON daemon configuration file
  3. Built-in defaults

Use COMMA_DAEMON_CONFIG_FILE to select a different configuration file. By default, the daemon stores its config, PID, logs, provider cache, and persisted runs under the platform application-data directory.

Connecting clients

After start() resolves, use daemon.url as the WebSocket endpoint. The server also exposes GET /health on the same host and port. See the protocol overview for connection and message details.

On this page