Skip to main content


Air

The first web framework designed for AI to write.
Built on FastAPI, Pydantic, and HTMX.

CI - main GitHub License

PyPI - Version Python Versions PyPI Total Downloads PyPI Monthly Downloads PyPI Weekly Downloads

Windows macOS Ubuntu

GitHub commit activity GitHub commits since latest release GitHub last commit GitHub Release Date

GitHub contributors Discord X Bluesky MkDocs

FastAPI Pydantic Jinja Astral


Why use Air?

  • 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 - Your FastAPI knowledge and routes carry over. Serve your API and web pages from one project
  • 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=HtmlResponse and templates.TemplateResponse for 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.

Installation

Install Air with uv:

uv venv
source .venv/bin/activate
uv init
uv add air

Install optional features (with uv add)

You can install each optional feature (extras) like this:

  1. Standard — FastAPI’s recommended extras

    uv add "air[standard]"
    

Built for AI-Assisted Development

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.

Two Ways to Build

Air gives you two paths to HTML. Start with whichever fits your workflow.

Start with HTML

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 Website</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")

Start with Python

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!"))

Run either one

air run

Open http://127.0.0.1:8000 to see the result. Both paths produce the same thing: a working web page.

Use FastAPI Alongside Air

Air is powered by FastAPI. You get Air's HTML tools for your pages and FastAPI's full capabilities for your API, all in one app.

Mount a FastAPI sub-app

Two separate apps, clean split. Air serves pages, FastAPI serves your API at /api.

from fastapi import FastAPI

import air

app = air.Air()
api = FastAPI()


@app.page
def index():
    return air.Html(
        air.Head(air.Title("My Website")),
        air.Body(
            air.H1("My Website"),
            air.P(air.A("API Docs", target="_blank", href="/api/docs")),
        ),
    )


@api.get("/")
def api_root():
    return {"message": "My Website is powered by FastAPI"}


# Mount the FastAPI app under /api
app.mount("/api", api)

Wrap a single FastAPI instance

One app. Air adds its features on top. You get OpenAPI docs, response_model, and WebSockets alongside your pages.

from fastapi import FastAPI

import air

fastapi_app = FastAPI()
app = air.Air(fastapi_app=fastapi_app)


@app.page
def index():
    return air.H1("Hello, world!")


@app.fastapi_app.get("/api/users")
def api_users():
    return [{"name": "Audrey M. Roy Greenfeld"}]

Sponsors

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.

Contributing

[!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.

Contributors

Thanks to all the contributors to the Air 💨 web framework!

PyPI Stats

Star History

Star History Chart

Metadata

Release files for Air 0.48.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Air 0.48.1
File Size Uploaded
air-0.48.1.tar.gz 64.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Air 0.48.1
File Interpreter ABI Platform
air-0.48.1-py3-none-any.whl Python 3 none any Details

Total release size: 142.3 kB

Release files / air-0.48.1.tar.gz

Download URL air-0.48.1.tar.gz
Size 64.7 kB
Tags Source
SHA-256 checksum
How to use checksums
aff84b9f235d88507782cbf7fecfce95f9c66d689a90a1be606cc6a1248a3629
BLAKE2b-256 checksum
How to use checksums
0eb4ce83e545340f8773122a099849c4b2596f3bc399bfe1be1bcd6f7e99463e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 3, 2026.

Transparency log

Release files / air-0.48.1-py3-none-any.whl

Download URL air-0.48.1-py3-none-any.whl
Size 77.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3b2fbc7a98f91b1dc379a320215275a6b77f520cc5c97369adc9aa9a8724fe7
BLAKE2b-256 checksum
How to use checksums
4f4d02921701c0a5d8b6db6e3b00447f57575b5699fc898893e3bb375f6ff27e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.48.1 This release

2 release files

0.48.0

2 release files

0.47.0

2 release files

0.46.0

2 release files

0.44.1

2 release files

0.44.0

2 release files

0.43.0

2 release files

0.41.2

2 release files

0.41.1

2 release files

0.41.0

2 release files

0.39.0

2 release files

0.38.1

2 release files

0.38.0

2 release files

0.37.0

2 release files

0.36.0

2 release files

0.33.1

2 release files

0.33.0

2 release files

0.32.0

2 release files

0.31.0

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.2

2 release files

0.25.1

2 release files

0.25.0

2 release files

0.24.2

2 release files

0.24.1

2 release files

0.24.0

2 release files

0.23.1

2 release files

0.23.0

2 release files

0.22.1

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page