2025-08-31 00:34:26 +08:00
|
|
|
"""Define the state structures for the agent."""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from collections.abc import Sequence
|
2025-09-01 22:37:03 +08:00
|
|
|
from dataclasses import dataclass, field
|
|
|
|
|
from typing import Annotated
|
2025-08-31 00:34:26 +08:00
|
|
|
|
2025-10-23 01:39:01 +08:00
|
|
|
from langchain.messages import AnyMessage
|
2025-08-31 00:34:26 +08:00
|
|
|
from langgraph.graph import add_messages
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@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.
|
|
|
|
|
"""
|
|
|
|
|
|
2025-09-01 22:37:03 +08:00
|
|
|
messages: Annotated[Sequence[AnyMessage], add_messages] = field(default_factory=list)
|