liveBook · Manning

Router

As explained in Context Engineering

A routing agent analyzes an incoming query and directs it to a specialized retrieval tool or knowledge store.

A router selects which specialist handles an incoming request. In a multi-agent system, it chooses the next agent; in agentic RAG, it can direct a query to a specialized retrieval tool or knowledge store, such as vector search, graph traversal, or an external API. section 7.7.4 section 3.5

Routing fits requests that fall into mutually exclusive categories. Unlike a query-planning agent, which decomposes a question into retrieval subtasks, a router selects the appropriate destination. Its main risks are misclassification and unhandled routes. section 3.5 section 7.7

Customer support routing

A support workflow classifies each question as sales, technical support, or general. A routing function reads the current user message and any retained conversation messages from workflow state, asks a model to classify the question, and returns the branch name. The selected specialist then handles the request. section 7.9.3

Listing 7.4 Building the LangGraph workflow for the router pattern
def build_graph(self):
    workflow = StateGraph(AgentState) #1

    workflow.add_node("router", self.router_node) #2
    workflow.add_node("sales_agent", self.create_agent_node("You are a
    helpful sales assistant."))
    workflow.add_node("tech_support_agent", self.create_agent_node("You
    are a helpful technical support assistant."))
    workflow.add_node("general_agent", self.create_agent_node("You are a
    helpful general assistant."))

    workflow.set_entry_point("router") #3
    workflow.add_conditional_edges( #4
        "router",
        self.route_question, #5
        {
            "sales": "sales_agent",
            "tech_support": "tech_support_agent",
            "general": "general_agent",
        },
    )
    workflow.add_edge("sales_agent", END)
    workflow.add_edge("tech_support_agent", END)
    workflow.add_edge("general_agent", END)

    return workflow.compile()

The LangGraph listing shows the router as the graph entry point and maps classification results to specialist agent nodes through conditional edges. section 7.9.3

A production routing decision should include a route name, confidence score, and short reason. Apply a confidence threshold and send ambiguous or unknown requests to an explicit fallback or user clarification path rather than silently defaulting to the general agent. Choose the most constrained coordination pattern that meets the task’s needs: greater flexibility can reduce predictability and debuggability. section 7.7.4 section 7.9.3 section 7.7

How Context Engineering covers it

How deep it goes
Explains state-based classification and conditional graph branches, then recommends confidence thresholds and explicit fallbacks for production.
Examples
Uses a customer support workflow with sales, technical support, and general agents.
What you can do after
Apply it via LangGraph to dispatch support questions through conditional branches.
How it connects
Connects routing to multi-agent coordination, agentic RAG, shared state, and query planning.

Also explained in

Compare how 2 books explain router →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Context Engineering. The section links point to the parts of the book it draws on.