Langbase Pipes API

The Pipes API from Langbase — 3 operation(s) for pipes.

OpenAPI Specification

langbase-pipes-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Langbase Agent Pipes API
  description: Representative OpenAPI description of the Langbase serverless AI developer platform. All endpoints are served from https://api.langbase.com and authenticated with a Bearer API key. Generative endpoints (Pipes run, Agent run) return Server-Sent Events (SSE) when `stream` is true. This document is a faithful representative model authored by API Evangelist and is not the provider's official specification.
  termsOfService: https://langbase.com/terms
  contact:
    name: Langbase Support
    url: https://langbase.com/support
  version: '1.0'
servers:
- url: https://api.langbase.com
  description: Langbase production API
security:
- api_key: []
tags:
- name: Pipes
paths:
  /v1/pipes/run:
    post:
      operationId: runPipe
      tags:
      - Pipes
      summary: Run a Pipe.
      description: Executes a Pipe (deployable AI agent) over a message array. When `stream` is true the response is delivered as Server-Sent Events (SSE) with incremental delta content. The response includes an `lb-thread-id` header for continuing multi-turn conversations.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunPipeRequest'
      responses:
        '200':
          description: A Pipe run completion, or an SSE stream when stream is true.
          headers:
            lb-thread-id:
              schema:
                type: string
              description: Identifier of the conversation thread.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunResponse'
            text/event-stream:
              schema:
                type: string
                description: Server-Sent Events stream of completion chunks.
  /v1/pipes:
    get:
      operationId: listPipes
      tags:
      - Pipes
      summary: List Pipes.
      responses:
        '200':
          description: A list of Pipes.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Pipe'
    post:
      operationId: createPipe
      tags:
      - Pipes
      summary: Create a Pipe.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePipeRequest'
      responses:
        '200':
          description: The created Pipe.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pipe'
  /v1/pipes/{name}:
    post:
      operationId: updatePipe
      tags:
      - Pipes
      summary: Update a Pipe.
      parameters:
      - in: path
        name: name
        required: true
        schema:
          type: string
        description: The name of the Pipe to update.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePipeRequest'
      responses:
        '200':
          description: The updated Pipe.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pipe'
components:
  schemas:
    Message:
      type: object
      properties:
        role:
          type: string
          enum:
          - system
          - user
          - assistant
          - tool
        content:
          type: string
        name:
          type: string
      required:
      - role
    RunPipeRequest:
      type: object
      properties:
        messages:
          type: array
          items:
            $ref: '#/components/schemas/Message'
        variables:
          type: object
          additionalProperties:
            type: string
          description: Dynamic variables for adaptable prompts.
        threadId:
          type: string
          description: Continue an existing conversation thread.
        stream:
          type: boolean
          default: false
          description: When true, responses are streamed as Server-Sent Events.
        tools:
          type: array
          items:
            type: object
        memory:
          type: array
          items:
            type: object
          description: Memory objects to override the Pipe defaults.
      required:
      - messages
    RunResponse:
      type: object
      properties:
        completion:
          type: string
          description: The generated text completion.
        raw:
          type: object
          description: The raw upstream provider response.
        usage:
          $ref: '#/components/schemas/Usage'
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
    Pipe:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        status:
          type: string
          enum:
          - public
          - private
        model:
          type: string
        apiKey:
          type: string
          description: The run key scoped to this Pipe.
    CreatePipeRequest:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        status:
          type: string
          enum:
          - public
          - private
        model:
          type: string
        messages:
          type: array
          items:
            $ref: '#/components/schemas/Message'
        tools:
          type: array
          items:
            type: object
        memory:
          type: array
          items:
            type: object
      required:
      - name
  securitySchemes:
    api_key:
      type: http
      scheme: bearer
      bearerFormat: apiKey