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 enhanced observability. We recommend using a UUID
              string.
            title: Session-Id
          description: >-
            Session unique identifier, used to keep track of previous
            interations and enhanced observability. We recommend using a UUID
            string.
        - name: request-id
          in: header
          required: false
          schema:
            description: >-
              Custom request unique identifier, if not provided a new one will
              be generated. We recommend using a UUID string.
            title: Request-Id
          description: >-
            Custom request unique identifier, if not provided a new one will be
            generated. We recommend using a UUID string.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageInputModels'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChainResponseModel-Input'
          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_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 enhanced observability. We recommend using a UUID
              string.
            title: Session-Id
          description: >-
            Session unique identifier, used to keep track of previous
            interations and enhanced observability. We recommend using a UUID
            string.
        - name: request-id
          in: header
          required: false
          schema:
            description: >-
              Custom request unique identifier, if not provided a new one will
              be generated. We recommend using a UUID string.
            title: Request-Id
          description: >-
            Custom request unique identifier, if not provided a new one will be
            generated. We recommend using a UUID string.
      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/sessions/{session_id}:
    get:
      tags:
        - Sessions
      summary: Get the session data
      description: >-
        Retrieves the complete conversation history and metadata for a specific
        session.
            
            The session data includes:
            - All messages exchanged between user and AI
            - Timestamps for each message
            - Additional context like reasoning steps for AI responses
            - Session metadata
            
            Each message contains:
            - role: Either 'human' or 'ai'
            - content: The actual message text
            - timestamp: When the message was sent
            - additional_context: Extra information like reasoning steps (for AI messages)
      operationId: get_session_core_v1_sessions__session_id__get
      security:
        - APIKeyHeader: []
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionState-Input'
              example:
                session_id: VSkqDuv
                messages:
                  - role: human
                    content: What's the weather like?
                    timestamp: 1634020000
                  - role: ai
                    content: I'll check the weather for you.
                    timestamp: 1634020001
                    additional_context:
                      - context_type: reasoning
                        items:
                          - content: The user asked about the weather
                      - context_type: planning
                        items:
                          - content: The user asked about the weather
        '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/sessions:
    get:
      tags:
        - Sessions
      summary: List the sessions
      description: |-
        Returns a paginated list of all available chat sessions.
            
            The response includes:
            - List of session summaries
            - Pagination information
            - Total count of returned sessions
            
            Each session summary contains:
            - session_id: Unique identifier for the session
            - checkpoint_id: Internal reference ID
            - short_name: Brief description based on first message
            
            Use the query parameters to navigate through pages:
            - before: Get sessions before this session ID
            - limit: Number of sessions per page (1-50)
            
            Sessions are ordered by most recent first.
            Empty sessions (no messages) are automatically filtered out.
      operationId: list_sessions_core_v1_sessions_get
      security:
        - APIKeyHeader: []
      parameters:
        - name: before
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter sessions before this session id
            title: Before
          description: Filter sessions before this session id
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Limit the number of sessions to return
            default: 45
            title: Limit
          description: Limit the number of sessions to return
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListSessionResponseModel'
              example:
                sessions:
                  - session_id: VSkqDuv
                    checkpoint_id: 1efb5872-be2a-653c-8003-f96d250d9bed
                    short_name: Weather que
                    created_at: '2025-01-05T00:22:51.455249Z'
                offset: 1efb5872-be2a-653c-8003-f96d250d9bed
                count: 1
        '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/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/tools:
    get:
      tags:
        - Tool
      summary: List all available tools
      description: |-
        Returns a list of all available tools that the agent has access to.

            Each tool entry includes:
            - Name: Unique identifier for the tool
            - Description: What the tool does and how it can be used
            - Status: Current initialization status (ready, initializing, error)
            - Schema: JSON schema defining the input parameters for the tool

            Use this endpoint to discover available tools and their required parameters
            before using the /tool/execute endpoint.

            ## Authentication
            Requires API key via `x-wabee-access` header.
      operationId: list_tools_core_v1_tools_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolListResponseModel'
              example:
                tools:
                  - name: web_search
                    description: Search the web for real-time information
                    status: ready
                    schema:
                      type: object
                      properties:
                        query:
                          type: string
                          description: The search query to use
                      required:
                        - query
                  - name: csv_search
                    description: Search within CSV files using natural language
                    status: ready
                    schema:
                      type: object
                      properties:
                        file_path:
                          type: string
                          description: Path to the CSV file
                        query:
                          type: string
                          description: Natural language query
                      required:
                        - file_path
                        - query
                count: 2
        '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/tool/execute:
    post:
      tags:
        - Tool
      summary: Execute a specific tool directly
      description: >-
        This endpoint allows direct execution of a specific tool with given
        parameters.

            The tool is executed outside the normal agent conversation flow, allowing users to:
            - Invoke tools programmatically
            - Test tool functionality independently
            - Access tool capabilities without engaging the full agent

            Each tool has different input parameters. Refer to tool documentation for specific input schemas.

            ## Authentication
            Requires API key via `x-wabee-access` header.

            ## Example Tool Inputs

            **Web Search:**
            ```json
            {
                "tool_name": "web_search",
                "tool_input": {
                    "query": "Latest market trends in AI"
                }
            }
            ```

            **CSV Search:**
            ```json
            {
                "tool_name": "csv_search",
                "tool_input": {
                    "file_path": "data/sales.csv",
                    "query": "Find total sales in Q1"
                }
            }
            ```
      operationId: execute_tool_core_v1_tool_execute_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToolExecutionRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolExecutionResponseModel'
              example:
                tool_name: web_search
                output:
                  results:
                    - AI market growing at 40% annually
                    - Generative AI dominates recent trends
                execution_time: 1.25
                status: success
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Missing required parameter for tool execution
                status_code: 400
        '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
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Tool not found
                status_code: 404
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '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/agent/config:
    get:
      tags:
        - Agent
      summary: Get agent configuration
      description: |-
        Returns the current agent configuration.
            
            This endpoint allows you to retrieve the complete agent configuration 
            that is currently loaded in memory. This includes all settings such as:
            - Agent description and metadata
            - LLM configurations
            - Tool definitions
            - Memory settings
            - Other agent-specific parameters
            
            The configuration returned is the actual configuration being used by the agent,
            including any updates that have been applied via the PUT /agent/config endpoint.
      operationId: get_agent_config_core_v1_agent_config_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfigGetResponse'
              example:
                configuration:
                  description: Example agent configuration
                  llms:
                    primary:
                      model: gpt-4-turbo
                      temperature: 0.7
                  tools: []
                  memory:
                    enabled: true
                timestamp: '2024-03-15T14:30:22.123456'
                version: '1.0'
        '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: []
    put:
      tags:
        - Agent
      summary: Update agent configuration
      description: >-
        Updates the agent configuration dynamically without restarting the
        service.
            
            This endpoint allows you to:
            - **Partially update** the agent configuration (merges with existing config)
            - Update complete configuration sections or individual fields
            - Validate configuration before applying (using validate_only=true)
            - Automatically trigger agent re-initialization with new config
            
            The provided configuration is **merged** with the existing configuration, so you only 
            need to specify the fields you want to change. The configuration is written to the 
            mounted volume and the agent is re-initialized.
            
            ## Important Notes:
            - Only specify the fields you want to update - they will be merged with existing config
            - Nested objects are deep-merged (e.g., updating llms.primary.model preserves other llm settings)
            - The JSON file on the mounted volume will be updated with the merged configuration
            - The agent will be re-initialized, which may take a few seconds
            - In-flight requests will complete with the old configuration
            - New requests will use the updated configuration
            - A backup of the previous configuration is automatically created
            
            ## Example Partial Updates:
            
            **Update just the agent description:**
            ```json
            {
                "configuration": {
                    "description": "Updated agent description"
                },
                "validate_only": false
            }
            ```
            
            **Update a specific LLM model:**
            ```json
            {
                "configuration": {
                    "llms": {
                        "primary": {
                            "model": "gpt-4-turbo"
                        }
                    }
                },
                "validate_only": false
            }
            ```
            
            **Add a new tool to the existing tools list:**
            ```json
            {
                "configuration": {
                    "tools": [
                        {
                            "name": "new_tool",
                            "config": {...}
                        }
                    ]
                },
                "validate_only": false
            }
            ```
            
            **In-memory only update (for read-only config files):**
            ```json
            {
                "configuration": {
                    "max_execution_time": 2000
                },
                "validate_only": false,
                "in_memory_only": true
            }
            ```
      operationId: update_agent_config_core_v1_agent_config_put
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfigUpdateRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfigUpdateResponse'
              example:
                success: true
                message: >-
                  Configuration updated successfully. Backup created at:
                  /volume/config/config.json.backup_20240315_143022
                timestamp: '2024-03-15T14:30:22.123456'
                previous_config_backup: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: Configuration validation failed
                status_code: 400
                details:
                  validation_errors:
                    - loc:
                        - llms
                      msg: field required
                      type: value_error.missing
        '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
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                body: 'Failed to update configuration: Permission denied'
                status_code: 500
                details:
                  error_type: PermissionError
      security:
        - APIKeyHeader: []
  /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 conversation starters.
      operationId: get_metadata_core_v1_metadata_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetadataResponseModel-Input'
              example:
                body:
                  id: agent123
                  name: Wabee Agent
                  description: An AI agent that helps with specific tasks
                  uri_id: wabee-agent
                  conversation_starters:
                    - name: market_research
                      prompt: Analyze current market trends
        '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/share_agent_artifact:
    post:
      tags:
        - Agent
      summary: Share an artifact generated by the agent
      description: |-
        Copies a file artifact generated by the agent to a shared location.
            
            This endpoint:
            1. Retrieves the session state using the provided session ID
            2. Gets the specified message by its index in the messages array
            3. Retrieves the generated_artifacts field from the message response_metadata
            4. Copies the file at the specified artifact index to /tmp/share
            
            Returns the path to the copied file or an error if the file cannot be found/copied.
      operationId: share_agent_artifact_core_v1_share_agent_artifact_post
      security:
        - APIKeyHeader: []
      parameters:
        - name: message_index
          in: query
          required: true
          schema:
            type: integer
            title: Message Index
        - name: artifact_index
          in: query
          required: true
          schema:
            type: integer
            title: Artifact Index
        - name: session-id
          in: header
          required: true
          schema:
            type: string
            description: Session unique identifier for which to share an artifact
            title: Session-Id
          description: Session unique identifier for which to share an artifact
        - name: user-name
          in: header
          required: true
          schema:
            type: string
            description: User name for the request
            title: User-Name
          description: User name for the request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
              example:
                body:
                  shared_file_path: /tmp/share/report.pdf
                  original_file_path: outputs/report.pdf
                  file_type: file
        '400':
          content:
            application/json:
              example:
                body: Message index out of range or artifact index out of range
                status_code: 400
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              example:
                body: No generated artifacts found for the specified message
                status_code: 404
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '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/download_artifact/{message_index}/{artifact_index}:
    get:
      tags:
        - Agent
      summary: Generate a downloadable link for an artifact
      description: |-
        Generates a downloadable link for a file artifact created by the agent.
            
            This endpoint:
            1. Retrieves the session state using the provided session ID (from the 'session-id' header)
            2. Gets the specified message by its index in the messages array
            3. Retrieves the generated_artifacts field from the message response_metadata
            4. Generates a presigned URL for the file at the specified artifact index
            
            Returns the presigned URL that can be used to download the file directly.
      operationId: >-
        download_artifact_core_v1_download_artifact__message_index___artifact_index__get
      security:
        - APIKeyHeader: []
      parameters:
        - name: message_index
          in: path
          required: true
          schema:
            type: integer
            title: Message Index
        - name: artifact_index
          in: path
          required: true
          schema:
            type: integer
            title: Artifact Index
        - name: session-id
          in: header
          required: true
          schema:
            type: string
            description: Session unique identifier for which to download an artifact
            title: Session-Id
          description: Session unique identifier for which to download an artifact
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
              example:
                body:
                  download_url: >-
                    https://s3.amazonaws.com/bucket-name/path/to/file.pdf?X-Amz-Algorithm=...
                  file_name: report.pdf
                  file_type: file
          headers:
            session-id:
              description: session unique identifier
              content:
                text/plain:
                  example: x1wbee
        '400':
          content:
            application/json:
              example:
                body: Message index out of range or artifact index out of range
                status_code: 400
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              example:
                body: No generated artifacts found for the specified message
                status_code: 404
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '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/sub_agents:
    get:
      tags:
        - Sub-Agents
      summary: List all sub-agents
      description: Lists all sub-agents that have been created by the parent agent.
      operationId: list_sub_agents_core_v1_chain_sub_agents_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListSubAgentsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - APIKeyHeader: []
    post:
      tags:
        - Sub-Agents
      summary: Create a new sub-agent
      description: |-
        Creates a new specialized sub-agent that can handle specific tasks.
            The sub-agent will have access to the specified tools and can be assigned tasks.
      operationId: create_sub_agent_core_v1_chain_sub_agents_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubAgentRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSubAgentResponse'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSubAgentResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - APIKeyHeader: []
  /core/v1/chain/sub_agents/{sub_agent_id}:
    get:
      tags:
        - Sub-Agents
      summary: Get a sub-agent's status
      description: >-
        Retrieves information about a specific sub-agent, including its status
        and basic information.
      operationId: get_sub_agent_core_v1_chain_sub_agents__sub_agent_id__get
      security:
        - APIKeyHeader: []
      parameters:
        - name: sub_agent_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the sub-agent to retrieve
            title: Sub Agent Id
          description: ID of the sub-agent to retrieve
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubAgentInfoResponse'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
    delete:
      tags:
        - Sub-Agents
      summary: Terminate a sub-agent
      description: Terminates a specific sub-agent and cleans up its resources.
      operationId: terminate_sub_agent_core_v1_chain_sub_agents__sub_agent_id__delete
      security:
        - APIKeyHeader: []
      parameters:
        - name: sub_agent_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the sub-agent to terminate
            title: Sub Agent Id
          description: ID of the sub-agent to terminate
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
              example:
                success: true
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
  /health:
    get:
      tags:
        - Observability
      summary: Health check endpoint
      description: Returns the health status of the API
      operationId: health_health_get
      responses:
        '200':
          description: API is healthy
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Health Health Get
        '503':
          description: API is unhealthy
components:
  schemas:
    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:
          $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-Input:
      properties:
        body:
          $ref: '#/components/schemas/ChainResponseModelBody'
          description: The complete agent response
      type: object
      required:
        - body
      title: ChainResponseModel
      description: Top-level response model for chain requests
    ChainResponseModel-Output:
      properties:
        body:
          $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
    ConfigGetResponse:
      properties:
        configuration:
          additionalProperties: true
          type: object
          title: Configuration
          description: Current agent configuration
          examples:
            - key: value
        timestamp:
          type: string
          title: Timestamp
          description: Configuration retrieval timestamp
          examples:
            - '2023-10-01T12:00:00Z'
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: Version
          description: Configuration version (if applicable)
          examples:
            - '1.0'
      type: object
      required:
        - configuration
      title: ConfigGetResponse
      description: Response model for getting current configuration.
    ConfigUpdateRequest:
      properties:
        configuration:
          additionalProperties: true
          type: object
          title: Configuration
          description: The new agent configuration to apply
          examples:
            - key1: value1
              key2: value2
            - settingA: 10
              settingB: true
        validate_only:
          type: boolean
          title: Validate Only
          description: If true, only validate the configuration without applying it
          default: false
          examples:
            - true
            - false
        in_memory_only:
          type: boolean
          title: In Memory Only
          description: >-
            If true, only update configuration in memory without persisting to
            file (useful for read-only config files)
          default: false
          examples:
            - true
            - false
      type: object
      required:
        - configuration
      title: ConfigUpdateRequest
      description: Request model for configuration updates.
    ConfigUpdateResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Whether the update was successful
          examples:
            - true
            - false
        message:
          type: string
          title: Message
          description: Status message
          examples:
            - Configuration updated successfully
            - Validation failed
        timestamp:
          type: string
          title: Timestamp
          description: Update timestamp
          examples:
            - '2023-10-01T12:00:00Z'
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: Version
          description: Configuration version (if applicable)
          examples:
            - '1.0'
        validation_errors:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Validation Errors
          description: Validation errors if any
          examples:
            - key: error message
        previous_config_backup:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Previous Config Backup
          description: Whether previous config was backed up
          examples:
            - true
            - false
      type: object
      required:
        - success
        - message
      title: ConfigUpdateResponse
      description: Response model for configuration updates.
    ConversationStarter:
      properties:
        name:
          type: string
          title: Name
          description: Unique name/identifier for the conversation starter
          example: market_research
        prompt:
          type: string
          title: Prompt
          description: The prompt text for this conversation starter
          example: Analyze current market trends
      type: object
      required:
        - name
        - prompt
      title: ConversationStarter
    CreateSubAgentRequest:
      properties:
        name:
          type: string
          title: Name
          description: A descriptive name for the sub-agent
          example: Market Research Agent
        description:
          type: string
          title: Description
          description: A detailed description of the sub-agent's purpose and capabilities
          example: >-
            Specialized agent for conducting market research and competitive
            analysis
        objective:
          type: string
          title: Objective
          description: The primary goal or objective for the sub-agent
          example: >-
            Gather and analyze market information to provide competitive
            insights
        tools:
          items:
            type: string
          type: array
          title: Tools
          description: List of tool names to include for the sub-agent
          example:
            - web_search
            - csv_analysis
        workflow_type:
          type: string
          enum:
            - react
            - hierarchical
          title: Workflow Type
          description: The workflow type for the sub-agent
          default: react
          example: react
      type: object
      required:
        - name
        - description
        - objective
      title: CreateSubAgentRequest
      description: Request model for creating a new sub-agent.
    CreateSubAgentResponse:
      properties:
        sub_agent_id:
          type: string
          title: Sub Agent Id
          description: Unique identifier for the new sub-agent
          example: sa-1234abcd
        sub_agent_info:
          $ref: '#/components/schemas/SubAgentInfoResponse'
          description: Information about the created sub-agent
      type: object
      required:
        - sub_agent_id
        - sub_agent_info
      title: CreateSubAgentResponse
      description: Response model for sub-agent creation.
    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:
          anyOf:
            - type: string
              enum:
                - equals
                - gt
                - lt
                - gte
                - lte
                - like
            - type: 'null'
          title: Filter Type
          description: The type of filter to be applied.
          default: equals
          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_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:
            - additionalProperties: true
              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
    FeedbackRequest:
      properties:
        run_id:
          type: string
          title: Run Id
          description: The run ID to provide feedback for
          examples:
            - run_abc123456789
        feedback_id:
          type: string
          title: Feedback Id
          description: Identifier for the feedback
          examples:
            - feedback_xyz987654321
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
          description: Numerical score for the run
          examples:
            - 0.95
        comment:
          anyOf:
            - type: string
            - type: 'null'
          title: Comment
          description: Additional feedback comments
          examples:
            - This response was very helpful.
      type: object
      required:
        - run_id
        - feedback_id
      title: FeedbackRequest
      description: Schema for feedback requests.
    FeedbackResponse:
      properties:
        feedback_id:
          type: string
          title: Feedback Id
          description: Identifier for the feedback that was processed
          examples:
            - feedback_xyz987654321
      type: object
      required:
        - feedback_id
      title: FeedbackResponse
      description: Schema for feedback responses.
    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:
            - additionalProperties: true
              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
    Info:
      properties:
        content:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
          title: Content
          description: The content of the reasoning or planning step.
          examples:
            - The user asked for the weather.
      type: object
      required:
        - content
      title: Info
      description: An item of reasoning or planning context.
    ListSessionResponseModel:
      properties:
        sessions:
          items:
            $ref: '#/components/schemas/SessionItem'
          type: array
          title: Sessions
          description: List of available sessions
      type: object
      required:
        - sessions
      title: ListSessionResponseModel
      description: Response model for listing sessions
    ListSubAgentsResponse:
      properties:
        sub_agents:
          items:
            $ref: '#/components/schemas/SubAgentInfoResponse'
          type: array
          title: Sub Agents
          description: List of sub-agents
      type: object
      required:
        - sub_agents
      title: ListSubAgentsResponse
      description: Response model for listing sub-agents.
    MessageAdditionalContext:
      properties:
        context_type:
          type: string
          enum:
            - reasoning
            - planning
            - generated_artifacts
          title: Context Type
          description: The type of context.
          examples:
            - reasoning
            - planning
        items:
          items:
            $ref: '#/components/schemas/Info'
          type: array
          title: Items
          description: The items of context.
      type: object
      required:
        - context_type
        - items
      title: MessageAdditionalContext
      description: Additional context for a message.
    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
        auto_memory_retain:
          type: boolean
          title: Auto Memory Retain
          description: >-
            Indicates whether the agent should automatically retain information
            from the session in memory. When enabled, allows the agent to learn
            from experiences and feedback.
          default: false
          examples:
            - false
        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 callback 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
        auto_memory_retain:
          type: boolean
          title: Auto Memory Retain
          description: >-
            Indicates whether the agent should automatically retain information
            from the session in memory. When enabled, allows the agent to learn
            from experiences and feedback.
          default: false
          examples:
            - false
        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
    MetadataResponseModel-Input:
      properties:
        body:
          $ref: '#/components/schemas/MetadataResponseModelBody'
          description: The agent metadata
      type: object
      required:
        - body
      title: MetadataResponseModel
      description: Top-level response model for metadata requests
    MetadataResponseModel-Output:
      properties:
        body:
          $ref: '#/components/schemas/MetadataResponseModelBody'
          description: The agent metadata
      type: object
      required:
        - body
      title: MetadataResponseModel
      description: Top-level response model for metadata requests
    MetadataResponseModelBody:
      properties:
        id:
          type: string
          title: Id
          description: Agent unique identifier
          example: agent-123-xyz
        name:
          type: string
          title: Name
          description: Agent name
          example: Sales Assistant
        description:
          type: string
          title: Description
          description: Agent description
          example: An AI assistant to help with sales tasks.
        uri_id:
          type: string
          title: Uri Id
          description: Agent URI identifier
          example: sales-assistant
        conversation_starters:
          items:
            $ref: '#/components/schemas/ConversationStarter'
          type: array
          title: Conversation Starters
          description: List of conversation starter prompts
      type: object
      required:
        - id
        - name
        - description
        - uri_id
      title: MetadataResponseModelBody
      description: Response model for agent metadata.
    MetricsResponseModel:
      properties:
        body:
          additionalProperties: true
          type: object
          title: Body
          description: The metrics response body
      type: object
      required:
        - body
      title: MetricsResponseModel
      description: Response model for agent metrics.
    SessionItem:
      properties:
        session_id:
          type: string
          title: Session Id
          description: The ID of the session.
          examples:
            - VSkqDuv
        checkpoint_id:
          type: string
          title: Checkpoint Id
          description: The ID of the checkpoint.
          examples:
            - 1efb5872-be2a-653c-8003-f96d250d9bed
        short_name:
          type: string
          title: Short Name
          description: The short name of the session.
          examples:
            - A test
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The creation timestamp of the session in UTC.
          examples:
            - '2022-01-01T00:00:00Z'
      type: object
      required:
        - session_id
        - checkpoint_id
        - short_name
        - created_at
      title: SessionItem
      description: An item in the session list.
    SessionMessage-Input:
      properties:
        role:
          type: string
          enum:
            - human
            - ai
          title: Role
          description: The role of the message sender. Can be either 'user' or 'assistant'.
          examples:
            - ai
        content:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
          title: Content
          description: The content of the message.
          examples:
            - Hello!
        timestamp:
          type: number
          title: Timestamp
          description: The timestamp of the message in seconds since the Unix epoch.
          examples:
            - 1634020000
        additional_context:
          anyOf:
            - items:
                $ref: '#/components/schemas/MessageAdditionalContext'
              type: array
            - type: 'null'
          title: Additional Context
          description: Additional context for the message.
      type: object
      required:
        - role
        - content
        - timestamp
      title: SessionMessage
      description: A message exchanged between the user and the AI assistant.
    SessionMessage-Output:
      properties:
        role:
          type: string
          enum:
            - human
            - ai
          title: Role
          description: The role of the message sender. Can be either 'user' or 'assistant'.
          examples:
            - ai
        content:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
          title: Content
          description: The content of the message.
          examples:
            - Hello!
        timestamp:
          type: number
          title: Timestamp
          description: The timestamp of the message in seconds since the Unix epoch.
          examples:
            - 1634020000
        additional_context:
          anyOf:
            - items:
                $ref: '#/components/schemas/MessageAdditionalContext'
              type: array
            - type: 'null'
          title: Additional Context
          description: Additional context for the message.
      type: object
      required:
        - role
        - content
        - timestamp
      title: SessionMessage
      description: A message exchanged between the user and the AI assistant.
    SessionState-Input:
      properties:
        session_id:
          type: string
          title: Session Id
          description: The ID of the session.
          examples:
            - VSkqDuv
        messages:
          items:
            $ref: '#/components/schemas/SessionMessage-Input'
          type: array
          title: Messages
          description: The messages exchanged during the session.
      type: object
      required:
        - session_id
        - messages
      title: SessionState
      description: The current state of a session.
    SessionState-Output:
      properties:
        session_id:
          type: string
          title: Session Id
          description: The ID of the session.
          examples:
            - VSkqDuv
        messages:
          items:
            $ref: '#/components/schemas/SessionMessage-Output'
          type: array
          title: Messages
          description: The messages exchanged during the session.
      type: object
      required:
        - session_id
        - messages
      title: SessionState
      description: The current state of a session.
    StreamEventsRequest:
      properties:
        input:
          title: Input
          description: The input to the runnable
        config:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Config
          description: Configuration for the runnable
        include_names:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Include Names
          description: If specified, filter to runnables with matching names
        include_types:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Include Types
          description: If specified, filter to runnables with matching types
        include_tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Include Tags
          description: If specified, filter to runnables with matching tags
        exclude_names:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Exclude Names
          description: If specified, exclude runnables with matching names
        exclude_types:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Exclude Types
          description: If specified, exclude runnables with matching types
        exclude_tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Exclude Tags
          description: If specified, exclude runnables with matching tags
        kwargs:
          additionalProperties: true
          type: object
          title: Kwargs
          description: Additional keyword arguments to pass to the runnable
      type: object
      required:
        - input
      title: StreamEventsRequest
      description: Request schema for stream_events endpoint.
    SubAgentInfoResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the sub-agent
          example: sa-1234abcd
        name:
          type: string
          title: Name
          description: Name of the sub-agent
          example: Market Research Agent
        description:
          type: string
          title: Description
          description: Description of the sub-agent's purpose
          example: >-
            Specialized agent for conducting market research and competitive
            analysis
        status:
          type: string
          title: Status
          description: Current status of the sub-agent
          example: ready
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Creation timestamp
          example: '2025-04-10T14:30:00Z'
        last_active:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Active
          description: Last activity timestamp
          example: '2025-04-10T15:45:00Z'
      type: object
      required:
        - id
        - name
        - description
        - status
        - created_at
      title: SubAgentInfoResponse
      description: Response model for sub-agent information.
    ToolExecutionRequest:
      properties:
        tool_name:
          type: string
          title: Tool Name
          description: The name of the tool to execute
          example: web_search
        tool_input:
          additionalProperties: true
          type: object
          title: Tool Input
          description: The input parameters for the tool execution
          example:
            query: Latest market trends in AI
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
          description: >-
            An optional session ID to associate with the tool execution. This
            can be used to track multiple interactions with tools across
            different requests.
      type: object
      required:
        - tool_name
        - tool_input
      title: ToolExecutionRequest
      description: Request model for executing a specific tool.
    ToolExecutionResponseModel:
      properties:
        tool_name:
          type: string
          title: Tool Name
          description: The name of the tool that was executed
          example: web_search
        output:
          title: Output
          description: The output from the tool execution
          example:
            results:
              - Result 1
              - Result 2
        execution_time:
          type: number
          title: Execution Time
          description: Time taken to execute the tool in seconds
          example: 1.25
        status:
          type: string
          title: Status
          description: Status of the tool execution
          example: success
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if the tool execution failed
          example: API rate limit exceeded
      type: object
      required:
        - tool_name
        - output
        - execution_time
        - status
      title: ToolExecutionResponseModel
      description: Response model for tool execution
    ToolInfoModel:
      properties:
        name:
          type: string
          title: Name
          description: The name of the tool
          example: web_search
        description:
          type: string
          title: Description
          description: Description of what the tool does
          example: Search the web for real-time information
        status:
          type: string
          title: Status
          description: Current initialization status of the tool
          example: ready
        schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Schema
          description: Schema definition for the tool's input parameters
      type: object
      required:
        - name
        - description
        - status
      title: ToolInfoModel
      description: Information about a tool
    ToolListResponseModel:
      properties:
        tools:
          items:
            $ref: '#/components/schemas/ToolInfoModel'
          type: array
          title: Tools
          description: List of available tools
        count:
          type: integer
          title: Count
          description: Total number of tools
          example: 5
      type: object
      required:
        - tools
        - count
      title: ToolListResponseModel
      description: Response model for listing available tools
  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
  - name: Sessions
    description: Endpoints for managing agent sessions
  - name: Sub-Agents
    description: Endpoints for managing sub-agents
  - name: Tool
    description: Endpoints for managing tools
