[PR #3471] Add custom router support in langgraph-api #3306

Closed
opened 2026-02-20 17:48:24 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/3471

State: closed
Merged: No


Add support for a custom Router type to specify

  • Custom routes
  • Custom middleware
  • Custom lifespans

Why custom type vs. permitting Starlette Router/App directly?
tl;dr - maintaining deps. Starlette Router() builds the middleware stack without retaining pointers to the original middleware. Starlette() app itself has other things that we may not want to support.

Custom type lets us limit the surface area. It's just a struct.

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/3471 **State:** closed **Merged:** No --- Add support for a custom Router type to specify - Custom routes - Custom middleware - Custom lifespans Why custom type vs. permitting Starlette Router/App directly? tl;dr - maintaining deps. Starlette Router() builds the middleware stack without retaining pointers to the original middleware. Starlette() app itself has other things that we may not want to support. Custom type lets us limit the surface area. It's just a struct.
yindo added the pull-request label 2026-02-20 17:48:24 -05:00
yindo closed this issue 2026-02-20 17:48:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#3306