# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import TYPE_CHECKING, Dict, List, Optional
from typing_extensions import Literal

from pydantic import Field as FieldInfo

from .._models import BaseModel
from .shared.json_schema import JsonSchema

__all__ = ["Agent", "Capabilities"]


class Capabilities(BaseModel):
    """Agent capabilities (e.g. streaming)"""

    streaming: Optional[bool] = None
    """Whether agent supports streaming"""

    if TYPE_CHECKING:
        # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
        # value to this field, so for compatibility we avoid doing it at runtime.
        __pydantic_extra__: Dict[str, Optional[object]] = FieldInfo(init=False)  # pyright: ignore[reportIncompatibleVariableOverride]

        # Stub to indicate that arbitrary properties are accepted.
        # To access properties that are not valid identifiers you can use `getattr`, e.g.
        # `getattr(obj, '$type')`
        def __getattr__(self, attr: str) -> Optional[object]: ...
    else:
        __pydantic_extra__: Dict[str, Optional[object]]


class Agent(BaseModel):
    id: str
    """Unique agent ID"""

    capabilities: Optional[Capabilities] = None
    """Agent capabilities (e.g. streaming)"""

    created_at: str = FieldInfo(alias="createdAt")
    """Creation timestamp"""

    description: Optional[str] = None
    """Agent description"""

    discovered_at: Optional[str] = FieldInfo(alias="discoveredAt", default=None)
    """When the agent was last discovered from a deployment"""

    example_input: Optional[Dict[str, Optional[object]]] = FieldInfo(alias="exampleInput", default=None)
    """Example input for code snippets"""

    input_schema: Optional[JsonSchema] = FieldInfo(alias="inputSchema", default=None)
    """JSON Schema for agent input"""

    metadata: Optional[Dict[str, Optional[object]]] = None
    """Extra metadata from runtime"""

    name: str
    """Agent name"""

    output_schema: Optional[JsonSchema] = FieldInfo(alias="outputSchema", default=None)
    """JSON Schema for agent input"""

    project_id: str = FieldInfo(alias="projectId")
    """Project ID"""

    stack: str
    """Agent stack (e.g., "python", "typescript", "python-langchain")"""

    status: Literal["active", "inactive"]
    """Agent status"""

    tags: Optional[List[str]] = None
    """Tags for categorization"""

    type: Optional[Literal["prompt", "chat", "task", "rag", "thread", "workflow"]] = None
    """Agent type (e.g., prompt, chat, task, rag, thread, workflow); null if not set"""

    updated_at: str = FieldInfo(alias="updatedAt")
    """Last update timestamp"""
