My Project
Loading...
Searching...
No Matches
lg_agent.constr Namespace Reference

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()

Detailed Description

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.

Function Documentation

◆ invoke_a_graph()

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.

◆ invoke_s_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.

◆ route()

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.

Variable Documentation

◆ chat_graph

lg_agent.constr.chat_graph = graph_builder.compile()

◆ graph_builder

lg_agent.constr.graph_builder = StateGraph(RouteState)

◆ PARENT_DIR

lg_agent.constr.PARENT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))