22 lines
642 B
Python
22 lines
642 B
Python
"""
|
|
LangGraph agent state — defines the shape of the state object that flows
|
|
through every node in the agent graph.
|
|
"""
|
|
|
|
from typing import Annotated, TypedDict
|
|
|
|
from langgraph.graph.message import add_messages
|
|
|
|
|
|
class AgentState(TypedDict):
|
|
"""
|
|
The single source of truth that travels through every node in the graph.
|
|
|
|
`messages` uses LangGraph's `add_messages` reducer, which:
|
|
- Appends new messages to the list.
|
|
- Replaces messages with the same ID (useful for tool-call results).
|
|
"""
|
|
|
|
messages: Annotated[list, add_messages]
|
|
discord_user_id: int | None # set by the Discord bot, None for REST API calls
|