# This file was auto-generated by Fern from our API Definition.

import typing

from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.request_options import RequestOptions
from ..types.create_agent_request_background_sound import CreateAgentRequestBackgroundSound
from ..types.create_agent_request_language import CreateAgentRequestLanguage
from ..types.create_agent_request_slm_model import CreateAgentRequestSlmModel
from ..types.create_agent_request_synthesizer import CreateAgentRequestSynthesizer
from ..types.workflow_type import WorkflowType
from .raw_client import AsyncRawAgentsClient, RawAgentsClient
from .types.delete_agent_agent_id_webhook_subscriptions_response import DeleteAgentAgentIdWebhookSubscriptionsResponse
from .types.delete_agent_id_response import DeleteAgentIdResponse
from .types.get_agent_agent_id_webhook_subscriptions_response import GetAgentAgentIdWebhookSubscriptionsResponse
from .types.get_agent_id_response import GetAgentIdResponse
from .types.get_agent_id_workflow_response import GetAgentIdWorkflowResponse
from .types.get_agent_response import GetAgentResponse
from .types.patch_agent_id_request_language import PatchAgentIdRequestLanguage
from .types.patch_agent_id_request_slm_model import PatchAgentIdRequestSlmModel
from .types.patch_agent_id_request_synthesizer import PatchAgentIdRequestSynthesizer
from .types.patch_agent_id_response import PatchAgentIdResponse
from .types.post_agent_agent_id_webhook_subscriptions_request_event_types_item import (
    PostAgentAgentIdWebhookSubscriptionsRequestEventTypesItem,
)
from .types.post_agent_agent_id_webhook_subscriptions_response import PostAgentAgentIdWebhookSubscriptionsResponse
from .types.post_agent_response import PostAgentResponse

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class AgentsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawAgentsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawAgentsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawAgentsClient
        """
        return self._raw_client

    def get_all_agents(
        self,
        *,
        page: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        search: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetAgentResponse:
        """
        Agents are the main entities in the system. Agents are used to create conversations. You can create workflow for an agent and configure it for different use cases. You can also create custom workflows for an agent. This API will give you the list of agents created by organization you are a part of.

        Parameters
        ----------
        page : typing.Optional[int]

        offset : typing.Optional[int]

        search : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetAgentResponse
            Successful response

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.agents.get_all_agents()
        """
        _response = self._raw_client.get_all_agents(
            page=page, offset=offset, search=search, request_options=request_options
        )
        return _response.data

    def create_a_new_agent(
        self,
        *,
        name: str,
        description: typing.Optional[str] = OMIT,
        background_sound: typing.Optional[CreateAgentRequestBackgroundSound] = OMIT,
        language: typing.Optional[CreateAgentRequestLanguage] = OMIT,
        synthesizer: typing.Optional[CreateAgentRequestSynthesizer] = OMIT,
        global_knowledge_base_id: typing.Optional[str] = OMIT,
        slm_model: typing.Optional[CreateAgentRequestSlmModel] = OMIT,
        default_variables: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        global_prompt: typing.Optional[str] = OMIT,
        telephony_product_id: typing.Optional[str] = OMIT,
        workflow_type: typing.Optional[WorkflowType] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PostAgentResponse:
        """
        You can create a new agent by passing the name of the agent in the request body. You can use update-workflow endpoint next to assign custom workflow to the agent.

        Parameters
        ----------
        name : str

        description : typing.Optional[str]

        background_sound : typing.Optional[CreateAgentRequestBackgroundSound]
            Ambient background sound during calls. Options: '' (none), 'office', 'cafe', 'call_center', 'static'.

        language : typing.Optional[CreateAgentRequestLanguage]
            Language configuration for the agent. You can enable or disable language switching for the agent. This will be used to determine the language of the agent.

        synthesizer : typing.Optional[CreateAgentRequestSynthesizer]
            Synthesizer configuration for the agent. You can configure the synthesizer to use different voices and models. Currently we support 3 types of models for the synthesizer. Waves, Waves Lightning Large and Waves Lightning Large Voice Clone. You can clone your voice using waves platform https://waves.smallest.ai/voice-clone and use the voiceId for this field and select the model as waves_lightning_large_voice_clone to use your cloned voice. When updating the synthesizer configuration to voice clone model, you have to provide model and voiceId and gender all are required fields but when selecting the model as waves or waves and waves_lightning_large, you have to provide only model field and voiceId.

        global_knowledge_base_id : typing.Optional[str]
            The global knowledge base ID of the agent. You can create a global knowledge base by using the /knowledgebase endpoint and assign it to the agent. The agent will use this knowledge base for its responses.

        slm_model : typing.Optional[CreateAgentRequestSlmModel]
            The LLM model to use for the agent. LLM model will be used to generate the response and take decisions based on the user's query.

        default_variables : typing.Optional[typing.Dict[str, typing.Any]]
            The default variables to use for the agent. These variables will be used if no variables are provided when initiating a conversation with the agent.

        global_prompt : typing.Optional[str]
            Set global instructions for your agent's personality, role, and behavior throughout conversations.
            Note: Only used for workflow_graph agents.

        telephony_product_id : typing.Optional[str]
            The telephony product ID of the agent. This is the product ID of the telephony product that will be used to make the outbound call. You can buy telephone number and assign it to the agent.

        workflow_type : typing.Optional[WorkflowType]
            The type of workflow to create for the agent. Defaults to workflow_graph if not specified.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        PostAgentResponse
            Agent created successfully

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.agents.create_a_new_agent(
            name="name",
        )
        """
        _response = self._raw_client.create_a_new_agent(
            name=name,
            description=description,
            background_sound=background_sound,
            language=language,
            synthesizer=synthesizer,
            global_knowledge_base_id=global_knowledge_base_id,
            slm_model=slm_model,
            default_variables=default_variables,
            global_prompt=global_prompt,
            telephony_product_id=telephony_product_id,
            workflow_type=workflow_type,
            request_options=request_options,
        )
        return _response.data

    def get_agent_by_id(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetAgentIdResponse:
        """
        Agents are the main entities in the system. Agents are used to create conversations. You can create workflow for an agent and configure it for different use cases. You can also create custom workflows for an agent.

        Parameters
        ----------
        id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetAgentIdResponse
            Successful response

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.agents.get_agent_by_id(
            id="id",
        )
        """
        _response = self._raw_client.get_agent_by_id(id, request_options=request_options)
        return _response.data

    def delete_an_agent(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteAgentIdResponse:
        """
        Parameters
        ----------
        id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DeleteAgentIdResponse
            Agent deleted successfully

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.agents.delete_an_agent(
            id="id",
        )
        """
        _response = self._raw_client.delete_an_agent(id, request_options=request_options)
        return _response.data

    def update_an_agent(
        self,
        id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        language: typing.Optional[PatchAgentIdRequestLanguage] = OMIT,
        synthesizer: typing.Optional[PatchAgentIdRequestSynthesizer] = OMIT,
        global_knowledge_base_id: typing.Optional[str] = OMIT,
        slm_model: typing.Optional[PatchAgentIdRequestSlmModel] = OMIT,
        default_variables: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        global_prompt: typing.Optional[str] = OMIT,
        telephony_product_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PatchAgentIdResponse:
        """
        Parameters
        ----------
        id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

        language : typing.Optional[PatchAgentIdRequestLanguage]
            Language configuration for the agent. You can enable or disable language switching for the agent. This will be used to determine the language of the agent.

        synthesizer : typing.Optional[PatchAgentIdRequestSynthesizer]
            Synthesizer configuration for the agent. You can configure the synthesizer to use different voices and models. Currently we support 3 types of models for the synthesizer. Waves, Waves Lightning Large and Waves Lightning Large Voice Clone. You can clone your voice using waves platform https://waves.smallest.ai/voice-clone and use the voiceId for this field and select the model as waves_lightning_large_voice_clone to use your cloned voice. When updating the synthesizer configuration to voice clone model, you have to provide model and voiceId and gender all are required fields but when selecting the model as waves or waves and waves_lightning_large, you have to provide only model field and voiceId.

        global_knowledge_base_id : typing.Optional[str]

        slm_model : typing.Optional[PatchAgentIdRequestSlmModel]

        default_variables : typing.Optional[typing.Dict[str, typing.Any]]
            The default variables to use for the agent. These variables will be used if no variables are provided when initiating a conversation with the agent.

        global_prompt : typing.Optional[str]
            Set global instructions for your agent's personality, role, and behavior throughout conversations.
            Note: Only used for workflow_graph agents.

        telephony_product_id : typing.Optional[str]
            The telephony product ID of the agent. This is the product ID of the telephony product that will be used to make the outbound call. You can buy telephone number and assign it to the agent.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        PatchAgentIdResponse
            Agent updated successfully

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.agents.update_an_agent(
            id="id",
        )
        """
        _response = self._raw_client.update_an_agent(
            id,
            name=name,
            description=description,
            language=language,
            synthesizer=synthesizer,
            global_knowledge_base_id=global_knowledge_base_id,
            slm_model=slm_model,
            default_variables=default_variables,
            global_prompt=global_prompt,
            telephony_product_id=telephony_product_id,
            request_options=request_options,
        )
        return _response.data

    def get_agent_workflow(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetAgentIdWorkflowResponse:
        """
        Retrieve the workflow configuration for a specific agent. The workflow contains nodes and edges that define the conversation flow and logic for the agent.

        Parameters
        ----------
        id : str
            The ID of the agent

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetAgentIdWorkflowResponse
            Successful response

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.agents.get_agent_workflow(
            id="id",
        )
        """
        _response = self._raw_client.get_agent_workflow(id, request_options=request_options)
        return _response.data

    def get_webhook_subscriptions_for_an_agent(
        self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetAgentAgentIdWebhookSubscriptionsResponse:
        """
        Retrieve webhook subscriptions for a given agent ID

        Parameters
        ----------
        agent_id : str
            The ID of the agent

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetAgentAgentIdWebhookSubscriptionsResponse
            Successful response

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.agents.get_webhook_subscriptions_for_an_agent(
            agent_id="agentId",
        )
        """
        _response = self._raw_client.get_webhook_subscriptions_for_an_agent(agent_id, request_options=request_options)
        return _response.data

    def create_webhook_subscriptions_for_an_agent(
        self,
        agent_id: str,
        *,
        event_types: typing.Sequence[PostAgentAgentIdWebhookSubscriptionsRequestEventTypesItem],
        webhook_id: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PostAgentAgentIdWebhookSubscriptionsResponse:
        """
        Create webhook subscriptions for a specific agent with selected event types

        Parameters
        ----------
        agent_id : str
            The ID of the agent to create subscriptions for

        event_types : typing.Sequence[PostAgentAgentIdWebhookSubscriptionsRequestEventTypesItem]
            Array of event types to subscribe to

        webhook_id : str
            The ID of the webhook to subscribe to

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        PostAgentAgentIdWebhookSubscriptionsResponse
            Subscriptions created successfully

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.agents.create_webhook_subscriptions_for_an_agent(
            agent_id="agentId",
            event_types=["pre-conversation"],
            webhook_id="60d0fe4f5311236168a109ca",
        )
        """
        _response = self._raw_client.create_webhook_subscriptions_for_an_agent(
            agent_id, event_types=event_types, webhook_id=webhook_id, request_options=request_options
        )
        return _response.data

    def delete_webhook_subscriptions_for_an_agent(
        self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteAgentAgentIdWebhookSubscriptionsResponse:
        """
        Delete webhook subscriptions for a given agent ID

        Parameters
        ----------
        agent_id : str
            The ID of the agent to filter subscriptions by

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DeleteAgentAgentIdWebhookSubscriptionsResponse
            Subscriptions deleted successfully

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.agents.delete_webhook_subscriptions_for_an_agent(
            agent_id="agentId",
        )
        """
        _response = self._raw_client.delete_webhook_subscriptions_for_an_agent(
            agent_id, request_options=request_options
        )
        return _response.data


class AsyncAgentsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawAgentsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawAgentsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawAgentsClient
        """
        return self._raw_client

    async def get_all_agents(
        self,
        *,
        page: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        search: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetAgentResponse:
        """
        Agents are the main entities in the system. Agents are used to create conversations. You can create workflow for an agent and configure it for different use cases. You can also create custom workflows for an agent. This API will give you the list of agents created by organization you are a part of.

        Parameters
        ----------
        page : typing.Optional[int]

        offset : typing.Optional[int]

        search : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetAgentResponse
            Successful response

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.agents.get_all_agents()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_all_agents(
            page=page, offset=offset, search=search, request_options=request_options
        )
        return _response.data

    async def create_a_new_agent(
        self,
        *,
        name: str,
        description: typing.Optional[str] = OMIT,
        background_sound: typing.Optional[CreateAgentRequestBackgroundSound] = OMIT,
        language: typing.Optional[CreateAgentRequestLanguage] = OMIT,
        synthesizer: typing.Optional[CreateAgentRequestSynthesizer] = OMIT,
        global_knowledge_base_id: typing.Optional[str] = OMIT,
        slm_model: typing.Optional[CreateAgentRequestSlmModel] = OMIT,
        default_variables: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        global_prompt: typing.Optional[str] = OMIT,
        telephony_product_id: typing.Optional[str] = OMIT,
        workflow_type: typing.Optional[WorkflowType] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PostAgentResponse:
        """
        You can create a new agent by passing the name of the agent in the request body. You can use update-workflow endpoint next to assign custom workflow to the agent.

        Parameters
        ----------
        name : str

        description : typing.Optional[str]

        background_sound : typing.Optional[CreateAgentRequestBackgroundSound]
            Ambient background sound during calls. Options: '' (none), 'office', 'cafe', 'call_center', 'static'.

        language : typing.Optional[CreateAgentRequestLanguage]
            Language configuration for the agent. You can enable or disable language switching for the agent. This will be used to determine the language of the agent.

        synthesizer : typing.Optional[CreateAgentRequestSynthesizer]
            Synthesizer configuration for the agent. You can configure the synthesizer to use different voices and models. Currently we support 3 types of models for the synthesizer. Waves, Waves Lightning Large and Waves Lightning Large Voice Clone. You can clone your voice using waves platform https://waves.smallest.ai/voice-clone and use the voiceId for this field and select the model as waves_lightning_large_voice_clone to use your cloned voice. When updating the synthesizer configuration to voice clone model, you have to provide model and voiceId and gender all are required fields but when selecting the model as waves or waves and waves_lightning_large, you have to provide only model field and voiceId.

        global_knowledge_base_id : typing.Optional[str]
            The global knowledge base ID of the agent. You can create a global knowledge base by using the /knowledgebase endpoint and assign it to the agent. The agent will use this knowledge base for its responses.

        slm_model : typing.Optional[CreateAgentRequestSlmModel]
            The LLM model to use for the agent. LLM model will be used to generate the response and take decisions based on the user's query.

        default_variables : typing.Optional[typing.Dict[str, typing.Any]]
            The default variables to use for the agent. These variables will be used if no variables are provided when initiating a conversation with the agent.

        global_prompt : typing.Optional[str]
            Set global instructions for your agent's personality, role, and behavior throughout conversations.
            Note: Only used for workflow_graph agents.

        telephony_product_id : typing.Optional[str]
            The telephony product ID of the agent. This is the product ID of the telephony product that will be used to make the outbound call. You can buy telephone number and assign it to the agent.

        workflow_type : typing.Optional[WorkflowType]
            The type of workflow to create for the agent. Defaults to workflow_graph if not specified.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        PostAgentResponse
            Agent created successfully

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.agents.create_a_new_agent(
                name="name",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_a_new_agent(
            name=name,
            description=description,
            background_sound=background_sound,
            language=language,
            synthesizer=synthesizer,
            global_knowledge_base_id=global_knowledge_base_id,
            slm_model=slm_model,
            default_variables=default_variables,
            global_prompt=global_prompt,
            telephony_product_id=telephony_product_id,
            workflow_type=workflow_type,
            request_options=request_options,
        )
        return _response.data

    async def get_agent_by_id(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetAgentIdResponse:
        """
        Agents are the main entities in the system. Agents are used to create conversations. You can create workflow for an agent and configure it for different use cases. You can also create custom workflows for an agent.

        Parameters
        ----------
        id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetAgentIdResponse
            Successful response

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.agents.get_agent_by_id(
                id="id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_agent_by_id(id, request_options=request_options)
        return _response.data

    async def delete_an_agent(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteAgentIdResponse:
        """
        Parameters
        ----------
        id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DeleteAgentIdResponse
            Agent deleted successfully

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.agents.delete_an_agent(
                id="id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_an_agent(id, request_options=request_options)
        return _response.data

    async def update_an_agent(
        self,
        id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        language: typing.Optional[PatchAgentIdRequestLanguage] = OMIT,
        synthesizer: typing.Optional[PatchAgentIdRequestSynthesizer] = OMIT,
        global_knowledge_base_id: typing.Optional[str] = OMIT,
        slm_model: typing.Optional[PatchAgentIdRequestSlmModel] = OMIT,
        default_variables: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        global_prompt: typing.Optional[str] = OMIT,
        telephony_product_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PatchAgentIdResponse:
        """
        Parameters
        ----------
        id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

        language : typing.Optional[PatchAgentIdRequestLanguage]
            Language configuration for the agent. You can enable or disable language switching for the agent. This will be used to determine the language of the agent.

        synthesizer : typing.Optional[PatchAgentIdRequestSynthesizer]
            Synthesizer configuration for the agent. You can configure the synthesizer to use different voices and models. Currently we support 3 types of models for the synthesizer. Waves, Waves Lightning Large and Waves Lightning Large Voice Clone. You can clone your voice using waves platform https://waves.smallest.ai/voice-clone and use the voiceId for this field and select the model as waves_lightning_large_voice_clone to use your cloned voice. When updating the synthesizer configuration to voice clone model, you have to provide model and voiceId and gender all are required fields but when selecting the model as waves or waves and waves_lightning_large, you have to provide only model field and voiceId.

        global_knowledge_base_id : typing.Optional[str]

        slm_model : typing.Optional[PatchAgentIdRequestSlmModel]

        default_variables : typing.Optional[typing.Dict[str, typing.Any]]
            The default variables to use for the agent. These variables will be used if no variables are provided when initiating a conversation with the agent.

        global_prompt : typing.Optional[str]
            Set global instructions for your agent's personality, role, and behavior throughout conversations.
            Note: Only used for workflow_graph agents.

        telephony_product_id : typing.Optional[str]
            The telephony product ID of the agent. This is the product ID of the telephony product that will be used to make the outbound call. You can buy telephone number and assign it to the agent.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        PatchAgentIdResponse
            Agent updated successfully

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.agents.update_an_agent(
                id="id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_an_agent(
            id,
            name=name,
            description=description,
            language=language,
            synthesizer=synthesizer,
            global_knowledge_base_id=global_knowledge_base_id,
            slm_model=slm_model,
            default_variables=default_variables,
            global_prompt=global_prompt,
            telephony_product_id=telephony_product_id,
            request_options=request_options,
        )
        return _response.data

    async def get_agent_workflow(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetAgentIdWorkflowResponse:
        """
        Retrieve the workflow configuration for a specific agent. The workflow contains nodes and edges that define the conversation flow and logic for the agent.

        Parameters
        ----------
        id : str
            The ID of the agent

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetAgentIdWorkflowResponse
            Successful response

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.agents.get_agent_workflow(
                id="id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_agent_workflow(id, request_options=request_options)
        return _response.data

    async def get_webhook_subscriptions_for_an_agent(
        self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetAgentAgentIdWebhookSubscriptionsResponse:
        """
        Retrieve webhook subscriptions for a given agent ID

        Parameters
        ----------
        agent_id : str
            The ID of the agent

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetAgentAgentIdWebhookSubscriptionsResponse
            Successful response

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.agents.get_webhook_subscriptions_for_an_agent(
                agent_id="agentId",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_webhook_subscriptions_for_an_agent(
            agent_id, request_options=request_options
        )
        return _response.data

    async def create_webhook_subscriptions_for_an_agent(
        self,
        agent_id: str,
        *,
        event_types: typing.Sequence[PostAgentAgentIdWebhookSubscriptionsRequestEventTypesItem],
        webhook_id: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PostAgentAgentIdWebhookSubscriptionsResponse:
        """
        Create webhook subscriptions for a specific agent with selected event types

        Parameters
        ----------
        agent_id : str
            The ID of the agent to create subscriptions for

        event_types : typing.Sequence[PostAgentAgentIdWebhookSubscriptionsRequestEventTypesItem]
            Array of event types to subscribe to

        webhook_id : str
            The ID of the webhook to subscribe to

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        PostAgentAgentIdWebhookSubscriptionsResponse
            Subscriptions created successfully

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.agents.create_webhook_subscriptions_for_an_agent(
                agent_id="agentId",
                event_types=["pre-conversation"],
                webhook_id="60d0fe4f5311236168a109ca",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_webhook_subscriptions_for_an_agent(
            agent_id, event_types=event_types, webhook_id=webhook_id, request_options=request_options
        )
        return _response.data

    async def delete_webhook_subscriptions_for_an_agent(
        self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteAgentAgentIdWebhookSubscriptionsResponse:
        """
        Delete webhook subscriptions for a given agent ID

        Parameters
        ----------
        agent_id : str
            The ID of the agent to filter subscriptions by

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DeleteAgentAgentIdWebhookSubscriptionsResponse
            Subscriptions deleted successfully

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.agents.delete_webhook_subscriptions_for_an_agent(
                agent_id="agentId",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_webhook_subscriptions_for_an_agent(
            agent_id, request_options=request_options
        )
        return _response.data
