Kernel Browser Logs API

Stream logs from the browser instance.

OpenAPI Specification

kernel-browser-logs-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Kernel API Keys Browser Logs API
  description: Developer tools and cloud infrastructure for AI agents to use web browsers
  version: 0.1.0
servers:
- url: https://api.onkernel.com
  description: API Server
security:
- bearerAuth: []
tags:
- name: Browser Logs
  description: Stream logs from the browser instance.
paths:
  /browsers/{id}/logs/stream:
    get:
      summary: Stream log files on the browser instance via SSE
      operationId: logsStream
      tags:
      - Browser Logs
      security:
      - bearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Browser session ID
      - in: query
        name: source
        required: true
        schema:
          type: string
          enum:
          - path
          - supervisor
      - in: query
        name: follow
        required: false
        schema:
          type: boolean
          default: true
      - in: query
        description: only required if source is path
        name: path
        required: false
        schema:
          type: string
      - in: query
        name: supervisor_process
        description: only required if source is supervisor
        required: false
        schema:
          type: string
      responses:
        '200':
          description: SSE stream of logs
          headers:
            X-SSE-Content-Type:
              description: Media type of SSE data events (application/json)
              schema:
                type: string
                const: application/json
          content:
            text/event-stream:
              schema:
                $ref: '#/components/schemas/LogEvent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
      x-codeSamples:
      - lang: JavaScript
        source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n  apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nconst logEvent = await client.browsers.logs.stream('id', { source: 'path' });\n\nconsole.log(logEvent.event);"
      - lang: Python
        source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n    api_key=os.environ.get(\"KERNEL_API_KEY\"),  # This is the default and can be omitted\n)\nfor log in client.browsers.logs.stream(\n    id=\"id\",\n    source=\"path\",\n):\n  print(log)"
      - lang: Go
        source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tstream := client.Browsers.Logs.StreamStreaming(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserLogStreamParams{\n\t\t\tSource: kernel.BrowserLogStreamParamsSourcePath,\n\t\t},\n\t)\n\tfor stream.Next() {\n\t\tfmt.Printf(\"%+v\\n\", stream.Current())\n\t}\n\terr := stream.Err()\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
components:
  responses:
    InternalError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: Bad Request – invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
      - code
      - message
      properties:
        code:
          type: string
          description: Application-specific error code (machine-readable)
          example: bad_request
        message:
          type: string
          description: Human-readable error description for debugging
          example: 'Missing required field: app_name'
        details:
          type: array
          description: Additional error details (for multiple errors)
          items:
            $ref: '#/components/schemas/ErrorDetail'
        inner_error:
          $ref: '#/components/schemas/ErrorDetail'
    LogEvent:
      type: object
      description: A log entry from the application.
      required:
      - event
      - message
      - timestamp
      properties:
        event:
          type: string
          const: log
          description: Event type identifier (always "log").
        timestamp:
          type: string
          format: date-time
          description: Time the log entry was produced.
        message:
          type: string
          description: Log message text.
    ErrorDetail:
      type: object
      properties:
        code:
          type: string
          description: Lower-level error code providing more specific detail
          example: invalid_input
        message:
          type: string
          description: Further detail about the error
          example: Provided version string is not semver compliant
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer