Skip to content

[Feature Request] Async Support for FastAPI Routers and Adapter Invocations #45

Open
@ilkersigirci

Description

@ilkersigirci

Description
First, thank you for this great library! While examining the code, I noticed that the FastAPI routers are not using async endpoints, and the adapter.invoke method runs synchronously for all underlying LangGraph operations. This appears to be a potential bottleneck for multi-user serving scenarios, as the server processes requests sequentially.

Current Behavior

  • FastAPI routes are synchronous
  • adapter.invoke blocks the event loop
  • Server processes requests one at a time

Expected Behavior

  • FastAPI routes should support async operations
  • Adapter should support ainvoke for asynchronous execution
  • Server should be able to handle multiple concurrent requests efficiently

Proposed Solution

  1. Convert FastAPI routers to use async endpoints
  2. Implement and use await adapter.ainvoke for LangGraph operations
  3. Maintain backward compatibility with sync operations

Benefits

  • Improved scalability for multi-user scenarios
  • Better utilization of FastAPI's async capabilities
  • Non-blocking request processing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions