---
title: "Get Agent Logs"
method: GET
path: "/agents/{job_id}/logs"
tags: ["Agents"]
---

# Get Agent Logs

`GET /agents/{job_id}/logs`

Tailed ``[AGENT]``-prefixed Flink TM logs + recent job exceptions.

The ``write:agents`` gate is intentional: agent log lines may contain
customer payloads that flowed through prompts and tool args. Tightening
the audit surface here mirrors how the Streamkap MCP project key blob
is gated.

Per-line scoping is namespace-wide for now - when multiple agents share
a TaskManager, lines from other agents may appear. Documented limitation
until the Java runtime emits per-line agent IDs.

``since`` is an optional ISO 8601 cutoff for incremental polling on the
unified observability surface. The underlying tail window is Nx4 the
requested ``tail`` count; if ``since`` is far enough back that the
window doesn't reach it, the response is still bounded by ``tail`` (the
caller can widen ``tail`` to compensate).

## Path parameters

- `job_id` string, required

## Query parameters

- `tail` integer
- `level` string
- `search` string, nullable
- `since` string, nullable

## Response `200`

Successful Response

- AgentLogsResponse — Combined response for ``GET /agents/{id}/logs``. ``lines`` are tailed and parsed agent log lines from the Flink TaskManager pods in the tenant's namespace; see :class:`FlinkClusterClient.get_taskmanager_logs` for per-line scoping caveats. ``flink_exceptions`` are pulled from the Flink REST ``/jobs/{jid}/exceptions`` endpoint when the job is live.
  - `lines` AgentLogLine[]
    - `timestamp` string, nullable — Line timestamp as emitted by the Flink logger
    - `level` string — Log level — DEBUG, INFO, WARN, ERROR
    - `message` string, required — Log message body
  - `flinkExceptions` AgentFlinkException[]
    - `timestamp` string, nullable — ISO8601 timestamp (Flink millis-since-epoch normalised)
    - `exception` string, required — Stack trace or exception text
    - `task` string, nullable — Flink task name when available
  - `scope` 'namespace' | 'agent' — Per-line scoping of returned lines. ``namespace`` means lines may include [AGENT] entries from other agents sharing a TaskManager (current limitation). ``agent`` will be returned once the Java runtime emits per-line agent IDs.

## 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/8aea6143d003/schema)
