Files
graphtest/src/agent/state.py
William Fu-Hinthorn 609708eafe update
2024-09-13 17:10:24 -07:00

26 lines
749 B
Python

"""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.
"""