# Daemons

> Source: https://truto.one/docs/guides/daemon/overview/

A **daemon** is a worker you run on your own infrastructure that Truto hands work to. Truto keeps a record of each daemon and of the jobs it runs, so you can see and manage them through the API and the CLI.

:::skip-reading{cli="truto daemons list -o json" skill="truto"}
:::

Truto does not publish a daemon client. If you want sync job runs or daemon jobs to run on your own workers, contact Truto support first. In most cases, send sync job output to a webhook or a [datastore](/docs/guides/datastores/overview) instead, with [`destination` nodes](/docs/guides/sync-jobs/v4-reference#destination).

## The records

| Record | What it is |
|---|---|
| Daemon | One worker in an environment, with a `label`, a `status` (`starting`, `active`, `stopping` or `stopped`) and an optional `group_key`. |
| Daemon job | A job definition, with `args_schema` and `args_validation` for the arguments a run takes. |
| Daemon job run | One run of a daemon job on a daemon, with its `args` and a `status` (`created`, `running`, `completed`, `failed` or `stopped`). |
| Daemon job cron trigger | A schedule that starts daemon job runs. |

Each run a daemon job cron trigger starts sends a `daemon_job_run:created` event to webhooks subscribed to `all`.

A sync job run on runtime versions 1 to 3 can name a `daemon_group_key` as its destination, instead of a `webhook_id` or `super_query`. A V4 run sends its output through `destination` nodes and doesn't use daemons.

## API and CLI

See the API reference for [daemons](/docs/api-reference/admin/daemons), [daemon jobs](/docs/api-reference/admin/daemon-jobs), [daemon job runs](/docs/api-reference/admin/daemon-job-runs) and [daemon job cron triggers](/docs/api-reference/admin/daemon-job-cron-triggers). In the CLI, the commands are `truto daemons`, `truto daemon-jobs`, `truto daemon-job-runs` and `truto daemon-job-triggers`. See the [command reference](/docs/cli/command-reference).

To list a daemon job's failed runs:

:::code-tabs

```bash label="cURL"
curl "https://api.truto.one/daemon-job-run?daemon_job_id=<daemon_job_id>&status=failed" \
  -H "Authorization: Bearer $TRUTO_API_TOKEN"
```

```bash label="CLI"
truto daemon-job-runs list --daemon-job-id <daemon_job_id> --status failed -o json
```

:::
