nivakaran commited on
Commit
a3122f2
·
verified ·
1 Parent(s): ebaebc9

Create masterState.py

Browse files
Files changed (1) hide show
  1. src/states/masterState.py +37 -0
src/states/masterState.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing_extensions import TypedDict, Annotated, Sequence, List
2
+ from langchain_core.messages import BaseMessage
3
+ from langgraph.graph.message import add_messages
4
+ from langchain_core.tools import tool
5
+ from pydantic import BaseModel, Field
6
+ import operator
7
+
8
+ class ExecutorState(TypedDict):
9
+ """
10
+ State for the executor agent containing message history and research metadata.
11
+ """
12
+ executor_messages: Annotated[Sequence[BaseMessage], add_messages]
13
+ execution_job: str
14
+ executor_data: List[str]
15
+
16
+ class ExecutorOutputState(TypedDict):
17
+ """
18
+ Output state for the executor agent containing final executor results.
19
+ """
20
+ output: str
21
+ executor_data: List[str]
22
+ executor_messages: Annotated[Sequence[BaseMessage], add_messages]
23
+
24
+
25
+ class PlannerOutput(BaseModel):
26
+ """Simplified output for the planner that only returns execution jobs"""
27
+ executor_jobs: List[str] = Field(description="List of execution jobs to be completed")
28
+
29
+ class MasterState(TypedDict):
30
+ """Master orchestrator state"""
31
+ query_brief: str
32
+ execution_jobs: List[str]
33
+ completed_jobs: Annotated[List[str], operator.add]
34
+ worker_outputs: Annotated[List[ExecutorOutputState], operator.add]
35
+ final_output: str
36
+
37
+