# coding: utf-8

"""
    Agent Service

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: v1
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from datetime import datetime
from pydantic import Field, StrictInt, StrictStr, field_validator
from typing import List, Optional
from typing_extensions import Annotated
from asteroid_odyssey.models.agents_execution_activity import AgentsExecutionActivity
from asteroid_odyssey.models.agents_execution_list_item import AgentsExecutionListItem
from asteroid_odyssey.models.agents_execution_sort_field import AgentsExecutionSortField
from asteroid_odyssey.models.agents_execution_status import AgentsExecutionStatus
from asteroid_odyssey.models.agents_execution_update_execution_status_request import AgentsExecutionUpdateExecutionStatusRequest
from asteroid_odyssey.models.agents_execution_user_messages_add_text_body import AgentsExecutionUserMessagesAddTextBody
from asteroid_odyssey.models.common_sort_direction import CommonSortDirection
from asteroid_odyssey.models.executions_list200_response import ExecutionsList200Response

from asteroid_odyssey.api_client import ApiClient, RequestSerialized
from asteroid_odyssey.api_response import ApiResponse
from asteroid_odyssey.rest import RESTResponseType


class ExecutionApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    def execution_activities_get(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        order: Annotated[Optional[StrictStr], Field(description="Sort order for activities by timestamp")] = None,
        limit: Annotated[Optional[StrictInt], Field(description="Maximum number of activities to return")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> List[AgentsExecutionActivity]:
        """Retrieve execution activities

        Get activities for an execution

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param order: Sort order for activities by timestamp
        :type order: str
        :param limit: Maximum number of activities to return
        :type limit: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_activities_get_serialize(
            execution_id=execution_id,
            order=order,
            limit=limit,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[AgentsExecutionActivity]",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def execution_activities_get_with_http_info(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        order: Annotated[Optional[StrictStr], Field(description="Sort order for activities by timestamp")] = None,
        limit: Annotated[Optional[StrictInt], Field(description="Maximum number of activities to return")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[List[AgentsExecutionActivity]]:
        """Retrieve execution activities

        Get activities for an execution

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param order: Sort order for activities by timestamp
        :type order: str
        :param limit: Maximum number of activities to return
        :type limit: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_activities_get_serialize(
            execution_id=execution_id,
            order=order,
            limit=limit,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[AgentsExecutionActivity]",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def execution_activities_get_without_preload_content(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        order: Annotated[Optional[StrictStr], Field(description="Sort order for activities by timestamp")] = None,
        limit: Annotated[Optional[StrictInt], Field(description="Maximum number of activities to return")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Retrieve execution activities

        Get activities for an execution

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param order: Sort order for activities by timestamp
        :type order: str
        :param limit: Maximum number of activities to return
        :type limit: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_activities_get_serialize(
            execution_id=execution_id,
            order=order,
            limit=limit,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[AgentsExecutionActivity]",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _execution_activities_get_serialize(
        self,
        execution_id,
        order,
        limit,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if execution_id is not None:
            _path_params['executionId'] = execution_id
        # process the query parameters
        if order is not None:
            
            _query_params.append(('order', order))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'ApiKeyAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/executions/{executionId}/activities',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def execution_get(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> AgentsExecutionListItem:
        """Get execution

        Get a single execution by ID with all details

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_get_serialize(
            execution_id=execution_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "AgentsExecutionListItem",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def execution_get_with_http_info(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[AgentsExecutionListItem]:
        """Get execution

        Get a single execution by ID with all details

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_get_serialize(
            execution_id=execution_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "AgentsExecutionListItem",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def execution_get_without_preload_content(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get execution

        Get a single execution by ID with all details

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_get_serialize(
            execution_id=execution_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "AgentsExecutionListItem",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _execution_get_serialize(
        self,
        execution_id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if execution_id is not None:
            _path_params['executionId'] = execution_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'ApiKeyAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/executions/{executionId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def execution_recording_redirect(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        token: Annotated[Optional[StrictStr], Field(description="Optional token for authentication. Use this when the client cannot set Authorization headers (e.g., native video elements).")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> None:
        """Get recording redirect

        Redirect to the recording playback URL. Returns a 307 with a short-lived signed URL. Embed this endpoint in <video> tags — the player will follow the redirect and re-fetch on expiry.

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param token: Optional token for authentication. Use this when the client cannot set Authorization headers (e.g., native video elements).
        :type token: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_recording_redirect_serialize(
            execution_id=execution_id,
            token=token,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '307': None,
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def execution_recording_redirect_with_http_info(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        token: Annotated[Optional[StrictStr], Field(description="Optional token for authentication. Use this when the client cannot set Authorization headers (e.g., native video elements).")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[None]:
        """Get recording redirect

        Redirect to the recording playback URL. Returns a 307 with a short-lived signed URL. Embed this endpoint in <video> tags — the player will follow the redirect and re-fetch on expiry.

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param token: Optional token for authentication. Use this when the client cannot set Authorization headers (e.g., native video elements).
        :type token: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_recording_redirect_serialize(
            execution_id=execution_id,
            token=token,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '307': None,
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def execution_recording_redirect_without_preload_content(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        token: Annotated[Optional[StrictStr], Field(description="Optional token for authentication. Use this when the client cannot set Authorization headers (e.g., native video elements).")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get recording redirect

        Redirect to the recording playback URL. Returns a 307 with a short-lived signed URL. Embed this endpoint in <video> tags — the player will follow the redirect and re-fetch on expiry.

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param token: Optional token for authentication. Use this when the client cannot set Authorization headers (e.g., native video elements).
        :type token: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_recording_redirect_serialize(
            execution_id=execution_id,
            token=token,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '307': None,
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _execution_recording_redirect_serialize(
        self,
        execution_id,
        token,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if execution_id is not None:
            _path_params['executionId'] = execution_id
        # process the query parameters
        if token is not None:
            
            _query_params.append(('token', token))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'ApiKeyAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/executions/{executionId}/recording',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def execution_status_update(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        agents_execution_update_execution_status_request: Annotated[AgentsExecutionUpdateExecutionStatusRequest, Field(description="The status update request")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> str:
        """Update execution status

        Update the status of an execution. Use this to pause, resume, or cancel an execution.

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param agents_execution_update_execution_status_request: The status update request (required)
        :type agents_execution_update_execution_status_request: AgentsExecutionUpdateExecutionStatusRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_status_update_serialize(
            execution_id=execution_id,
            agents_execution_update_execution_status_request=agents_execution_update_execution_status_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "str",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def execution_status_update_with_http_info(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        agents_execution_update_execution_status_request: Annotated[AgentsExecutionUpdateExecutionStatusRequest, Field(description="The status update request")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[str]:
        """Update execution status

        Update the status of an execution. Use this to pause, resume, or cancel an execution.

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param agents_execution_update_execution_status_request: The status update request (required)
        :type agents_execution_update_execution_status_request: AgentsExecutionUpdateExecutionStatusRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_status_update_serialize(
            execution_id=execution_id,
            agents_execution_update_execution_status_request=agents_execution_update_execution_status_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "str",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def execution_status_update_without_preload_content(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        agents_execution_update_execution_status_request: Annotated[AgentsExecutionUpdateExecutionStatusRequest, Field(description="The status update request")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Update execution status

        Update the status of an execution. Use this to pause, resume, or cancel an execution.

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param agents_execution_update_execution_status_request: The status update request (required)
        :type agents_execution_update_execution_status_request: AgentsExecutionUpdateExecutionStatusRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_status_update_serialize(
            execution_id=execution_id,
            agents_execution_update_execution_status_request=agents_execution_update_execution_status_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "str",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _execution_status_update_serialize(
        self,
        execution_id,
        agents_execution_update_execution_status_request,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if execution_id is not None:
            _path_params['executionId'] = execution_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if agents_execution_update_execution_status_request is not None:
            _body_params = agents_execution_update_execution_status_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'text/plain', 
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'ApiKeyAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/executions/{executionId}/status',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def execution_user_messages_add(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        agents_execution_user_messages_add_text_body: Annotated[AgentsExecutionUserMessagesAddTextBody, Field(description="The message content to send")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> str:
        """Send user message to execution

        Add a user message to an execution

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param agents_execution_user_messages_add_text_body: The message content to send (required)
        :type agents_execution_user_messages_add_text_body: AgentsExecutionUserMessagesAddTextBody
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_user_messages_add_serialize(
            execution_id=execution_id,
            agents_execution_user_messages_add_text_body=agents_execution_user_messages_add_text_body,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "str",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def execution_user_messages_add_with_http_info(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        agents_execution_user_messages_add_text_body: Annotated[AgentsExecutionUserMessagesAddTextBody, Field(description="The message content to send")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[str]:
        """Send user message to execution

        Add a user message to an execution

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param agents_execution_user_messages_add_text_body: The message content to send (required)
        :type agents_execution_user_messages_add_text_body: AgentsExecutionUserMessagesAddTextBody
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_user_messages_add_serialize(
            execution_id=execution_id,
            agents_execution_user_messages_add_text_body=agents_execution_user_messages_add_text_body,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "str",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def execution_user_messages_add_without_preload_content(
        self,
        execution_id: Annotated[StrictStr, Field(description="The unique identifier of the execution")],
        agents_execution_user_messages_add_text_body: Annotated[AgentsExecutionUserMessagesAddTextBody, Field(description="The message content to send")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Send user message to execution

        Add a user message to an execution

        :param execution_id: The unique identifier of the execution (required)
        :type execution_id: str
        :param agents_execution_user_messages_add_text_body: The message content to send (required)
        :type agents_execution_user_messages_add_text_body: AgentsExecutionUserMessagesAddTextBody
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._execution_user_messages_add_serialize(
            execution_id=execution_id,
            agents_execution_user_messages_add_text_body=agents_execution_user_messages_add_text_body,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "str",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _execution_user_messages_add_serialize(
        self,
        execution_id,
        agents_execution_user_messages_add_text_body,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if execution_id is not None:
            _path_params['executionId'] = execution_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if agents_execution_user_messages_add_text_body is not None:
            _body_params = agents_execution_user_messages_add_text_body


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'text/plain', 
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'ApiKeyAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/executions/{executionId}/user-messages',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def executions_list(
        self,
        organization_id: Annotated[Optional[StrictStr], Field(description="Optional organization ID filter (required for customer queries)")] = None,
        page_size: Optional[StrictInt] = None,
        page: Optional[StrictInt] = None,
        execution_id: Annotated[Optional[StrictStr], Field(description="Search by execution ID (partial, case-insensitive match)")] = None,
        agent_id: Annotated[Optional[StrictStr], Field(description="Filter by agent ID")] = None,
        status: Annotated[Optional[List[AgentsExecutionStatus]], Field(description="Filter by execution status (can specify multiple, there is an 'OR' condition applied to these)")] = None,
        created_after: Annotated[Optional[datetime], Field(description="Filter executions created after this timestamp")] = None,
        created_before: Annotated[Optional[datetime], Field(description="Filter executions created before this timestamp")] = None,
        human_labels: Annotated[Optional[List[StrictStr]], Field(description="Filter by human labels (can specify multiple label IDs, there is an 'OR' condition applied to these)")] = None,
        outcome_label: Annotated[Optional[StrictStr], Field(description="Filter by execution result outcome (partial, case-insensitive match)")] = None,
        metadata_key: Annotated[Optional[StrictStr], Field(description="Filter by metadata key - must be used together with metadataValue")] = None,
        metadata_value: Annotated[Optional[StrictStr], Field(description="Filter by metadata value - must be used together with metadataKey")] = None,
        workflow_version: Annotated[Optional[StrictInt], Field(description="Filter by workflow version number")] = None,
        sort_field: Optional[AgentsExecutionSortField] = None,
        sort_direction: Optional[CommonSortDirection] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ExecutionsList200Response:
        """List executions

        List executions with filtering and pagination

        :param organization_id: Optional organization ID filter (required for customer queries)
        :type organization_id: str
        :param page_size:
        :type page_size: int
        :param page:
        :type page: int
        :param execution_id: Search by execution ID (partial, case-insensitive match)
        :type execution_id: str
        :param agent_id: Filter by agent ID
        :type agent_id: str
        :param status: Filter by execution status (can specify multiple, there is an 'OR' condition applied to these)
        :type status: List[AgentsExecutionStatus]
        :param created_after: Filter executions created after this timestamp
        :type created_after: datetime
        :param created_before: Filter executions created before this timestamp
        :type created_before: datetime
        :param human_labels: Filter by human labels (can specify multiple label IDs, there is an 'OR' condition applied to these)
        :type human_labels: List[str]
        :param outcome_label: Filter by execution result outcome (partial, case-insensitive match)
        :type outcome_label: str
        :param metadata_key: Filter by metadata key - must be used together with metadataValue
        :type metadata_key: str
        :param metadata_value: Filter by metadata value - must be used together with metadataKey
        :type metadata_value: str
        :param workflow_version: Filter by workflow version number
        :type workflow_version: int
        :param sort_field:
        :type sort_field: AgentsExecutionSortField
        :param sort_direction:
        :type sort_direction: CommonSortDirection
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._executions_list_serialize(
            organization_id=organization_id,
            page_size=page_size,
            page=page,
            execution_id=execution_id,
            agent_id=agent_id,
            status=status,
            created_after=created_after,
            created_before=created_before,
            human_labels=human_labels,
            outcome_label=outcome_label,
            metadata_key=metadata_key,
            metadata_value=metadata_value,
            workflow_version=workflow_version,
            sort_field=sort_field,
            sort_direction=sort_direction,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ExecutionsList200Response",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def executions_list_with_http_info(
        self,
        organization_id: Annotated[Optional[StrictStr], Field(description="Optional organization ID filter (required for customer queries)")] = None,
        page_size: Optional[StrictInt] = None,
        page: Optional[StrictInt] = None,
        execution_id: Annotated[Optional[StrictStr], Field(description="Search by execution ID (partial, case-insensitive match)")] = None,
        agent_id: Annotated[Optional[StrictStr], Field(description="Filter by agent ID")] = None,
        status: Annotated[Optional[List[AgentsExecutionStatus]], Field(description="Filter by execution status (can specify multiple, there is an 'OR' condition applied to these)")] = None,
        created_after: Annotated[Optional[datetime], Field(description="Filter executions created after this timestamp")] = None,
        created_before: Annotated[Optional[datetime], Field(description="Filter executions created before this timestamp")] = None,
        human_labels: Annotated[Optional[List[StrictStr]], Field(description="Filter by human labels (can specify multiple label IDs, there is an 'OR' condition applied to these)")] = None,
        outcome_label: Annotated[Optional[StrictStr], Field(description="Filter by execution result outcome (partial, case-insensitive match)")] = None,
        metadata_key: Annotated[Optional[StrictStr], Field(description="Filter by metadata key - must be used together with metadataValue")] = None,
        metadata_value: Annotated[Optional[StrictStr], Field(description="Filter by metadata value - must be used together with metadataKey")] = None,
        workflow_version: Annotated[Optional[StrictInt], Field(description="Filter by workflow version number")] = None,
        sort_field: Optional[AgentsExecutionSortField] = None,
        sort_direction: Optional[CommonSortDirection] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[ExecutionsList200Response]:
        """List executions

        List executions with filtering and pagination

        :param organization_id: Optional organization ID filter (required for customer queries)
        :type organization_id: str
        :param page_size:
        :type page_size: int
        :param page:
        :type page: int
        :param execution_id: Search by execution ID (partial, case-insensitive match)
        :type execution_id: str
        :param agent_id: Filter by agent ID
        :type agent_id: str
        :param status: Filter by execution status (can specify multiple, there is an 'OR' condition applied to these)
        :type status: List[AgentsExecutionStatus]
        :param created_after: Filter executions created after this timestamp
        :type created_after: datetime
        :param created_before: Filter executions created before this timestamp
        :type created_before: datetime
        :param human_labels: Filter by human labels (can specify multiple label IDs, there is an 'OR' condition applied to these)
        :type human_labels: List[str]
        :param outcome_label: Filter by execution result outcome (partial, case-insensitive match)
        :type outcome_label: str
        :param metadata_key: Filter by metadata key - must be used together with metadataValue
        :type metadata_key: str
        :param metadata_value: Filter by metadata value - must be used together with metadataKey
        :type metadata_value: str
        :param workflow_version: Filter by workflow version number
        :type workflow_version: int
        :param sort_field:
        :type sort_field: AgentsExecutionSortField
        :param sort_direction:
        :type sort_direction: CommonSortDirection
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._executions_list_serialize(
            organization_id=organization_id,
            page_size=page_size,
            page=page,
            execution_id=execution_id,
            agent_id=agent_id,
            status=status,
            created_after=created_after,
            created_before=created_before,
            human_labels=human_labels,
            outcome_label=outcome_label,
            metadata_key=metadata_key,
            metadata_value=metadata_value,
            workflow_version=workflow_version,
            sort_field=sort_field,
            sort_direction=sort_direction,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ExecutionsList200Response",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def executions_list_without_preload_content(
        self,
        organization_id: Annotated[Optional[StrictStr], Field(description="Optional organization ID filter (required for customer queries)")] = None,
        page_size: Optional[StrictInt] = None,
        page: Optional[StrictInt] = None,
        execution_id: Annotated[Optional[StrictStr], Field(description="Search by execution ID (partial, case-insensitive match)")] = None,
        agent_id: Annotated[Optional[StrictStr], Field(description="Filter by agent ID")] = None,
        status: Annotated[Optional[List[AgentsExecutionStatus]], Field(description="Filter by execution status (can specify multiple, there is an 'OR' condition applied to these)")] = None,
        created_after: Annotated[Optional[datetime], Field(description="Filter executions created after this timestamp")] = None,
        created_before: Annotated[Optional[datetime], Field(description="Filter executions created before this timestamp")] = None,
        human_labels: Annotated[Optional[List[StrictStr]], Field(description="Filter by human labels (can specify multiple label IDs, there is an 'OR' condition applied to these)")] = None,
        outcome_label: Annotated[Optional[StrictStr], Field(description="Filter by execution result outcome (partial, case-insensitive match)")] = None,
        metadata_key: Annotated[Optional[StrictStr], Field(description="Filter by metadata key - must be used together with metadataValue")] = None,
        metadata_value: Annotated[Optional[StrictStr], Field(description="Filter by metadata value - must be used together with metadataKey")] = None,
        workflow_version: Annotated[Optional[StrictInt], Field(description="Filter by workflow version number")] = None,
        sort_field: Optional[AgentsExecutionSortField] = None,
        sort_direction: Optional[CommonSortDirection] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """List executions

        List executions with filtering and pagination

        :param organization_id: Optional organization ID filter (required for customer queries)
        :type organization_id: str
        :param page_size:
        :type page_size: int
        :param page:
        :type page: int
        :param execution_id: Search by execution ID (partial, case-insensitive match)
        :type execution_id: str
        :param agent_id: Filter by agent ID
        :type agent_id: str
        :param status: Filter by execution status (can specify multiple, there is an 'OR' condition applied to these)
        :type status: List[AgentsExecutionStatus]
        :param created_after: Filter executions created after this timestamp
        :type created_after: datetime
        :param created_before: Filter executions created before this timestamp
        :type created_before: datetime
        :param human_labels: Filter by human labels (can specify multiple label IDs, there is an 'OR' condition applied to these)
        :type human_labels: List[str]
        :param outcome_label: Filter by execution result outcome (partial, case-insensitive match)
        :type outcome_label: str
        :param metadata_key: Filter by metadata key - must be used together with metadataValue
        :type metadata_key: str
        :param metadata_value: Filter by metadata value - must be used together with metadataKey
        :type metadata_value: str
        :param workflow_version: Filter by workflow version number
        :type workflow_version: int
        :param sort_field:
        :type sort_field: AgentsExecutionSortField
        :param sort_direction:
        :type sort_direction: CommonSortDirection
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._executions_list_serialize(
            organization_id=organization_id,
            page_size=page_size,
            page=page,
            execution_id=execution_id,
            agent_id=agent_id,
            status=status,
            created_after=created_after,
            created_before=created_before,
            human_labels=human_labels,
            outcome_label=outcome_label,
            metadata_key=metadata_key,
            metadata_value=metadata_value,
            workflow_version=workflow_version,
            sort_field=sort_field,
            sort_direction=sort_direction,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ExecutionsList200Response",
            '400': "CommonBadRequestErrorBody",
            '401': "CommonUnauthorizedErrorBody",
            '403': "CommonForbiddenErrorBody",
            '404': "CommonNotFoundErrorBody",
            '500': "CommonInternalServerErrorBody",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _executions_list_serialize(
        self,
        organization_id,
        page_size,
        page,
        execution_id,
        agent_id,
        status,
        created_after,
        created_before,
        human_labels,
        outcome_label,
        metadata_key,
        metadata_value,
        workflow_version,
        sort_field,
        sort_direction,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'status': 'multi',
            'humanLabels': 'multi',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if organization_id is not None:
            
            _query_params.append(('organizationId', organization_id))
            
        if page_size is not None:
            
            _query_params.append(('pageSize', page_size))
            
        if page is not None:
            
            _query_params.append(('page', page))
            
        if execution_id is not None:
            
            _query_params.append(('executionId', execution_id))
            
        if agent_id is not None:
            
            _query_params.append(('agentId', agent_id))
            
        if status is not None:
            
            _query_params.append(('status', status))
            
        if created_after is not None:
            if isinstance(created_after, datetime):
                _query_params.append(
                    (
                        'createdAfter',
                        created_after.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('createdAfter', created_after))
            
        if created_before is not None:
            if isinstance(created_before, datetime):
                _query_params.append(
                    (
                        'createdBefore',
                        created_before.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('createdBefore', created_before))
            
        if human_labels is not None:
            
            _query_params.append(('humanLabels', human_labels))
            
        if outcome_label is not None:
            
            _query_params.append(('outcomeLabel', outcome_label))
            
        if metadata_key is not None:
            
            _query_params.append(('metadataKey', metadata_key))
            
        if metadata_value is not None:
            
            _query_params.append(('metadataValue', metadata_value))
            
        if workflow_version is not None:
            
            _query_params.append(('workflowVersion', workflow_version))
            
        if sort_field is not None:
            
            _query_params.append(('sortField', sort_field.value))
            
        if sort_direction is not None:
            
            _query_params.append(('sortDirection', sort_direction.value))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'ApiKeyAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/executions',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


