"""Shared state types for LangGraph agents and workflows.""" from typing import TypedDict, Annotated, Sequence, List, Optional, Dict, Any from langchain_core.messages import BaseMessage from langgraph.graph.message import add_messages from langchain_core.documents import Document class AgentState(TypedDict, total=False): """State for conversational agents with optional RAG and summary outputs. Keys are optional to keep nodes composable; nodes add what they produce. """ # Conversation messages: Annotated[Sequence[BaseMessage], add_messages] query: Optional[str] # Project scoping project_id: Optional[str] index_name: Optional[str] sources: Optional[List[str]] # RAG retrieval results formation_docs: List[Document] prestation_docs: List[Document] formation_context: str prestation_context: str project_docs: List[Document] project_context: str # Documents metadata collected from tool calls (stream/API compatibility) documents: List[Dict[str, Any]] # Summarization artifacts summary_markdown: str summary_pdf_path: str # local path or URL if uploaded # Classification classification: object # Pydantic model instance with fields classification, reasoning # Voice pipeline flag voice_mode: Optional[bool] class CustomState(AgentState): project_id: Optional[str]