Spaces:
Sleeping
Sleeping
Create actionState.py
Browse files- src/states/actionState.py +39 -0
src/states/actionState.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import operator
|
| 3 |
+
from typing_extensions import TypedDict, Annotated, List, Sequence
|
| 4 |
+
from pydantic import BaseModel, Field
|
| 5 |
+
from langchain_core.messages import BaseMessage
|
| 6 |
+
from langgraph.graph.message import add_messages
|
| 7 |
+
from typing_extensions import Literal
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class ExecutorState(TypedDict):
|
| 11 |
+
"""
|
| 12 |
+
State for the executor agent containing message history and research metadata.
|
| 13 |
+
|
| 14 |
+
This state tracks the executors conversation, iteration count for limiting
|
| 15 |
+
tool calls, the executor topic being
|
| 16 |
+
"""
|
| 17 |
+
executor_messages: Annotated[Sequence[BaseMessage], add_messages]
|
| 18 |
+
execution_job: str
|
| 19 |
+
executor_data: List[str]
|
| 20 |
+
|
| 21 |
+
class ExecutorOutputState(TypedDict):
|
| 22 |
+
"""
|
| 23 |
+
Output state for the executor agent containing final executor results.
|
| 24 |
+
|
| 25 |
+
This represents the final output of the execution process with executor_data,
|
| 26 |
+
executor_messages and output from the execution process.
|
| 27 |
+
|
| 28 |
+
"""
|
| 29 |
+
output: str
|
| 30 |
+
executor_data: List[str]
|
| 31 |
+
executor_messages: Annotated[Sequence[BaseMessage], add_messages]
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# Structured output schema
|
| 35 |
+
class CustomerQuestion(BaseModel):
|
| 36 |
+
"""Schema for customer query brief generation"""
|
| 37 |
+
query_brief: str = Field(description="A customer question that will be used to guide the execution")
|
| 38 |
+
|
| 39 |
+
|