The first web framework designed for AI to write.
Built on FastAPI, Pydantic, and HTMX.
- Designed for AI to write - No magic, no implicit behavior. Comprehensive types and docstrings mean AI agents and editors understand the API without external docs
- Powered by FastAPI - Designed to work with FastAPI so you can serve your API and web pages from one app
- Fast to code - Tons of intuitive shortcuts and optimizations designed to expedite coding HTML with FastAPI
- Air Tags - Easy to write and performant HTML content generation using Python classes to render HTML
- Jinja Friendly - No need to write
response_class=HtmlResponseandtemplates.TemplateResponsefor every HTML view - Mix Jinja and Air Tags - Jinja and Air Tags both are first class citizens. Use either or both in the same view!
- HTMX friendly - We love HTMX and provide utilities to use it with Air
- HTML form validation powered by pydantic - We love using pydantic to validate incoming data. Air Forms provide two ways to use pydantic with HTML forms (dependency injection or from within views)
- Easy to learn yet well documented - Hopefully Air is so intuitive and well-typed you'll barely need to use the documentation. In case you do need to look something up we're taking our experience writing technical books and using it to make documentation worth boasting about
Website: https://airwebframework.org
Documentation: https://docs.airwebframework.org
Source Code: https://github.com/feldroy/air
Caution
Air is in alpha. APIs may change between releases.
Install Air with uv:
uv venv
source .venv/bin/activate
uv init
uv add airYou can install each optional feature (extras) like this:
-
Standard — FastAPI’s recommended extras
uv add "air[standard]"
Air's API is fully typed and comprehensively documented in-source. AI coding assistants can understand the framework by reading the installed package, without fetching external documentation.
For AI context, use llms-full.txt (complete docs) or llms.txt (index with links to individual sections).
Third-party context providers: Code Wiki by Google, DeepWiki by Devin.
Air gives you two paths to HTML. Start with whichever fits your workflow.
Have your AI generate an HTML mockup, or write one yourself. Drop it in a template, wire it up with minimal Python:
templates/index.html:
<!doctype html>
<html>
<head>
<title>My App</title>
</head>
<body>
<h1>Hello, world!</h1>
</body>
</html>main.py:
import air
app = air.Air()
jinja = air.JinjaRenderer(directory="templates")
@app.page
def index(request: air.Request):
return jinja(request, name="index.html")Write HTML as typed Python classes. Your editor autocompletes attributes, your type checker validates nesting:
main.py:
import air
app = air.Air()
@app.page
def index():
return air.Html(air.H1("Hello, world!"))air runOpen http://127.0.0.1:8000 to see the result. Both paths produce the same thing: a working web page.
Air is just a layer over FastAPI. So it is trivial to combine sophisticated HTML pages and a REST API into one app.
from fastapi import FastAPI
import air
app = air.Air()
api = FastAPI()
@app.get("/")
def landing_page():
return air.Html(
air.Head(air.Title("Awesome SaaS")),
air.Body(
air.H1("Awesome SaaS"),
air.P(air.A("API Docs", target="_blank", href="/api/docs")),
),
)
@api.get("/")
def api_root():
return {"message": "Awesome SaaS is powered by FastAPI"}
# Combining the Air and FastAPI apps into one
app.mount("/api", api)Want to use Jinja2 instead of Air Tags? We've got you covered.
from fastapi import FastAPI
import air
from air.requests import Request
app = air.Air()
api = FastAPI()
# Air's JinjaRenderer is a shortcut for using Jinja templates
jinja = air.JinjaRenderer(directory="templates")
@app.get("/")
def index(request: Request):
return jinja(request, name="home.html")
@api.get("/")
def api_root():
return {"message": "Awesome SaaS is powered by FastAPI"}
# Combining the Air and FastAPI apps into one
app.mount("/api", api)Don't forget the Jinja template!
<!doctype html>
<html>
<head>
<title>Awesome SaaS</title>
</head>
<body>
<h1>Awesome SaaS</h1>
<p>
<a target="_blank" href="/api/docs">API Docs</a>
</p>
</body>
</html>Note
Using Jinja with Air is easier than with FastAPI. That's because as much as we enjoy Air Tags, we also love Jinja!
Maintenance of this project is made possible by all the contributors and sponsors. If you would like to support this project and have your avatar or company logo appear below, please sponsor us. 💖💨
Consider this low-barrier form of contribution yourself. Your support is much appreciated.
Important
Have a feature idea? Open an issue first. Air's core is intentionally minimal: new features are built as separate packages in the Air ecosystem, not added to this base package.
For guidance on setting up a development environment and how to make a contribution to Air, see Contributing to Air.
Thanks to all the contributors to the Air 💨 web framework!