Frameworks
/
Standard Fetch Handler

Standard Fetch Handler

The standard fetch handler is the core implementation of Open LangGraph Server, built entirely on Web Standards (WHATWG Fetch API). It provides a framework-agnostic way to integrate LangGraph into any platform that supports standard Request/Response APIs.

Why Use the Fetch Handler?

  • Platform Agnostic: Works on any platform supporting standard Web APIs
  • Zero Framework Overhead: No framework dependencies to manage
  • Maximum Portability: Deploy the same code to multiple platforms
  • Future Proof: Based on web standards, not proprietary APIs

Supported Platforms

The fetch handler works on:

PlatformStatusNotes
Cloudflare Workers
✅ Fully Supported
Recommended for edge computing
Deno Deploy
✅ Fully Supported
Native TypeScript support
Vercel Edge
✅ Fully Supported
Edge runtime compatible
Bun
✅ Fully Supported
Fast JavaScript runtime
Node.js
✅ Fully Supported
Via Hono or direct usage
Custom Platforms
✅ Fully Supported
Any Web API-compliant platform

Installation

Basic Usage

Simple Handler

With Context

Platform-Specific Examples

Cloudflare Workers

Environment Setup:

Deno Deploy

Environment Setup:

Vercel Edge Functions

Environment Setup:

Configure environment variables in Vercel dashboard:

  • DATABASE_URL
  • REDIS_URL
  • CHECKPOINT_TYPE

Bun

Configuration

Environment Variables

All platforms support standard environment variables:

Storage Backends

The fetch handler supports all storage backends:

  • Memory: Default, no configuration needed
  • SQLite: Set SQLITE_DATABASE_URI
  • PostgreSQL: Set DATABASE_URL and CHECKPOINT_TYPE=postgres
  • Redis: Set REDIS_URL and CHECKPOINT_TYPE=redis

API Endpoints

The fetch handler implements all LangGraph Server endpoints:

Assistants

  • POST /assistants/search - Search assistants
  • GET /assistants/:id/graph - Get assistant graph

Threads

  • POST /threads - Create thread
  • POST /threads/search - Search threads
  • GET /threads/:id - Get thread
  • DELETE /threads/:id - Delete thread
  • POST /threads/:id/state - Update thread state

Runs

  • POST /threads/:id/runs/stream - Stream a new run
  • GET /threads/:id/runs/:runId/stream - Join existing stream
  • GET /threads/:id/runs - List runs
  • POST /threads/:id/runs/:runId/cancel - Cancel run

Advanced Usage

Custom Route Handling

Authentication Middleware

Rate Limiting

CORS Configuration

Performance Considerations

Connection Pooling

For database-heavy workloads, configure connection pooling:

Caching

Implement caching for frequently accessed data:

Troubleshooting

" errors

Ensure you're using the correct import path:

Streaming not working

Ensure your platform supports streaming responses:

  • Cloudflare Workers: ✅ Supported
  • Deno Deploy: ✅ Supported
  • Vercel Edge: ✅ Supported (with caveats)
  • Bun: ✅ Supported

Context not accessible in graph

Verify context structure matches expected format:

Database connection issues

  • Check environment variables are set correctly
  • Verify network access to database
  • Ensure database is initialized (DATABASE_INIT=true for first run)

Migration from Framework Adapters

Migrating from Hono or Next.js adapters is straightforward:

From Hono

From Next.js

Next Steps

Built with

Show your support! Star us on GitHub ⭐️