diff --git a/backend/src/ea_chatbot/graph/workers/researcher/__init__.py b/backend/src/ea_chatbot/graph/workers/researcher/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/src/ea_chatbot/graph/workers/researcher/state.py b/backend/src/ea_chatbot/graph/workers/researcher/state.py new file mode 100644 index 0000000..58547a4 --- /dev/null +++ b/backend/src/ea_chatbot/graph/workers/researcher/state.py @@ -0,0 +1,21 @@ +from typing import TypedDict, List, Dict, Any, Optional +from langchain_core.messages import BaseMessage + +class WorkerState(TypedDict): + """Internal state for the Researcher worker subgraph.""" + + # Internal worker conversation + messages: List[BaseMessage] + + # The specific sub-task assigned by the Orchestrator + task: str + + # Search context + queries: List[str] + raw_results: List[str] + + # Number of internal retry/refinement attempts + iterations: int + + # The final research summary to return to the Orchestrator + result: Optional[str] diff --git a/backend/tests/test_researcher_state.py b/backend/tests/test_researcher_state.py new file mode 100644 index 0000000..2166602 --- /dev/null +++ b/backend/tests/test_researcher_state.py @@ -0,0 +1,13 @@ +from typing import get_type_hints, List +from ea_chatbot.graph.workers.researcher.state import WorkerState + +def test_researcher_worker_state(): + """Verify that Researcher WorkerState has the required fields.""" + hints = get_type_hints(WorkerState) + + assert "messages" in hints + assert "task" in hints + assert "queries" in hints + assert "raw_results" in hints + assert "iterations" in hints + assert "result" in hints