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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .agent_key import AgentKey
from .agent_model import AgentModel
from .agent_name import AgentName
from .agent_tool_configuration import AgentToolConfiguration
from .components_schemas_conversational_agent_step import ComponentsSchemasConversationalAgentStep


class Agent(UniversalBaseModel):
    """
    An AI agent that can use tools to provide intelligent responses and actions.
    """

    key: AgentKey
    name: AgentName
    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    A detailed description of the agent's purpose and capabilities.
    """

    tool_configurations: typing.Dict[str, AgentToolConfiguration] = pydantic.Field()
    """
    A map of tool configurations available to the agent. The key is the name of the tool configuration and the value is an agent tool configuration.
    """

    model: AgentModel
    first_step: ComponentsSchemasConversationalAgentStep
    metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Arbitrary metadata associated with the agent for customization and configuration.
    """

    enabled: bool = pydantic.Field()
    """
    Whether the agent is currently enabled and available for use.
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Timestamp when the agent was created.
    """

    updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Timestamp when the agent was last updated.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
