AI2Web Python SDK (ai2web)
The Python reference implementation of the AI2Web protocol - for Django, Flask, FastAPI, or plain Python. Mirrors @ai2web/core.
pip install ai2web
from ai2web import ai2web, validate, handle
manifest = (
ai2web({"name": "Example Store", "url": "https://example.com", "type": "ecommerce"})
.capability("content")
.capability("commerce", {"endpoint": "/ai2w/products", "checkout": True})
.transports({"mcp": {"enabled": True, "endpoint": "/ai2w/mcp"}, "rest": {"enabled": True}})
.auth({"methods": ["none", "oauth2"], "oauth2": {"pkce": True, "scopes": ["checkout"]}})
.consent({"requires_user_approval_for": ["purchase"]})
.contact({"support": "help@example.com"})
.build()
)
result = validate(manifest) # {'score': 90+, 'tier': 'Standard', ...}
# Serve every AI2Web route from one call (framework-agnostic):
res = handle({"manifest": manifest}, method, path, body, origin)
Modules
ai2web.manifest- fluent capability-model builder (ai2web(...),Manifest).ai2web.validator-validate()+ AI Readiness scoring (spec §9/§11).ai2web.negotiator-negotiate()capability negotiation (spec §5).ai2web.server-handle()framework-agnostic route handler.ai2web.safety-is_safe_public_url()/assert_safe_public_url()SSRF guard.ai2web.export-to_llms_txt()/to_agent_json()projections of the manifest (RFC-0015).
The builder also carries the v0.2 optional modules - .governance(...), .usage_policy(...),
.legal(...), .agent_identity(...), .knowledge(...) - and actions accept intent and
bindings. All are additive: a minimal manifest stays valid without them.
Test
python tests/run.py # dependency-free; includes the shared conformance contract
Requires Python 3.9+. Zero runtime dependencies.
Licence
MIT.
Metadata
Release files for ai2web 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ai2web-0.4.2.tar.gz | 22.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai2web-0.4.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.7 kB
Release files / ai2web-0.4.2.tar.gz
| Download URL | ai2web-0.4.2.tar.gz |
|---|---|
| Size | 22.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20f4a5692eb8d6989a00efbf45279451d4388bd33291ed54ab75b9fc5406f738
|
|
BLAKE2b-256 checksum How to use checksums |
dacfd3e1c68c9bdc226c9652e9006ae04116b18a18549eea64375da62f019931
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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 Jul 23, 2026.
Transparency logRelease files / ai2web-0.4.2-py3-none-any.whl
| Download URL | ai2web-0.4.2-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23add26ec5775e4d56e6433954b74feacc532e14ed427e062682e4f42305713c
|
|
BLAKE2b-256 checksum How to use checksums |
1ebd4ca81c713225ef2f04497ce25017d6421ec168b790d0e5efcb410628d530
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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 Jul 23, 2026.
Transparency log