---
title: "Lightweight swarm-wide counts"
method: GET
path: "/api/metrics"
tags: ["Stats"]
---

# Lightweight swarm-wide counts

`GET /api/metrics`

Single JSON object of cheap `COUNT(*)` metrics — tasks (by status), agents (by status), workflows (total + enabled), pages, active sessions, skills. Use this instead of fetching full list payloads just to count. Powers UI footers/sidebars and MCP context.

## Response `200`

Swarm metrics counts

- object
  - `tasks` object, required
    - `total` number, required
    - `by_status` object, required
  - `agents` object, required
    - `total` number, required
    - `by_status` object, required
  - `workflows` object, required
    - `total` number, required
    - `enabled` number, required
  - `pages` object, required
    - `total` number, required
  - `sessions` object, required
    - `active` number, required
  - `skills` object, required
    - `total` number, required
  - `retention` object, required
    - `sessionLogs` object
      - `at` string, required
      - `rowsDeleted` number, required
      - `batches` number, required
      - `durationMs` number, required
      - `dryRun` boolean, required
      - `cumulativeRowsDeleted` number, required
      - `outcome` 'converged' | 'budget_exhausted' | 'error', required
      - `drained` boolean, required
      - `backlogRemaining` number, required
      - `batchSize` number, required
      - `slowestStatementMs` number, required
      - `lastError` string
      - `lastErrorAt` string
      - `lastSuccessAt` string
    - `agentLog` object
      - `at` string, required
      - `rowsDeleted` number, required
      - `batches` number, required
      - `durationMs` number, required
      - `dryRun` boolean, required
      - `cumulativeRowsDeleted` number, required
      - `outcome` 'converged' | 'budget_exhausted' | 'error', required
      - `drained` boolean, required
      - `backlogRemaining` number, required
      - `batchSize` number, required
      - `slowestStatementMs` number, required
      - `lastError` string
      - `lastErrorAt` string
      - `lastSuccessAt` string
    - `events` object
      - `at` string, required
      - `rowsDeleted` number, required
      - `batches` number, required
      - `durationMs` number, required
      - `dryRun` boolean, required
      - `cumulativeRowsDeleted` number, required
      - `outcome` 'converged' | 'budget_exhausted' | 'error', required
      - `drained` boolean, required
      - `backlogRemaining` number, required
      - `batchSize` number, required
      - `slowestStatementMs` number, required
      - `lastError` string
      - `lastErrorAt` string
      - `lastSuccessAt` string

## Changes

- **2026-09-02** `d36f3748925a` — 24 info
  - added the optional property `retention/agentLog/lastError` to the response with the `200` status
  - added the optional property `retention/agentLog/lastErrorAt` to the response with the `200` status
  - added the optional property `retention/agentLog/lastSuccessAt` to the response with the `200` status
  - added the optional property `retention/events/lastError` to the response with the `200` status
  - …20 more
- **2026-08-31** `6fe53ac248b5` — 1 info
  - added the required property `retention` to the response with the `200` status
- **2026-08-07** `06cac6a7c5bc` — 1 info
  - added the media type `application/json` for the response with the status `200`

[Change history](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/changes/api/metrics/get.md)

---

[API](https://skmtc.dev/desplega-ai/apis/agent-swarm-api.md) · [All operations](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/desplega-ai/agent-swarm-api/revisions/e0acd2155cad/schema)
