---
title: "Get Observability Logs"
method: GET
path: "/agentic/observability/logs"
tags: ["Agents Observability"]
---

# Get Observability Logs

`GET /agentic/observability/logs`

Per-job log lines for one agent or KB.

Replaces the namespace-scoped kubectl tail with a per-``job_name``
ClickHouse query. ``agent_id`` resolves to the prefix
``agent_<id>_`` or ``kb_<id>_`` via the doc's ``job_type``; the
prefix LIKE catches every redeploy version of the entity so log
history survives re-deploys.

Returns 404 when the id doesn't belong to this tenant + service (or
the doc's ``job_type`` isn't agent / KB). Returns 503 with a
structured ``kind`` when the ``flink_logs`` table is missing or
a column has drifted.

## Query parameters

- `agent_id` string, required — Agent or knowledge base id (Mongo ObjectId)
- `from` string, nullable — Time range start (ISO 8601)
- `to` string, nullable — Time range end (ISO 8601)
- `level` string — Floor level — DEBUG | INFO | WARN | ERROR (used when `levels` is absent)
- `levels` string, nullable — Explicit comma-separated level set (e.g. 'WARN,ERROR'). Overrides the `level` floor when present.
- `search` string, nullable — Substring filter on the log column
- `limit` integer — Max lines per call
- `since` string, nullable — Live-tail cursor — only rows newer than this ISO 8601 ts

## Response `200`

Successful Response

- ObservabilityLogsResponse — `/agentic/observability/logs` response envelope. ``scope`` always ``"agent"`` on this endpoint — per-job filtering is real (the ``job_id`` prefix LIKE catches only this entity's history). The kubectl-tail path's ``"namespace"`` value disappears here. ``job_id_prefix`` is echoed back so the FE can render "N versions" hints when a redeployed agent's history is mixed in.
  - `lines` ObservabilityLogLine[], required
    - `timestamp` string, required
    - `level` string, required
    - `message` string, required
  - `scope` 'agent'
  - `job_id_prefix` string, required

## Other responses

- `422` — Validation Error

---

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