Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Uvicorn

Run your async Python web app.

HTTP servers and APIsPYPI

GitHubWebsite

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.md

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

82 / 100
Gid Score, #72 overall
167M
downloads a week, pypi
11.1K
GitHub stars
477
agent projects use it
Uvicorn: downloads per weekPyPI, uvicorn 165,068,421
Uvicorn: GitHub starsKludex/uvicorn 11,138

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

251 projects, 8.3%
211 projects, 6.4%
158 projects, 6.5%
40 projects, 12.0%
25 projects, 5.3%
19 projects, 4.1%
18 projects, 6.5%
16 projects, 4.7%

Often used with

In 90.1% of its projects
In 62.1% of its projects
In 52.2% of its projects
In 37.3% of its projects
In 36.1% of its projects
In 32.7% of its projects
In 30.8% of its projects
In 30.4% of its projects

Uvicorn in practice

Strengths

Two install tiers: minimal or [standard]

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.

Not tied to one framework

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.

Can run inside an existing event loop

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.

Application factories via --factory

Uvicorn can call a zero-argument function that returns the app, instead of importing a ready-made app instance.

Watch out for

HTTP/2 is experimental and opt-in

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.

Built-in Gunicorn workers are deprecated

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.

Process management lives outside Uvicorn

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:app

More about Uvicorn

Funding
  • GitHub Sponsors: https://github.com/Kludex
  • 30 GitHub sponsors

See all

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

BSD-3-ClauseGid 82167M/wk

Hypercorn

Pick Hypercorn when you need HTTP/3 or the trio async library; Uvicorn's docs list it as an alternative ASGI server.

Granian

Pick Granian for a server written in Rust that runs ASGI apps with HTTP/2, TLS and WebSockets.

Gunicorn

Pick Gunicorn for classic sync apps (Flask, Django without async) or as a process manager in front of Uvicorn workers.

Daphne

Pick Daphne when your project uses Django Channels, the setup it was first built for.

Tornado

High-performance Python web framework and async networking library for building servers.

Apache-2.0Gid 7629.1M/wk

Compare Uvicorn with another tool

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.”

  1. Install Uvicorn in your project. The standard extra adds faster parts, file watching for --reload and .env support.

    pip install 'uvicorn[standard]'

    From uvicorn.dev/installation/

  2. Write or generate an app in main.py (FastAPI, Starlette, or plain ASGI), then run it.

    uvicorn main:app

    From uvicorn.dev/

  3. For production, run several workers and keep the server behind a proxy such as Nginx.

    uvicorn main:app --workers 4

    From uvicorn.dev/deployment/

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## 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

uvicorn.run(app, reload=True) or uvicorn.run(app, workers=4) with the app object
Pass an import string, uvicorn.run("main:app", reload=True), inside if __name__ == "__main__"

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.

uvicorn main:app --reload --workers 4
--reload on your computer, --workers N on the server, never both

The two options cannot be combined.

uvicorn main:app inside a Docker container, then wondering why the port does not answer
uvicorn main:app --host 0.0.0.0 --port 8000

The default host is 127.0.0.1, which is reachable only from inside the container.

gunicorn -k uvicorn.workers.UvicornWorker in new projects
pip install uvicorn-worker and use its worker class, or use uvicorn --workers N

The worker module inside Uvicorn is deprecated and will be removed.

--forwarded-allow-ips '*' on a server that is reachable directly from the internet
List only your proxy's address in --forwarded-allow-ips

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.