openapi: 3.1.0
info:
  title: Wabee Agent Core API
  summary: Wabee Agent Core API
  description: |2-

        Wabee Agent Core API enables developers to interact with an AI agent in a custom, secure and flexible manner through REST API calls.

        One can build applications to interact with the agent API to complete a task using any of the `Agents` endpoints which allow for both text streaming and direct JSON response.
        The `Memory` endpoints are useful for managing the agent memory programatically.
        Moreover, the `Metrics` endpoints provide an interface for monitoring the underlying Agent in terms of latency, health, token consumption and much more.
       
  license:
    name: Proprietary License
    identifier: Wabee License
  version: v1
servers:
  - url: https://<your_agent_uri>.wabee.ai
    description: Production server
paths:
  /core/v1/chain:
    post:
      tags:
        - Agent
      summary: Demand from the agent and get a full response when it finishes
      description: >-
        Executes a chain of AI-powered reasoning and actions to respond to a
        given query or task.
            
            The agent leverages its configured tools and knowledge to:
            - Analyze the input query
            - Plan necessary steps
            - Execute relevant tools
            - Synthesize a comprehensive response
            
            ## Image Support
            Include images in your request using the `images` field:
            - **Base64 Format**: Set `type="base64"` with base64-encoded image data
            - **File Path**: Set `type="file_path"` with path to existing image
            
            Maximum 5 images per request. Invalid images will trigger a 400 response.
            
            ## Authentication
            Requires API key via `x-wabee-access` header.
            
            ## Session Management
            Use `session-id` header to maintain conversation context across requests.
      operationId: chain_core_v1_chain_post
      security:
        - APIKeyHeader: []
      parameters:
        - name: session-id
          in: header
          required: false
          schema:
            description: >-
              Session unique identifier, used to keep track of previous
              interations and much more
            title: Session-Id
          description: >-
            Session unique identifier, used to keep track of previous
            interations and much more
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageInputModels'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChainResponseModel'
          headers:
            session-id:
              description: session unique identifier
              content:
                text/plain:
                  example: x1wbee
            request-id:
              description: an auto-generated request unique identifier
              content:
                text/plain:
                  example: 3f364df0-a4e5-41b1-bb33-eeaa616a8060
        '400':
          content:
            application/json:
              example:
                body: Invalid image format or content
                status_code: 400
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              example:
                body: Jwt verification fails
                status_code: 401
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                body: 'RBAC: access denied'
                status_code: 403
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '413':
          content:
            application/json:
              example:
                body: Input message is bigger than allowed
                status_code: 413
                details:
                  error_type: MaxInputException
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Request Entity Too Large
        '422':
          content:
            application/json:
              example:
                body: Invalid image format or content
                status_code: 422
                details:
                  error_type: ValidationError
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
  /core/v1/chain_streamming:
    post:
      tags:
        - Agent
      summary: Demand from the agent and get a streamed response until it finishes
      description: >-
        Requests Wabee AI Agent to answer a question regarding the mission that
        the agent was given to upon creation.
            
            The agent can make use of any of the available tools along with its own reasoning to complete the given task, depending on its complexity, the response might take some time to be returned to the user.
            
            Images can be included in messages using the `images` field, which accepts a list of image inputs. Each image can be provided in one of two formats:
            - Base64-encoded strings: Set type="base64" and provide the base64-encoded image data in the content field
            - File paths: Set type="file_path" and provide the full path to the image file in the content field
            
            Invalid image inputs will result in a 400 Bad Request response. The endpoint validates:
            - Base64 encoding format for base64 images
            - File existence for file path images
            
            Note: `session_id` field on request body is kept for compatibility purposes, it will be overwritten with the header value during request processing
            Note: `stream` filed on request body is kept for compatibility purposes, it will be ignored during request processing
            Note: this is pretty much the same as in `/chain`, the only difference is that this endpoint returns a streaming response instead of a JSON object
            Note: the id on the streamming response refers to the current request
            Note: the streamming response ends when finish_reason is different than null
            Note: All headers starting with stix will be sent as context for tools.
      operationId: chain_streamming_core_v1_chain_streamming_post
      deprecated: true
      security:
        - APIKeyHeader: []
      parameters:
        - name: session-id
          in: header
          required: false
          schema:
            description: >-
              Session unique identifier, used to keep track of previous
              interations and much more
            title: Session-Id
          description: >-
            Session unique identifier, used to keep track of previous
            interations and much more
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageInputModels'
      responses:
        '200':
          description: Successful Response
          content:
            text/event-stream:
              example: >-
                data: {"id": "3f364df0-a4e5-41b1-bb33-eeaa616a8060", "token":
                "The economic outlook may ", "agent_step": "QUESTION",
                "finish_reason": "null", "usage": [{"costAttribute":
                "gpt-4-32k", "usage": 100, "unit": "tokens"}]}
          headers:
            session-id:
              description: session unique identifier
              content:
                text/plain:
                  example: x1wbee
            request-id:
              description: an auto-generated request unique identifier
              content:
                text/plain:
                  example: 3f364df0-a4e5-41b1-bb33-eeaa616a8060
        '401':
          content:
            application/json:
              example:
                body: Jwt verification fails
                status_code: 401
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                body: 'RBAC: access denied'
                status_code: 403
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '413':
          content:
            application/json:
              example:
                body: Input message is bigger than allowed
                status_code: 413
                details:
                  error_type: MaxInputException
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Request Entity Too Large
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          content:
            application/json:
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
  /core/v1/chain_streaming:
    post:
      tags:
        - Agent
      summary: Demand from the agent and get a streamed response until it finishes
      description: >-
        Requests Wabee AI Agent to answer a question regarding the mission that
        the agent was given to upon creation.
            
            The agent can make use of any of the available tools along with its own reasoning to complete the given task, depending on its complexity, the response might take some time to be returned to the user.
            
            Note: `session_id` field on request body is kept for compatibility purposes, it will be overwritten with the header value during request processing
            Note: `stream` filed on request body is kept for compatibility purposes, it will be ignored during request processing
            Note: this is pretty much the same as in `/chain`, the only difference is that this endpoint returns a streaming response instead of a JSON object
            Note: the id on the streamming response refers to the current request
            Note: the streamming response ends when finish_reason is different than null
            Note: All headers starting with stix will be sent as context for tools.
      operationId: chain_core_v1_chain_streaming_post
      security:
        - APIKeyHeader: []
      parameters:
        - name: session-id
          in: header
          required: false
          schema:
            description: >-
              Session unique identifier, used to keep track of previous
              interations and much more
            title: Session-Id
          description: >-
            Session unique identifier, used to keep track of previous
            interations and much more
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageInputModels'
      responses:
        '200':
          description: Successful Response
          content:
            text/event-stream:
              example: >-
                data: {"id": "3f364df0-a4e5-41b1-bb33-eeaa616a8060", "token": "A
                perspectiva econômica pode ", "agent_step": "PERGUNTA",
                "finish_reason": "null", "usage": [{"costAttribute":
                "gpt-4-32k", "usage": 100, "unit": "tokens"}]}
          headers:
            session-id:
              description: session unique identifier
              content:
                text/plain:
                  example: x1wbee
            request-id:
              description: an auto-generated request unique identifier
              content:
                text/plain:
                  example: 3f364df0-a4e5-41b1-bb33-eeaa616a8060
        '401':
          content:
            application/json:
              example:
                body: Jwt verification fails
                status_code: 401
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                body: 'RBAC: access denied'
                status_code: 403
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '413':
          content:
            application/json:
              example:
                body: Input message is bigger than allowed
                status_code: 413
                details:
                  error_type: MaxInputException
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Request Entity Too Large
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          content:
            application/json:
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
  /core/v1/chain_async:
    post:
      tags:
        - Agent
      summary: >-
        Demand from the agent and get a fast ack response, use callback to
        receive the completion response
      description: |-
        Requests Wabee AI Agent to answer a question asynchronously.
            If a callback_url is provided, the agent will send the response to the given URL.
            
            The agent can make use of any of the available tools along with its own reasoning to complete the given task, depending on its complexity, the response might take some time to be returned to the user.
            
            Note: `session_id` field on request body is kept for compatibility purposes, it will be overwritten with the header value during request processing
            Note: `stream` filed on request body is kept for compatibility purposes, it will be ignored during request processing
      operationId: async_chain_core_v1_chain_async_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AsyncChainRequestModel'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
  /core/v1/memory/list:
    get:
      tags:
        - Memory
      summary: Retrieve a list of memories
      description: Use this endpoint to fetch the agent memory.
      operationId: get_memories_core_v1_memory_list_get
      security:
        - APIKeyHeader: []
      parameters:
        - name: module_id
          in: query
          required: true
          schema:
            type: string
            title: Module Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '201':
          content:
            application/json:
              example:
                body: Memories retrieved
          description: Created
        '401':
          content:
            application/json:
              example:
                body: Jwt verification fails
                status_code: 401
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                body: 'RBAC: access denied'
                status_code: 403
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          content:
            application/json:
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
  /core/v1/memory/search:
    get:
      tags:
        - Memory
      summary: Searche semantically related memories
      description: Use this endpoint to search for facts in the agent memory.
      operationId: search_memory_observation_core_v1_memory_search_get
      security:
        - APIKeyHeader: []
      parameters:
        - name: query
          in: query
          required: true
          schema:
            type: string
            title: Query
        - name: module_id
          in: query
          required: false
          schema:
            type: string
            default: agent_memory
            title: Module Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '201':
          content:
            application/json:
              example: Relevant memories retrieved
          description: Created
        '401':
          content:
            application/json:
              example:
                body: Jwt verification fails
                status_code: 401
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                body: 'RBAC: access denied'
                status_code: 403
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          content:
            application/json:
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
  /core/v1/memory/observation:
    post:
      tags:
        - Memory
      summary: Add a new observation to the agent memory
      description: >-
        Use this endpoint to include a new observation to the agent memory. The
        agent will retrieve relevant memories based on the context of the user
        input and the recency of the observation for every new interaction 
            via /chain or /chain_streamming endpoints.

            Addition Strategies: 
            Naive --> Simply appends current observation to memory
            Delete --> Removes old memories that conflict with current memory
            Update --> Updates old memories that conflict with current memory, and alters their content to reflect the fact that they are no longer "true".

            The memory of each agent is eventual consistent. If there are multiples instances of the same agent running, all of them can modify the memory and eventually all of them will have the same memory state.
      operationId: add_memory_observation_core_v1_memory_observation_post
      security:
        - APIKeyHeader: []
      parameters:
        - name: module_id
          in: query
          required: false
          schema:
            type: string
            default: agent_memory
            title: Module Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddObservation'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '201':
          content:
            application/json:
              example:
                body: Observation added to memory
          description: Created
        '401':
          content:
            application/json:
              example:
                body: Jwt verification fails
                status_code: 401
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                body: 'RBAC: access denied'
                status_code: 403
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          content:
            application/json:
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
  /core/v1/memory/discard:
    post:
      tags:
        - Memory
      summary: Clears training memory
      operationId: discard_memory_observations_core_v1_memory_discard_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
              example:
                body: Memories discarded
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Jwt verification fails
                status_code: 401
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: 'RBAC: access denied'
                status_code: 403
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
      security:
        - APIKeyHeader: []
  /core/v1/memory/commit:
    post:
      tags:
        - Memory
      summary: Merges training memory with agent memory
      operationId: commit_memory_observations_core_v1_memory_commit_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
              example: Memories committed
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Jwt verification fails
                status_code: 401
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: 'RBAC: access denied'
                status_code: 403
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
      security:
        - APIKeyHeader: []
  /core/v1/metrics:
    get:
      tags:
        - Observability
      summary: Get agent metrics
      description: >-
        Returns quantitative information about agent runs for monitoring. The
        following metrics are provided:
            
            - status_value_counts (histogram)
            - total_requests
            - total_errors
            - total_tokens
            - mean_tokens
            - mean_latency
            - max_latency
            - min_latency
            - total_prompt_tokens
            - mean_prompt_tokens
            - total_completion_tokens
            - mean_completion_tokens
      operationId: get_metrics_core_v1_metrics_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricsResponseModel'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Jwt verification fails
                status_code: 401
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: 'RBAC: access denied'
                status_code: 403
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
      security:
        - APIKeyHeader: []
  /core/v1/logs:
    get:
      tags:
        - Observability
      summary: Get agent logs
      description: >-
        Returns run execution logs in stringify format. The logs contain the
        following fields:
            
            - name: run name
            - id: run unique identifier
            - model: model name
            - error: run error if exists, else null
            - status: run status
            - latency: run latency
            - end_time: terminated run timestamp
            - completion_tokens: number of tokens returned by the model when the run is finished
            - total_tokens: total number of tokens associated with the run
            
            The results are paginated. Use offset and limit parameters to navigate through pages.
      operationId: get_logs_core_v1_logs_get
      security:
        - APIKeyHeader: []
      parameters:
        - name: run_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Run Id
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 20
            minimum: 1
            description: Number of items to return per page
            default: 10
            title: Limit
          description: Number of items to return per page
        - name: start_timestamp
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            description: The epoch timestamp to start the search
            default: 0
            title: Start Timestamp
          description: The epoch timestamp to start the search
        - name: end_timestamp
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            description: The epoch timestamp to end the search
            default: 0
            title: End Timestamp
          description: The epoch timestamp to end the search
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
              example:
                data: >-
                  [{"name":"Wabee LLM
                  Advanced","id":"70ea273b-c2ba-4c24-9a8b-aae2cda7c95e","model":"llm-model-advanced","error":null,"status":"success","latency":5.5,"end_time":1712076831672,"completion_tokens":150,"total_tokens":300}]
                total: 100
                has_more: true
        '401':
          content:
            application/json:
              example:
                body: Jwt verification fails
                status_code: 401
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                body: 'RBAC: access denied'
                status_code: 403
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          content:
            application/json:
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
  /core/v1/metadata:
    get:
      tags:
        - Agent
      summary: Get wabee AI agent metadata
      description: >-
        Returns metadata information about the agent configuration, including
        its description, capabilities and other relevant information.
      operationId: get_metadata_core_v1_metadata_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
              example:
                name: Wabee Agent
                description: An AI agent that helps with specific tasks
                metadata: {}
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Jwt verification fails
                status_code: 401
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: 'RBAC: access denied'
                status_code: 403
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Internal server error
                status_code: 500
                details:
                  error_type: Exception
      security:
        - APIKeyHeader: []
components:
  schemas:
    AddObservation:
      properties:
        module_id:
          type: string
          title: Module Id
          description: Name of the module to insert
          examples:
            - agent_memory
        addition_strategy:
          type: string
          enum:
            - naive
            - delete
            - update
          title: Addition Strategy
          description: Strategy to add the memory
          default: naive
          examples:
            - update
        input:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
          title: Input
          description: The data to be added to the memory
          examples:
            - This is a test observation
      type: object
      required:
        - module_id
        - input
      title: AddObservation
    AsyncChainRequestModel:
      properties:
        specversion:
          type: string
          title: Specversion
          description: The version of the CloudEvents spec.
          example: '1.0'
        type:
          type: string
          title: Type
          description: >-
            The type of the event. Use the value 'ai.wabee.agent.chain' for
            chain requests.
          default: ai.wabee.agent.chain
          examples:
            - ai.wabee.agent.chain
        source:
          type: string
          title: Source
          description: The source of the event.
          example: https://wabee.ai/agent
        id:
          type: string
          title: Id
          description: A unique identifier for the event.
          example: A234-1234-1234
        time:
          type: string
          title: Time
          description: The time the event was created.
          example: '2018-04-05T17:31:00Z'
        data:
          allOf:
            - $ref: '#/components/schemas/MessageInputModelWithCallback'
          description: The data of the event.
      type: object
      required:
        - specversion
        - source
        - id
        - time
        - data
      title: AsyncChainRequestModel
      description: An object compatible with the CloudEvents spec.
    ChainResponseModel:
      properties:
        body:
          allOf:
            - $ref: '#/components/schemas/ChainResponseModelBody'
          description: The complete agent response
      type: object
      required:
        - body
      title: ChainResponseModel
      description: Top-level response model for chain requests
    ChainResponseModelBody:
      properties:
        input:
          type: string
          title: Input
          description: The original input message sent to the agent
          example: What is the economic outlook?
        output:
          type: string
          title: Output
          description: The final response generated by the agent
          example: The economic outlook varies significantly by region...
        intermediate_steps:
          items:
            items:
              anyOf:
                - $ref: '#/components/schemas/ChainResponseModelBodyIntermediateStep'
                - type: string
            type: array
          type: array
          title: Intermediate Steps
          description: >-
            The sequence of steps taken by the agent to generate the response,
            including tool usage and reasoning
          example:
            - - log: Retrieving news data
                tool: api_tool
                tool_input: curl https://newsapi.org/v2/everything
                type: AgentAction
              - >-
                Explanation: Gathering real-time economic data from trusted
                sources
        usage:
          items:
            $ref: '#/components/schemas/ChainResponseModelBodyUsage'
          type: array
          title: Usage
          description: Resource usage metrics for the request
      type: object
      required:
        - input
        - output
        - intermediate_steps
        - usage
      title: ChainResponseModelBody
      description: Represents the complete response from the AI agent
    ChainResponseModelBodyIntermediateStep:
      properties:
        tool:
          type: string
          title: Tool
          description: The identifier of the tool used in this step
          example: api_tool
        tool_input:
          type: string
          title: Tool Input
          description: The input provided to the tool
          example: curl https://newsapi.org/v2/everything
        log:
          type: string
          title: Log
          description: Detailed log of the tool execution
          example: Retrieving news data
        type:
          type: string
          title: Type
          description: The type of action performed in this step
          example: AgentAction
      type: object
      required:
        - tool
        - tool_input
        - log
        - type
      title: ChainResponseModelBodyIntermediateStep
      description: Represents a single step in the agent's reasoning process
    ChainResponseModelBodyUsage:
      properties:
        costAttribute:
          type: string
          title: Costattribute
          description: The name of the resource being measured (e.g. model name)
          example: gpt-4-32k
        usage:
          type: string
          title: Usage
          description: The quantity of the resource used
          example: '100'
        unit:
          type: string
          title: Unit
          description: The unit of measurement (e.g. tokens, requests)
          example: tokens
      type: object
      required:
        - costAttribute
        - usage
        - unit
      title: ChainResponseModelBodyUsage
      description: Represents usage metrics for cost tracking
    DataFilterHints:
      properties:
        tool_name:
          type: string
          title: Tool Name
          description: The name of the tool where the filter should be considered.
          examples:
            - bubble_data
        filter_type:
          type: string
          enum:
            - equals
            - gt
            - lt
            - gte
            - lte
            - like
          title: Filter Type
          description: The type of filter to be applied.
          examples:
            - equals
        filter_key:
          type: string
          title: Filter Key
          description: >-
            The name of the key to be filtered, this could be a column or the
            name of an api parameter for example.
          examples:
            - company_name
        filter_value:
          type: string
          title: Filter Value
          description: The value to be filtered by.
          examples:
            - Company 1
      type: object
      required:
        - tool_name
        - filter_type
        - filter_key
        - filter_value
      title: DataFilterHints
      description: >-
        Special metadata-like hints to be passed to the agent in order to
        instruct him on how to filter the data on some tools that support filter
    ErrorResponse:
      properties:
        body:
          type: string
          title: Body
          description: Error message or description
          examples:
            - Invalid input
            - Internal server error
        status_code:
          type: integer
          title: Status Code
          description: HTTP status code
          examples:
            - 400
            - 500
          example: 400
        details:
          anyOf:
            - type: object
            - type: 'null'
          title: Details
          description: Additional error details if available
          examples:
            - error_type: Exception
      type: object
      required:
        - body
        - status_code
      title: ErrorResponse
      description: Standard error response format
    HTTPValidationError:
      properties:
        body:
          type: string
          title: Body
          description: Error message or description
          examples:
            - Invalid input
            - Internal server error
        status_code:
          type: integer
          title: Status Code
          description: HTTP status code
          examples:
            - 400
            - 500
          example: 400
        details:
          anyOf:
            - type: object
            - type: 'null'
          title: Details
          description: Additional error details if available
          examples:
            - error_type: Exception
      type: object
      required:
        - body
        - status_code
      title: ErrorResponse
      description: Standard error response format
    HistoryMsgModels:
      properties:
        role:
          type: string
          title: Role
          description: defines the role associated with the message
          example: assistant
        content:
          type: string
          title: Content
          description: message content
          example: Hello, I am your virtual assistant
      type: object
      required:
        - role
        - content
      title: HistoryMsgModels
    ImageInput:
      properties:
        content:
          type: string
          title: Content
          description: Base64 encoded image data or file path
          examples:
            - >-
              iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nOydd3gU5f7/3+9z
        type:
          type: string
          enum:
            - base64
            - file_path
          title: Type
          description: Type of image input
          examples:
            - base64
      type: object
      required:
        - content
        - type
      title: ImageInput
    MessageInputModelWithCallback:
      properties:
        messages:
          items:
            $ref: '#/components/schemas/HistoryMsgModels'
          type: array
          title: Messages
          description: List of messages to be processed by the agent
          example:
            - content: What is the economic outlook?
              role: user
        data_filter_hints:
          anyOf:
            - items:
                $ref: '#/components/schemas/DataFilterHints'
              type: array
            - type: 'null'
          title: Data Filter Hints
          description: >-
            Special metadata-like hints to be passed to the agent in order to
            instruct him on how to filter the data on some tools that support
            filter
          example:
            - filter_key: unitname
              filter_type: equals
              filter_value: Unit 1
              tool_name: bubble_data
        context_files:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Context Files
          description: >-
            The path for files which the agent already has access to and should
            be considered by it when processing the messages
          example:
            - inputs/chat-files/test123/file.pdf
        images:
          anyOf:
            - items:
                $ref: '#/components/schemas/ImageInput'
              type: array
            - type: 'null'
          title: Images
          description: List of images associated with the message
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
          description: >-
            An optional session ID to associate with the chain. This can be used
            to track multiple interactions with the chain across different
            requests. If not provided, a session ID will be generated.
        callback_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Callback Url
          description: An optional callbacik URL to send the response to.
      type: object
      required:
        - messages
      title: MessageInputModelWithCallback
    MessageInputModels:
      properties:
        messages:
          items:
            $ref: '#/components/schemas/HistoryMsgModels'
          type: array
          title: Messages
          description: List of messages to be processed by the agent
          example:
            - content: What is the economic outlook?
              role: user
        data_filter_hints:
          anyOf:
            - items:
                $ref: '#/components/schemas/DataFilterHints'
              type: array
            - type: 'null'
          title: Data Filter Hints
          description: >-
            Special metadata-like hints to be passed to the agent in order to
            instruct him on how to filter the data on some tools that support
            filter
          example:
            - filter_key: unitname
              filter_type: equals
              filter_value: Unit 1
              tool_name: bubble_data
        context_files:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Context Files
          description: >-
            The path for files which the agent already has access to and should
            be considered by it when processing the messages
          example:
            - inputs/chat-files/test123/file.pdf
        images:
          anyOf:
            - items:
                $ref: '#/components/schemas/ImageInput'
              type: array
            - type: 'null'
          title: Images
          description: List of images associated with the message
      type: object
      required:
        - messages
      title: MessageInputModels
    MetricsResponseModel:
      properties:
        status_value_counts:
          additionalProperties:
            type: integer
          type: object
          title: Status Value Counts
          description: run status counts
          example:
            pending: 10
            success: 90
        total_requests:
          type: integer
          title: Total Requests
          description: Total number of requests
          example: 100
        total_errors:
          type: integer
          title: Total Errors
          description: Total number of errors
          example: 10
        total_tokens:
          type: integer
          title: Total Tokens
          description: Total number of tokens
          example: 1000
        mean_tokens:
          type: number
          title: Mean Tokens
          description: Average number of tokens per run
          example: 100.5
        mean_latency:
          type: number
          title: Mean Latency
          description: Average run latency
          example: 10.5
        max_latency:
          type: number
          title: Max Latency
          description: Maximum run latency recorded
          example: 35.5
        min_latency:
          type: number
          title: Min Latency
          description: Minimum run latency recorded
          example: 3.5
        total_prompt_tokens:
          type: integer
          title: Total Prompt Tokens
          description: Total number of tokens on prompt
          example: 900
        mean_prompt_tokens:
          type: number
          title: Mean Prompt Tokens
          description: Average number of tokens on prompt
          example: 85.5
        total_completion_tokens:
          type: integer
          title: Total Completion Tokens
          description: Total number of completion tokens
          example: 100
        mean_completion_tokens:
          type: number
          title: Mean Completion Tokens
          description: Average number of completions tokens
          example: 10.5
      type: object
      required:
        - status_value_counts
        - total_requests
        - total_errors
        - total_tokens
        - mean_tokens
        - mean_latency
        - max_latency
        - min_latency
        - total_prompt_tokens
        - mean_prompt_tokens
        - total_completion_tokens
        - mean_completion_tokens
      title: MetricsResponseModel
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      description: Your API key here
      in: header
      name: x-wabee-access
tags:
  - name: Agent
    description: Endpoints for interacting with the AI agent
  - name: Memory
    description: Endpoints for managing agent memory
  - name: Observability
    description: Endpoints for monitoring agent performance and logs
