# Vercel Routing Middleware now supports Python

published: 2026-10-21T19:05:46.805Z
topic: infrastructure
source: https://vercel.com/changelog/routing-middleware-now-supports-python
url: https://aiagentnews.io/stories/vercel-routing-middleware-now-supports-python

Vercel says Routing Middleware can now be written in Python for FastAPI, Flask, Django and other Python frameworks. The middleware runs before requests reach the app and can rewrite, redirect or answer them.

The middleware is set up through the proxy entrypoint in vercel.toml, which points at a proxy object such as proxy:proxy. It is an ASGI or WSGI app that runs separately from the main application and can only use packages in the vercel.proxy dependency group of pyproject.toml. Packages the middleware imports must be added to that group, for example with uv add --group vercel.proxy vercel-proxy.

The vercel-proxy package provides utilities for writing routing middleware on Vercel, including a Proxy app that routes requests by path. Its example issues a 308 redirect for old blog slugs and adds a request header to API calls before they continue. Requests that match no route pass through to the application unchanged.

## Why it matters if you build agents

Python agent backends deployed on Vercel can now handle redirects, path-based routing and request header changes in front of the app without a separate service. Middleware code runs in its own environment, so any package it imports has to be declared in the vercel.proxy group rather than assumed from the main app's dependencies.
