Skip to content

types

AgentIO = Union[AgentIOBase, Sequence[AgentIOBase]] module-attribute

AgentIOBase = Union[bool, int, float, str, BaseIO] module-attribute

BaseIO

Bases: BaseModel

Source code in agenty/types.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class BaseIO(BaseModel):
    def __str__(self) -> str:
        """Convert the model to a JSON string.

        Returns:
            str: JSON string representation of the model
        """
        return self.model_dump_json()

    def __rich__(self) -> JSON:
        """Create a rich console representation of the model.

        Returns:
            JSON: Rich-formatted JSON representation
        """
        json_str = self.model_dump_json()
        return JSON(json_str)