Skip to content

Thread agent schema

ThreadAgent

Bases: ABC, BaseModel

Abstract schema for a Thread agent.

Source code in light_agents/schemas/thread_agent_schema.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class ThreadAgent(ABC, BaseModel):
    """Abstract schema for a Thread agent."""

    model_config = model_config
    messages_serializer: Callable[..., List[Dict[str, str]]] = base_serializer
    verbose: bool = False

    @abstractmethod
    def agent_run(
        self, thread_messages: MutableSequence[MessageBase], **kwargs: Any
    ) -> Sequence[MessageBase]:
        """Run the agent."""
        raise NotImplementedError

    @abstractmethod
    def process_tools(
        self, tool_use_messages: List[ToolUseMessage], **kwargs: Any
    ) -> MutableSequence[ToolUseMessage]:
        """Process the tools."""
        raise NotImplementedError

agent_run(thread_messages, **kwargs) abstractmethod

Run the agent.

Source code in light_agents/schemas/thread_agent_schema.py
18
19
20
21
22
23
@abstractmethod
def agent_run(
    self, thread_messages: MutableSequence[MessageBase], **kwargs: Any
) -> Sequence[MessageBase]:
    """Run the agent."""
    raise NotImplementedError

process_tools(tool_use_messages, **kwargs) abstractmethod

Process the tools.

Source code in light_agents/schemas/thread_agent_schema.py
25
26
27
28
29
30
@abstractmethod
def process_tools(
    self, tool_use_messages: List[ToolUseMessage], **kwargs: Any
) -> MutableSequence[ToolUseMessage]:
    """Process the tools."""
    raise NotImplementedError