from typing import Annotated, Any, Dict, List, Optional, Sequence, TypedDict from langchain_core.messages import BaseMessage import operator # The agent state is the input to each node in the graph class AgentState(TypedDict): # The annotation tells the graph that new messages will always # be added to the current states messages: Annotated[Sequence[BaseMessage], operator.add] # The 'next' field indicates where to route to next next: str