1. License
“Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:”
Free for paid and closed apps; keep the BSD copyright notice if you ship Uvicorn's code.
github.com/Kludex/uvicorn/blob/main/LICENSE.md3. Used by agents' projects
Dependency in 477 public GitHub projects set up for AI coding agents that we scanned (7.6%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error
What Uvicorn does
Uvicorn is a free program that runs Python web apps built with FastAPI, Starlette and similar tools. It takes the requests that come in from browsers and hands them to your code. You start it with one command on your computer or your server.
What people build with it
Try your app while you code
Your assistant builds a FastAPI backend; Uvicorn runs it on your computer and restarts it each time a file changes.
Serve the app on your own server
On a rented server, Uvicorn runs several copies of your app at once, so one slow request does not hold up the rest.
Put it behind Nginx
Nginx in front sends files and holds slow visitors, and Uvicorn only runs your Python code.
Live chat and updates in the page
A chat window or a live progress bar keeps one connection open per visitor; Uvicorn can hold those open while other requests go on.
Start the server inside a test script
Your test or a small tool starts the web app, sends it a few requests and stops it again, all in one Python file.
Update code without dropping visitors
After a deploy you send one signal, and Uvicorn swaps its copies of the app one by one, so nobody gets an error page.
Uvicorn popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Uvicorn is used
- Uvicorn is a dependency in 477 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (29.4% of the 1,623 Python ones), #1 of 102 in http servers and apis.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 3,226; those are left out of every share on this page.
- The most used alternative in our scan is Tornado (12 projects).
- Projects that use it most often also use FastAPI (90.1%), Pydantic (62.1%), python-dotenv (52.2%).
- It is more common in projects set up for OpenClaw (12.0%) than for OpenAI Codex (4.1%).
By coding agent
Often used with
Uvicorn in practice
Strengths
A plain install keeps dependencies to pure Python. <code>uvicorn[standard]</code> uses <code>uvloop</code> and <code>httptools</code> "if possible". It also adds <code>websockets</code>, <code>watchfiles</code> for <code>--reload</code>, <code>python-dotenv</code> for <code>--env-file</code>, and PyYAML for YAML log configs.
Uvicorn serves the ASGI interface, not a specific framework. The README presents this decoupling as the point of ASGI: any framework that speaks ASGI can run on any ASGI server.
There are three ways to start Uvicorn from code: <code>uvicorn.run()</code>, a <code>Config</code> plus <code>Server</code> pair, or <code>await server.serve()</code>. The last one is for when an async environment is already running.
Uvicorn can call a zero-argument function that returns the app, instead of importing a ready-made app instance.
Watch out for
The README lists HTTP/2 as supported. The release notes call it experimental. It needs the <code>zttp</code> package and the flags <code>--http zttp --http2</code>. Upgrade-based h2c and WebSockets over HTTP/2 are not supported.
The docs still show <code>-k uvicorn.workers.UvicornWorker</code>. They also warn that this module is going away and point to a separate package instead.
The docs recommend Gunicorn for production. Gunicorn handles scaling worker counts, graceful worker restarts and zero-downtime upgrades.
A bare ASGI app served by Uvicorn
async def app(scope, receive, send):
assert scope['type'] == 'http'
await send({
'type': 'http.response.start',
'status': 200,
'headers': [
(b'content-type', b'text/plain'),
],
})
await send({
'type': 'http.response.body',
'body': b'Hello, world!',
})
# Run the server:
# $ uvicorn example:appMore about Uvicorn
Funding
- GitHub Sponsors: https://github.com/Kludex
- 30 GitHub sponsors
Packages around it
- fastapi: ASGI web framework
- pydantic: data validation
- python-dotenv: .env loading for --env-file
- requests: HTTP client
- python-multipart: multipart form parsing
- numpy: numerical arrays
More in HTTP servers and APIs
Alternatives
Uvicorn This page
Pick Hypercorn when you need HTTP/3 or the trio async library; Uvicorn's docs list it as an alternative ASGI server.
Pick Granian for a server written in Rust that runs ASGI apps with HTTP/2, TLS and WebSockets.
Pick Gunicorn for classic sync apps (Flask, Django without async) or as a process manager in front of Uvicorn workers.
Pick Daphne when your project uses Django Channels, the setup it was first built for.
High-performance Python web framework and async networking library for building servers.
Get started
Tell your AI assistant
“Run this FastAPI app with Uvicorn (pin uvicorn[standard]==0.54.0, Python 3.10+) — use `uvicorn main:app --reload` locally and `uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4` in the Docker image, never both flags together.”
Install Uvicorn in your project. The standard extra adds faster parts, file watching for --reload and .env support.
pip install 'uvicorn[standard]'Write or generate an app in main.py (FastAPI, Starlette, or plain ASGI), then run it.
uvicorn main:appFrom uvicorn.dev/
For production, run several workers and keep the server behind a proxy such as Nginx.
uvicorn main:app --workers 4
Rules for your agent
## Uvicorn
- Install `uvicorn[standard]` when you want `uvloop`, `httptools`, `websockets`, `watchfiles` for `--reload`, and `python-dotenv` for `--env-file`. A plain `uvicorn` install is pure Python only.
- Point the CLI at `module:attribute` (for example `uvicorn main:app`). Add `--factory` when the target is a zero-argument function that returns the ASGI app.
- Inside code that already runs an event loop, use `uvicorn.Config` plus `await uvicorn.Server(config).serve()`, not `uvicorn.run()`.
- For Gunicorn deployments, install the `uvicorn-worker` package. The `uvicorn.workers` module is deprecated and will be removed.
- Treat HTTP/2 as experimental. It needs `zttp` and `--http zttp --http2`. Do not rely on h2c upgrade or WebSockets over HTTP/2.
- To use `wsproto` instead of `websockets`, add `wsproto` to dependencies explicitly. Passing a `.yaml` file to `--log-config` requires PyYAML.
Mistakes to avoid
In our run with 0.54.0 it printed "You must pass the application as an import string to enable 'reload' or 'workers'." and exited with code 3.
The two options cannot be combined.
The default host is 127.0.0.1, which is reachable only from inside the container.
The worker module inside Uvicorn is deprecated and will be removed.
With '*' anyone can fake the visitor address and the http/https scheme through headers.
Questions
Do I need Uvicorn for FastAPI?
FastAPI needs some ASGI server to run, and Uvicorn is one of them; Daphne and Hypercorn also run any ASGI framework.
Can I use --reload and --workers together?
No. Use --reload on your computer while coding and --workers on the server.
Should I still run it under Gunicorn?
You can, but the built-in uvicorn.workers module is deprecated; install the separate uvicorn-worker package for that setup, or use Uvicorn's own --workers.
What does the standard extra add?
The faster uvloop event loop and httptools parser, websockets, watchfiles for --reload, python-dotenv for --env-file and PyYAML for log configs.
Does it see the real visitor's address behind a proxy?
Only if the proxy sends forwarded headers and its address is trusted; by default only 127.0.0.1 and ::1 are trusted.