"""Define the state structures for the agent.""" from __future__ import annotations from dataclasses import dataclass, field from typing import List from langchain_core.messages import AnyMessage from langgraph.graph import add_messages from typing_extensions import Annotated @dataclass class State: """Defines the input state for the agent, representing a narrower interface to the outside world. This class is used to define the initial state and structure of incoming data. """ messages: Annotated[List[AnyMessage], add_messages] = field(default_factory=list) """ Messages tracking the primary execution state of the agent. Typically accumulates a pattern of user, assistant, user, ... etc. messages. """