MessageState
MessageState
is a data structure that represents the current snapshot of the conversation, which is developed on top of LangGraph State. It is the input parameter passed from the orchestrator to workers.
Here is the implementation of a sample MessageState
:
class MessageState(TypedDict):
# system configuration
sys_instruct: str
# input message
user_message: ConvoMessage
orchestrator_message: OrchestratorMessage
# message flow between different nodes
message_flow: Annotated[str, "message flow between different nodes"]
# final response
response: str
# task-related params
status: StatusEnum
slots: list[Slot]
sys_instruct
: The system-level instructions for the orchestrator.user_message
: AConvoMessage
object containing the user's query and chat history.orchestrator_message
: AnOrchestratorMessage
object contains value and attributes of a node in TaskGraph.message_flow
: Annotated[str, "message flow between different nodes"]response
: The final response for the user after execution.status
: AStatusEnum
object indicating whether the task has been completedslots
: A list ofSlot
objects to collect information during the conversation.
For the list of Slot
objects, they should be defined as:
class Slot(BaseModel):
name: str
type: str
value: str
description: str
prompt: str