Feature Proposal: First-Class AgentRouter and LLMRouter Abstractions

Feature Proposal: First-Class AgentRouter and LLMRouter Abstractions

Background

LangGraph provides excellent low-level primitives for building agent workflows, including nodes, edges, conditional routing, Command, state management, and graph-based orchestration.

However, when building multi-agent applications, developers commonly need to implement routing logic themselves.

For example, a developer may currently implement something like:

def route(state):
    # Custom routing logic
    ...

and then connect this function to conditional edges or Command(goto=...).

This works well, but the routing logic itself becomes application-specific code that has to be designed, implemented, tested, evaluated, and maintained by each developer.

Proposed Feature

Would the LangGraph team consider providing first-class, reusable routing abstractions for two common routing scenarios?

1. AgentRouter

A reusable component for deciding which Agent or subgraph should handle a user request.

Conceptually:

agent_router = AgentRouter(
    agents={
        "hr": hr_agent,
        "finance": finance_agent,
        "it": it_agent
    },
    routing_strategy="llm"
)

The router could produce a structured routing decision such as:

{
    "destination": "hr",
    "confidence": 0.94,
    "reason": "The request concerns employee leave policy."
}

The resulting destination could then be used directly by the LangGraph runtime.

Possible routing strategies could include:

  • rule-based routing

  • LLM-based routing

  • classifier-based routing

  • embedding/semantic routing

  • custom routing functions

2. LLMRouter / ModelRouter

A reusable component for selecting an LLM/model based on characteristics of the request.

For example:

llm_router = LLMRouter(
    models={
        "fast": fast_model,
        "general": general_model,
        "reasoning": reasoning_model
    },
    routing_strategy="complexity"
)

Possible routing criteria could include:

  • query complexity

  • token length

  • task type

  • reasoning requirements

  • latency requirements

  • cost requirements

  • model availability

  • fallback requirements

For example:

Simple query      → Fast model
Normal query      → General model
Complex reasoning → Reasoning model

Why This Could Be Valuable

The proposed components would not replace LangGraph’s existing low-level routing primitives.

Instead, they could provide a higher-level abstraction on top of them.

The distinction could be:

Low-level LangGraph
-------------------

StateGraph
Command
Conditional Edges
Nodes
Edges
       ↓
Developer implements routing


Higher-level routing
--------------------

AgentRouter
LLMRouter / ModelRouter
       ↓
Reusable routing abstraction
       ↓
LangGraph primitives

This could make routing reusable across applications while preserving LangGraph’s existing low-level flexibility.

Example Enterprise Use Case

Consider an enterprise HR Assistant.

A user might ask:

“What is the maternity leave policy and how many days of leave do I have remaining?”

The system may need to route the request to an HR Agent.

The HR Agent may then use:

  • Knowledge/RAG for HR policy documents

  • Workday API for employee-specific leave balance

After retrieval/tool execution, the system could use an LLM router to select an appropriate model for the final response.

Conceptually:

User
 │
 ▼
AgentRouter
 │
 ▼
HR Agent
 │
 ├── HR Policy Knowledge/RAG
 │
 └── Workday Tool
 │
 ▼
LLMRouter
 │
 ├── Fast Model
 ├── General Model
 └── Reasoning Model
 │
 ▼
Final Answer

Relationship to Existing LangGraph Capabilities

This proposal is not intended to replace:

  • StateGraph

  • conditional edges

  • Command

  • custom routing functions

  • subgraphs

  • existing multi-agent patterns

Instead, the proposed routers could provide standardized higher-level abstractions that internally use these existing primitives.

Potential API

A possible API could be:

agent_router = AgentRouter(
    destinations=[
        hr_agent,
        finance_agent,
        it_agent
    ],
    strategy="llm",
    model=router_model
)

graph.add_router(
    "agent_router",
    agent_router
)

And for model routing:

model_router = ModelRouter(
    models=[
        fast_model,
        general_model,
        reasoning_model
    ],
    strategy="complexity"
)

response = model_router.invoke(request)

The exact API is open for discussion; the main proposal is the introduction of reusable first-class routing abstractions rather than prescribing a specific API.

Questions for the LangGraph Team

  1. Is this direction aligned with LangGraph’s architecture and roadmap?

  2. Would an AgentRouter abstraction be appropriate, or is the current low-level routing model intentionally preferred?

  3. Would a model/LLM router belong in LangGraph itself, LangChain, or another package?

  4. Could routing strategies be pluggable so that developers can choose between rules, classifiers, LLM-based routing, semantic routing, or custom strategies?

  5. Would the LangGraph team be interested in a community contribution implementing a prototype?