> ## Documentation Index
> Fetch the complete documentation index at: https://docs.streamkap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Agent 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).



## OpenAPI

````yaml /openapi/openapi.json get /agents/{job_id}/logs
openapi: 3.1.0
info:
  title: Streamkap REST API
  description: >-
    The Streamkap REST API allows you to programmatically manage your CDC
    pipelines, sources, destinations, transforms, and more.


    Authenticate using a bearer token obtained from the [Access
    Token](/api-reference/auth/access-token) endpoint with your API client
    credentials.
  contact:
    name: Streamkap Support
    url: https://streamkap.com/
    email: support@streamkap.com
  license:
    name: Proprietary
  version: 2.0.0
servers:
  - url: https://api.streamkap.com
    description: Production
security: []
tags:
  - name: Agents
    description: Create, deploy, and manage Flink-based AI agents.
  - name: Agents Observability
    description: >-
      Read-only views over the MCP audit log: agent rollup, sessions, spans,
      histograms, external-agent verify.
  - name: Alerts
    description: Manage alert subscribers, preferences, and notification credentials.
  - name: Authentication
    description: Obtain and refresh access tokens, manage client credentials and roles.
  - name: Billing
    description: Retrieve usage metrics, summaries, and export billing data.
  - name: Consumer Groups
    description: List, inspect, and reset Kafka consumer group offsets.
  - name: Dashboard
    description: Retrieve organisation-level statistics and overview data.
  - name: Destinations
    description: Create, configure, and manage data destinations and their lifecycle.
  - name: Kafka Access
    description: Manage Kafka users and their access permissions.
  - name: Logs
    description: Query and summarise system logs.
  - name: Pipelines
    description: Create, configure, and manage CDC pipelines and their lifecycle.
  - name: Project Keys
    description: Manage project keys that bundle API credentials and optional Kafka access.
  - name: Schema Registry
    description: Browse schema subjects, versions, and retrieve schema definitions.
  - name: Services
    description: View and switch service metadata.
  - name: Sources
    description: >-
      Create, configure, and manage data sources, snapshots, and their
      lifecycle.
  - name: Tags
    description: Create, update, and manage resource tags for organisation.
  - name: Topics
    description: Browse topic details, statistics, configurations, metrics, and messages.
  - name: Transforms
    description: >-
      Create, deploy, and manage data transforms, unit tests, and implementation
      details.
paths:
  /agents/{job_id}/logs:
    get:
      tags:
        - Agents
      summary: Get Agent Logs
      description: |-
        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).
      operationId: getAgentLogs
      parameters:
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            title: Job Id
        - name: tail
          in: query
          required: false
          schema:
            type: integer
            default: 100
            title: Tail
        - name: level
          in: query
          required: false
          schema:
            type: string
            default: INFO
            title: Level
        - name: search
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Search
        - name: since
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Since
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentLogsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - FronteggHTTPAuthentication: []
components:
  schemas:
    AgentLogsResponse:
      properties:
        lines:
          items:
            $ref: '#/components/schemas/AgentLogLine'
          type: array
          title: Lines
        flinkExceptions:
          items:
            $ref: '#/components/schemas/AgentFlinkException'
          type: array
          title: Flinkexceptions
        scope:
          type: string
          enum:
            - namespace
            - agent
          title: Scope
          description: >-
            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.
          default: namespace
      additionalProperties: false
      type: object
      title: AgentLogsResponse
      description: >-
        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.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentLogLine:
      properties:
        timestamp:
          anyOf:
            - type: string
            - type: 'null'
          title: Timestamp
          description: Line timestamp as emitted by the Flink logger
        level:
          type: string
          title: Level
          description: Log level — DEBUG, INFO, WARN, ERROR
          default: INFO
        message:
          type: string
          title: Message
          description: Log message body
      additionalProperties: false
      type: object
      required:
        - message
      title: AgentLogLine
      description: A single ``[AGENT]``-prefixed Flink TaskManager log line.
    AgentFlinkException:
      properties:
        timestamp:
          anyOf:
            - type: string
            - type: 'null'
          title: Timestamp
          description: ISO8601 timestamp (Flink millis-since-epoch normalised)
        exception:
          type: string
          title: Exception
          description: Stack trace or exception text
        task:
          anyOf:
            - type: string
            - type: 'null'
          title: Task
          description: Flink task name when available
      additionalProperties: false
      type: object
      required:
        - exception
      title: AgentFlinkException
      description: A single Flink job exception entry.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    FronteggHTTPAuthentication:
      type: http
      scheme: bearer

````