---
title: "Get Agent Metrics"
method: GET
path: "/agents/{agent_id}/metrics"
tags: ["Agents"]
---

# Get Agent Metrics

`GET /agents/{agent_id}/metrics`

Get aggregated metrics for an agent over the last 24 hours. Includes task success rate, task count, error log count, and average task duration.

## Path parameters

- `agent_id` string, required

## Query parameters

- `branch_id` string, nullable — Optional branch ID filter

## Response `200`

Successful Response

- AgentMetricsResponse — Aggregated metrics for an agent.
  - `avg_task_duration_seconds` number, nullable — Average duration of completed/failed tasks in seconds. None if no tasks have finished in the time window.
  - `error_log_count_24h` integer, required — Number of ERROR/CRITICAL level logs in the last 24 hours
  - `task_count_24h` integer, required — Total number of tasks created in the last 24 hours
  - `task_success_rate_pct` number, nullable — Percentage of successful tasks (COMPLETED) vs failed tasks. None if no tasks have finished in the time window.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/terminaluse/apis/sb0-api.md) · [All operations](https://skmtc.net/terminaluse/apis/sb0-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/terminaluse/sb0-api/revisions/f24a474dc415/schema)
