# Uvicorn — card for AI agents

Lightning-fast ASGI server for running async Python web applications.

Category: HTTP servers and APIs · PyPI package `uvicorn` · latest version 0.54.0 (checked 2026-11-01)
Install: `pip install uvicorn`
License: BSD-3-Clause (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (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.

## What it is
- Uvicorn is an ASGI web server for Python. The repository dates from May 2017 and is BSD-3-Clause licensed. The README explains why it exists: Python lacked "a minimal low-level server/application interface for async frameworks", and the ASGI specification fills that gap. Uvicorn is one server built on that interface.
- Your application is an async callable, `app(scope, receive, send)`. You run it with `uvicorn module:app`. You can also start it from Python code with `uvicorn.run()`, or with `uvicorn.Config` and `uvicorn.Server` when you need more control. A bare `pip install uvicorn` pulls in only pure-Python dependencies. `uvicorn[standard]` adds faster parsers, an event loop and dev tooling.
- It is for anyone running an async Python framework that speaks ASGI and needs a process to serve it. For production, the docs point to Gunicorn as the process manager.

## Caveats
- HTTP/2 is experimental and opt-in: The README lists HTTP/2 as supported. The release notes call it experimental. It needs the `zttp` package and the flags `--http zttp --http2`. Upgrade-based h2c and WebSockets over HTTP/2 are not supported.
- Built-in Gunicorn workers are deprecated: The docs still show `-k uvicorn.workers.UvicornWorker`. 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.
- wsproto is not installed for you: Even `[standard]` only brings in `websockets`. If you want `wsproto`, you have to install it yourself.

## Numbers (AgentGid data)
- Gid Score: 81.8 (#72 of all tools, 4 of 102 in its category)
- Used in 477 public projects set up for AI coding agents (7.6%)
- Downloads last week: 166,960,249 (as of 2026-11-24), +18.0% over 4 weeks
- GitHub stars: 11,138 (as of 2026-11-24)
- Last push: 2026-11-22

## Often used with
FastAPI 90.1%, Pydantic 62.1%, python-dotenv 52.2%, python-multipart 37.3%, Requests 36.1%, Pydantic Settings 32.7%

## Checked alternatives (same job)
- Tornado: https://agentgid.com/tools/tornado/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/uvicorn/
- Homepage: https://uvicorn.dev/
- Repository: https://github.com/Kludex/uvicorn
- Source: https://github.com/Kludex/uvicorn#readme
- Source: https://github.com/Kludex/uvicorn
- Source: https://github.com/Kludex/uvicorn/releases
- Source: https://uvicorn.dev


## Uvicorn: run your async Python web app

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.

### Where to use 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.

### How to start
- 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:app
```

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

```
uvicorn main:app --workers 4
```


### License
Free to use, also in paid and closed products, under the BSD-3-Clause license. If you ship its code, keep the copyright notice; you may not use the makers' name to promote your product.

### Good to know
- It needs Python 3.10 or newer; version 0.40.0 dropped Python 3.9.
- By default it listens only on your own computer (127.0.0.1); on a server or in a container you set the host to 0.0.0.0.
- HTTP/2 support is still marked experimental in version 0.54.0.
- It runs the app, it does not build it; routes, pages and data checks come from a framework such as FastAPI or Starlette.
- The project is active; version 0.54.0 came out on September 24, 2026.

Checked 2026-11-11 against: https://uvicorn.dev/, https://uvicorn.dev/installation/, https://uvicorn.dev/settings/, https://uvicorn.dev/deployment/, https://uvicorn.dev/concepts/asgi/, https://uvicorn.dev/release-notes/, https://github.com/Kludex/uvicorn/blob/main/README.md, https://github.com/Kludex/uvicorn/blob/main/LICENSE.md, https://github.com/Kludex/uvicorn/blob/main/docs/release-notes.md, https://pypi.org/pypi/uvicorn/json

### Mistakes to avoid
- Don't: uvicorn.run(app, reload=True) or uvicorn.run(app, workers=4) with the app object → Do: 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.)
- Don't: uvicorn main:app --reload --workers 4 → Do: --reload on your computer, --workers N on the server, never both (The two options cannot be combined.)
- Don't: uvicorn main:app inside a Docker container, then wondering why the port does not answer → Do: 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.)
- Don't: gunicorn -k uvicorn.workers.UvicornWorker in new projects → Do: 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.)
- Don't: --forwarded-allow-ips '*' on a server that is reachable directly from the internet → Do: 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.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
