"""Minimal serializable state for the first LangGraph slice.""" from dataclasses import dataclass, field from typing import Any, Protocol, TypedDict class AccidentGraphState(TypedDict, total=False): session_id: str input_text: str need_form_update: bool response_text: str stage_code: str form_update: dict[str, Any] turn_count: int @dataclass(frozen=True) class GeneratedTurn: content: str form_update: dict[str, Any] = field(default_factory=dict) class ResponseGenerator(Protocol): async def generate(self, state: AccidentGraphState) -> GeneratedTurn: """Generate one state-prefixed response from graph state.""" ... async def aclose(self) -> None: """Release any owned network resources.""" ...