|
My Project
|
Functions | |
| Literal["invoke_s_graph", "invoke_a_graph"] | route (RouteState state) |
| RouteState | invoke_s_graph (RouteState state) |
| RouteState | invoke_a_graph (RouteState state) |
Variables | |
| PARENT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | |
| graph_builder = StateGraph(RouteState) | |
| chat_graph = graph_builder.compile() | |
Copyright 2026 Luca Silver Root routing agent that directs requests to either student or advisor chat graphs based on account type. Functions: - `route`: Conditional router that directs to student or advisor graph based on account_type. - `invoke_s_graph`: Looks up student ID from parent user ID and invokes the student chat graph. - `invoke_a_graph`: Invokes the advisor chat graph with the current conversation state. Graph Structure: - START -> [invoke_s_graph | invoke_a_graph] (conditional routing based on account type) - invoke_s_graph -> END - invoke_a_graph -> END Exports: - `chat_graph`: Compiled LangGraph root routing agent.
| RouteState invoke_a_graph | ( | RouteState | state | ) |
Invokes the advisor chat graph with the current conversation state.
Args:
state (RouteState): Routing state containing the current messages, user ID,
and account type.
Returns:
RouteState: State update containing the messages returned by the advisor graph.
| RouteState invoke_s_graph | ( | RouteState | state | ) |
Resolves the current student ID and invokes the student chat graph.
The route state contains the user ID. This node looks up the corresponding student ID,
then seeds the student chat graph with the message history and the student-specific
identifiers needed downstream.
Args:
state (RouteState): Routing state containing the current messages, user ID,
and account type.
Returns:
RouteState: State update containing the messages returned by the student graph.
Raises:
ValueError: If no student row exists for the provided parent user ID.
| Literal["invoke_s_graph", "invoke_a_graph"] route | ( | RouteState | state | ) |
Chooses the main chat graph based on the user's account type.
Student users are routed to the student chat graph, while advisor users are
routed to the advisor chat graph.
Args:
state (RouteState): Routing state containing the authenticated user ID,
account type, and current messages.
Returns:
Literal["invoke_s_graph", "invoke_a_graph"]: The next node name for the
state graph.
| lg_agent.constr.chat_graph = graph_builder.compile() |
| lg_agent.constr.graph_builder = StateGraph(RouteState) |
| lg_agent.constr.PARENT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) |