Agents

Get an agent's per-monitor fleet detail

The per-monitor breakdown the agent's own console page needs, which GET /api/v1/agents/{id} deliberately does not carry (that response is the list-page summary: status, monitor_count, last_seen only).

rollup tallies each owned monitor's state — total is always the sum of up + late + down + paused.

monitors[].state uses the four words a fleet row shows (up/late/down/paused), collapsed from the same live rollup agentStatePill/GET /api/v1/agents/{id} uses for the agent as a whole: a monitor currently blocked on a human reads as down here (folded in, since the fleet vocabulary has no separate word for it); a monitor with no judged outcome yet (new, or paused/in-maintenance with nothing else wrong) reads as up rather than raising a false alarm on a monitor's first run.

monitors[].last_run is the run currently open on that monitor — not "the most recently completed run": a monitor stops naming a run the instant that run ends, so there is no prior run to report here. null when no run is currently in flight.

monitors[].current_step is the latest declared step of that same armed run, present only while it has no terminal ping yet (which a currently-armed run always satisfies, by construction).

spend_24h is the agent's 24-hour cost/token/run rollup across every monitor it owns — see the AgentSpend schema. null when the agent has no traced run in the trailing 24 hours.

Console stability note. This response is shaped by a console screen: the fields are the ones that screen draws, in the grouping it draws them in. It stays published because reading it is a reasonable thing to automate, and no field will be removed or change meaning without a version. Fields may be ADDED as the screen grows, so treat unknown keys as normal rather than as an error.

get/api/v1/agents/{id}/fleet

Request

  • Base URL: https://app.lastping.dev
  • URL: https://app.lastping.dev/api/v1/agents/{id}/fleet
  • Auth: API key in header X-Api-Key

Response

The agent's fleet detail.

Example response

{
  "agent": {
    "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
    "slug": "nightly-etl-bot",
    "name": "Nightly ETL bot",
    "description": "Runs the nightly ETL pipeline and owns its monitors.",
    "status": "up",
    "monitor_count": 3,
    "last_seen": "2026-07-10T03:00:05Z",
    "spend_24h": {
      "cost_usd": "0.006600",
      "cost_source": "estimated",
      "tokens_in": 150,
      "tokens_out": 50,
      "runs": 1
    },
    "runs_7d": [
      {
        "day": "2026-09-14",
        "runs": 12
      }
    ],
    "usage_24h": {
      "day": "2026-09-20",
      "model": "claude-sonnet-4-5",
      "provider": "anthropic",
      "tokens_in": 182340,
      "tokens_out": 20411,
      "tokens_cache_read": 95012,
      "tokens_cache_write": 4100,
      "cost_usd": "0.853221",
      "cost_source": "estimated",
      "origin": "traces"
    },
    "top_dependencies": [
      {
        "kind": "database",
        "name": "postgresql",
        "direction": "out",
        "calls": 1480,
        "errors": 12,
        "error_rate": 0.0081,
        "p50_ms": 10,
        "p95_ms": 25,
        "series": [
          {
            "day": "2026-09-20",
            "calls": 210,
            "errors": 2
          }
        ]
      }
    ],
    "created_at": "2026-07-01T12:00:00Z"
  },
  "rollup": {
    "up": 4,
    "late": 1,
    "paused": 2,
    "total": 7
  },
  "monitors": [
    {
      "check_id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "nightly-backup",
      "slug": "nightly-backup",
      "state": "up",
      "last_ping_at": "2026-09-16T02:58:00Z",
      "last_run": {
        "rid": "run-2026-09-16-004",
        "outcome": "running",
        "started_at": "2026-09-16T03:00:00Z"
      },
      "current_step": {
        "name": "unpack",
        "at": "2026-09-16T03:04:12Z"
      }
    }
  ],
  "spend_24h": {
    "cost_usd": "0.006600",
    "cost_source": "estimated",
    "tokens_in": 150,
    "tokens_out": 50,
    "runs": 1
  }
}

Changes

No recorded changes to this operation across all 2 revisions of this API.