# 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_input_type import AgentInputType
from .agent_status import AgentStatus


class Agent(UniversalBaseModel):
    agent_input_type: typing.Optional[AgentInputType] = pydantic.Field(default=None)
    """
    The type of input the agent expects.
    """

    created_at: dt.datetime = pydantic.Field()
    """
    The timestamp when the agent was created
    """

    description: str = pydantic.Field()
    """
    The description of the action.
    """

    id: str = pydantic.Field()
    """
    The unique identifier of the agent.
    """

    name: str = pydantic.Field()
    """
    The agent name (unique within namespace).
    """

    namespace_id: str = pydantic.Field()
    """
    The namespace ID this agent belongs to.
    """

    registered_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    The timestamp when the agent was last registered
    """

    registration_metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
    """
    The metadata for the agent's registration.
    """

    status: typing.Optional[AgentStatus] = pydantic.Field(default=None)
    """
    Agent status. Runtime statuses (Ready/Failed/Unhealthy) now live on Deployment.
    """

    status_reason: typing.Optional[str] = pydantic.Field(default=None)
    """
    The reason for the status of the action.
    """

    updated_at: dt.datetime = pydantic.Field()
    """
    The 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
