StakPak Agents (V2) API

The Agents (V2) API from StakPak — 2 operation(s) for agents (v2).

OpenAPI Specification

stakpak-agents-v2-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Stakpak Account Agents (V2) API
  description: API for the Stakpak platform
  license:
    name: ''
  version: 1.0.0
servers:
- url: https://apiv2.stakpak.dev
  description: Production server
- url: http://localhost:4000
  description: Local server
tags:
- name: Agents (V2)
paths:
  /v2/{account}/agents/sessions:
    get:
      tags:
      - Agents (V2)
      summary: List Agent Sessions
      operationId: get_agent_sessions_handler
      parameters:
      - name: flow_name
        in: query
        required: false
        schema:
          type:
          - string
          - 'null'
      - name: flow_version_id
        in: query
        required: false
        schema:
          type:
          - string
          - 'null'
      - name: limit
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int32
          minimum: 0
      - name: offset
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int32
          minimum: 0
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AgentSession'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
      - Api Key: []
  /v2/{account}/agents/sessions/stats:
    get:
      tags:
      - Agents (V2)
      summary: Get User Session Usage Statistics for Dashboard
      operationId: get_agent_sessions_stats_handler
      parameters:
      - name: from_date
        in: query
        required: false
        schema:
          type:
          - string
          - 'null'
      - name: to_date
        in: query
        required: false
        schema:
          type:
          - string
          - 'null'
      - name: limit
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int32
          minimum: 0
      - name: offset
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int32
          minimum: 0
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionUsageAnalysis'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
      - Api Key: []
components:
  schemas:
    AgentID:
      type: string
      enum:
      - pablo:v1
    ToolCallCounts:
      type: object
      required:
      - successful
      - failed
      - aborted
      - total
      properties:
        aborted:
          type: integer
          format: int32
          minimum: 0
        failed:
          type: integer
          format: int32
          minimum: 0
        successful:
          type: integer
          format: int32
          minimum: 0
        total:
          type: integer
          format: int32
          minimum: 0
    ErrorBody:
      type: object
      required:
      - key
      - message
      properties:
        key:
          type: string
        message:
          type: string
    AgentSessionOwner:
      type: object
      required:
      - name
      properties:
        name:
          type: string
    AgentSessionVisibility:
      type: string
      enum:
      - PRIVATE
      - PUBLIC
    AgentCheckpointListItem:
      type: object
      required:
      - id
      - status
      - execution_depth
      - created_at
      - updated_at
      properties:
        created_at:
          type: string
          format: date-time
        execution_depth:
          type: integer
          minimum: 0
        id:
          type: string
          format: uuid
        parent:
          oneOf:
          - type: 'null'
          - $ref: '#/components/schemas/AgentParentCheckpoint'
        status:
          $ref: '#/components/schemas/AgentStatus'
        updated_at:
          type: string
          format: date-time
    AgentParentCheckpoint:
      type: object
      required:
      - id
      properties:
        id:
          type: string
          format: uuid
    ErrorResponse:
      type: object
      required:
      - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
    FlowRef:
      oneOf:
      - type: object
        required:
        - owner_name
        - flow_name
        - version_id
        - type
        properties:
          flow_name:
            type: string
          owner_name:
            type: string
          type:
            type: string
            enum:
            - Version
          version_id:
            type: string
      - type: object
        required:
        - owner_name
        - flow_name
        - tag_name
        - type
        properties:
          flow_name:
            type: string
          owner_name:
            type: string
          tag_name:
            type: string
          type:
            type: string
            enum:
            - Tag
    SessionUsageAnalysis:
      type: object
      required:
      - analysis_period
      - total_sessions
      - sessions_with_activity
      - tools_usage
      - total_tool_calls
      - successful_tool_calls
      - failed_tool_calls
      - aborted_tool_calls
      - total_time_saved_seconds
      properties:
        aborted_tool_calls:
          type: integer
          format: int32
          minimum: 0
        analysis_period:
          type: string
        failed_tool_calls:
          type: integer
          format: int32
          minimum: 0
        from_date:
          type:
          - string
          - 'null'
        sessions_with_activity:
          type: integer
          format: int32
          minimum: 0
        successful_tool_calls:
          type: integer
          format: int32
          minimum: 0
        to_date:
          type:
          - string
          - 'null'
        tools_usage:
          type: array
          items:
            $ref: '#/components/schemas/ToolUsageStats'
        total_sessions:
          type: integer
          format: int32
          minimum: 0
        total_time_saved_seconds:
          type: integer
          format: int32
          minimum: 0
        total_tool_calls:
          type: integer
          format: int32
          minimum: 0
    AgentStatus:
      type: string
      enum:
      - RUNNING
      - COMPLETE
      - BLOCKED
      - FAILED
    ToolUsageStats:
      type: object
      required:
      - tool_name
      - display_name
      - usage_counts
      properties:
        display_name:
          type: string
        time_saved_per_call:
          type:
          - integer
          - 'null'
          format: int32
          minimum: 0
        time_saved_seconds:
          type:
          - integer
          - 'null'
          format: int32
          minimum: 0
        tool_name:
          type: string
        usage_counts:
          $ref: '#/components/schemas/ToolCallCounts'
    AgentSession:
      type: object
      required:
      - id
      - title
      - agent_id
      - visibility
      - checkpoints
      - created_at
      - updated_at
      properties:
        agent_id:
          $ref: '#/components/schemas/AgentID'
        checkpoints:
          type: array
          items:
            $ref: '#/components/schemas/AgentCheckpointListItem'
        created_at:
          type: string
          format: date-time
        flow_ref:
          oneOf:
          - type: 'null'
          - $ref: '#/components/schemas/FlowRef'
        id:
          type: string
          format: uuid
        owner:
          oneOf:
          - type: 'null'
          - $ref: '#/components/schemas/AgentSessionOwner'
        title:
          type: string
        updated_at:
          type: string
          format: date-time
        visibility:
          $ref: '#/components/schemas/AgentSessionVisibility'
  securitySchemes:
    Api Key:
      type: http
      scheme: bearer
      bearerFormat: JWT
    Token:
      type: http
      scheme: bearer
      bearerFormat: JWT
    cookie:
      type: apiKey
      in: cookie
      name: .idToken