The HTML of the agent web.

One typed snapshot per page. Agents get MCP, OpenAPI, llms.txt, and safe priced actions. Browsers keep your HTML.

GET /ahtmllive →
@ahtml 0.1
@url https://ahtml.dev/
@page_type home
@ttl 300

@policy
  agents_welcome: yes
  license: MIT

[document:why-ahtml]
  title: The HTML of the agent web
  summary: 5.6x fewer tokens, 91% to 100% accuracy

(action) score_site
  category: read
  cost: free
This page also serves/ahtml (compact)/ahtml (json)/ahtml/mcp.json/ahtml/openapi.json/llms.txt/.well-known/ahtml.json
Live · agent view of this page

This is what the agent actually reads.

Same page. Same content. One serialization for browsers, one for agents. Generated by the live toCompact() in @ahtmljs/schema.

1,507bytes56lines
@ahtml 0.1
@url https://github.com/DibbayajyotiRoy/AHTML
@fetched 2026-07-12T07:18:52.798Z
@ttl 600
@etag W/"15eeb6dc"
@page_type home

[document:ahtml-landing]
  title: AHTML — the HTML of the agent web
  author: Dibbayajyoti Roy
  published: 2026-05-12T00:00:00Z
  summary: Write your page once. AHTML emits MCP, OpenAPI, JSON-LD, llms.txt, and a typed semantic snapshot that uses 5-10× fewer tokens than HTML on lean pages, 50-100× on production-bloated pages. Drops into Next.js, Vite, SvelteKit. No migration.
  language: en
  tags: ahtml, agent-web, mcp, llms-txt, jsonld, openapi
  canonical_url: https://github.com/DibbayajyotiRoy/AHTML
  freshness: static

(action) install
  label: Install via npm
  category: read
  method: GET
  execute: https://npmjs.com/package/@ahtmljs/next
  auth: none
  cost: free

(action) join_waitlist
  label: Join waitlist
  category: send
  method: POST
  execute: /api/waitlist
  auth: none
  cost: free
  reversible: unsubscribe
  side_effects: create_subscription, send_email

(action) run_benchmark
  label: Run the benchmark locally
  category: read
  method: GET
  execute: https://github.com/DibbayajyotiRoy/AHTML/tree/main/examples/benchmark
  cost: free

(action) view_spec
  label: View v0.1 spec
  category: read
  method: GET
  execute: /spec
  cost: free

@links
  canonical: https://github.com/DibbayajyotiRoy/AHTML
  related: product:mbp-14-m3, product:mbp-16-m3, product:aw-ultra-2, product:ipad-pro-m4

@meta
  generated_by: @ahtmljs/next 0.1.0

This page as HTML

~28,400 bytes
The chrome an agent has to skim past.

This snapshot

1,507 bytes
18.8× smaller, and it includes typed actions HTML never had.
The problem

The agent web's HTML problem.

01 · Tokens

Massive semantic noise.

A typical product page ships 80 to 300 KB of nav, footer, tracking, and ad chrome. Less than 1% is the part an agent needs. Every token burned is paid for.

02 · Meaning

Intent is implicit.

Schema.org describes what something is. It does not describe what you can do with it: cost, reversibility, side effects, auth, freshness. Agents guess.

03 · Safety

No action contract.

A delete button and a $50,000 wire transfer look identical to a crawler. Without typed cost, reversibility, and confirmation, autonomous agents are one prompt injection from disaster.

The solution

One source. Every protocol downstream.

AHTML compiles to every existing agent-web standard. You don't pick a side. You don't run a parallel server. You don't migrate.

AHTML architecture: your page (Next.js, Astro, SvelteKit, Vite, Hono) compiles through an @ahtmljs adapter into five outputs: HTML for browsers, /ahtml/* compact + JSON for agents (~100× cheaper), /ahtml/mcp.json for Claude, ChatGPT, Gemini, Cursor, Copilot, /ahtml/openapi.json for REST clients and codegen, and /llms.txt for Cursor, Continue, Cline.
One source · one plugin · zero migration. Every consumer below gets its native format.
Benchmark · live, from this page

The receipts.

Same content. Four serializations. Measured with the same tokenizers OpenAI and Anthropic use internally, gpt-tokenizer and @anthropic-ai/tokenizer. No text.length / 4 guesswork.

FormatBytesBytes (gzip)Tokens o200kTokens Claude× smaller (tokens, o200k)
HTML (server-rendered)28,4006,2406,8106,4121.0×
llms.txt45933713915149×
AHTML compact1,50777450251214×
AHTML JSON (pretty)1,72883450854213×
HTML (server-rendered)
6,810
o200k tokens
6,412
Claude tokens
28,400
bytes
6,240
bytes gzip
llms.txt
49× smaller
139
o200k tokens
151
Claude tokens
459
bytes
337
bytes gzip
AHTML compact
14× smaller
502
o200k tokens
512
Claude tokens
1,507
bytes
774
bytes gzip
AHTML JSON (pretty)
13× smaller
508
o200k tokens
542
Claude tokens
1,728
bytes
834
bytes gzip

Reproduce in 60 seconds: git clone github.com/DibbayajyotiRoy/AHTML && cd ahtml/examples/benchmark && npm install && npm run start. If gpt-tokenizer or @anthropic-ai/tokenizer is not installed, the corresponding column shows "·" rather than a fudged estimate.

The packages

Sixteen packages, one contract. Plus Python.

The @ahtmljs/* scope splits cleanly: one schema everyone shares, five site adapters (plus the extractor plugin API behind them), agent-side clients in TypeScript and Python, and tooling that scores, certifies, indexes, and measures the result. The ahtml Python SDK on PyPI mirrors the TypeScript agent 1:1.

Full per-package endpoints, download counters, and STAR breakdowns in PACKAGES.md. Python SDK source in python/.

Contract layer · npm

@ahtmljs/schema

The canonical snapshot schema. Everything else depends on it.

For: Anyone authoring or validating AHTML without a framework adapter: server, client, or tooling.

  • ·TypeScript types + JSON Schema + builder + validator + linter
  • ·Dual serializers: token-optimal compact text and lossless JSON
  • ·Deterministic ETags, structural diffing, and apply-patch helpers
  • ·HTTP Message Signatures (RFC 9421), x402 helpers, and policy presets
$ npm install @ahtmljs/schema
import { snapshot, toCompact, lint } from '@ahtmljs/schema';

Quickstart flow for @ahtmljs/schema

Adapter layer · npm

@ahtmljs/next

Next.js plugin. One route, every well-known endpoint.

For: App Router sites on Next 14+/15 that want to be an MCP server.

  • ·Single route emits AHTML compact + JSON, MCP, OpenAPI 3.1, JSON-LD, llms.txt
  • ·Auto-discovers routes; no need to maintain a separate manifest
  • ·q-value Accept negotiation, ETag/If-None-Match, ?since=<etag> diffs
  • ·verifyAgents config and withPaymentGuard for priced actions
$ npm install @ahtmljs/next
import { createAHTMLRoute } from '@ahtmljs/next/handler';

Quickstart flow for @ahtmljs/next

Adapter layer · npm

@ahtmljs/astro

Astro integration. All five endpoints, zero astro dependency.

For: Astro sites that want the same agent surface as the Next adapter.

  • ·Injects .well-known, snapshot routes, MCP, OpenAPI, and llms.txt
  • ·Content negotiation, 304s, and ?since=<etag> diffs included
  • ·Passes the same adapter test matrix as @ahtmljs/next
  • ·Built on the @ahtmljs/extract plugin API
$ npm install @ahtmljs/astro
import { ahtml } from '@ahtmljs/astro';

Quickstart flow for @ahtmljs/astro

Adapter layer · npm

@ahtmljs/sveltekit

SvelteKit adapter. One server hook or per-endpoint handlers.

For: SvelteKit apps that want the same five-endpoint agent surface.

  • ·ahtmlHandle wires everything from hooks.server.ts
  • ·Or re-export plain handlers from +server.ts files per endpoint
  • ·Zero @sveltejs/kit dependency; same test matrix as Next
  • ·Built on the @ahtmljs/extract plugin API
$ npm install @ahtmljs/sveltekit
import { ahtmlHandle } from '@ahtmljs/sveltekit';

Quickstart flow for @ahtmljs/sveltekit

Adapter layer · npm

@ahtmljs/vite

Vite plugin. Same bytes as the Next adapter, every Vite framework.

For: SolidStart, vanilla Vite, or any Vite-based app without a dedicated adapter.

  • ·Mounts the well-known + /ahtml/* routes as Vite middleware
  • ·Byte-identical output to @ahtmljs/next; cross-framework parity is real
  • ·Serves /ahtml/openapi.json + /ahtml/mcp.json out of the box
  • ·One line in vite.config.ts; Vite 5+ peer dep
$ npm install @ahtmljs/vite
import { ahtml } from '@ahtmljs/vite';

Quickstart flow for @ahtmljs/vite

Adapter layer · npm

@ahtmljs/hono

Hono adapter. The same emitter on every JavaScript runtime.

For: Hono apps on Node, Bun, Deno, Cloudflare Workers, or AWS Lambda.

  • ·Mounts the well-known + /ahtml/* routes on any Hono app
  • ·Byte-identical output to the Next and Vite adapters; true parity
  • ·Edge-first: no node:* imports in the hot path
  • ·One line; Hono 4+ peer dep
$ npm install @ahtmljs/hono
import { ahtml } from '@ahtmljs/hono';

Quickstart flow for @ahtmljs/hono

Adapter layer · npm

@ahtmljs/extract

The extractor pipeline behind every adapter, with a stable plugin API.

For: Custom domain extractors (recipes, job posts) or new framework adapters.

  • ·definePlugin({ match, extract, priority }) over a neutral PageModel
  • ·Powers the Next, Vite, Hono, Astro, and SvelteKit adapters
  • ·A sub-100-LOC community recipe plugin proves the contract
  • ·@experimental for one minor release
$ npm install @ahtmljs/extract
import { definePlugin } from '@ahtmljs/extract';

Quickstart flow for @ahtmljs/extract

Consumer layer · npm

@ahtmljs/agent

Client SDK for AI agents that read the web. Works on any URL, adopter or not.

For: Anyone building an agent, scraper, or automation that reads other sites.

  • ·Typed fetch + ETag cache; fetchPage() falls back to HTML extraction
  • ·runAction() with auth, cost, reversibility, and confirmation gates
  • ·SPEC §4.7 dry-run sandbox: rehearse an action before it mutates or charges
  • ·POLICY_PRESETS.strict requires a dry-run before irreversible priced actions
$ npm install @ahtmljs/agent
import { AHTMLClient } from '@ahtmljs/agent';

Quickstart flow for @ahtmljs/agent

Consumer layer · PyPI

ahtml (Python)

The Python consumer SDK, 1:1 with the TypeScript agent.

For: Agent stacks in Python: LangChain, LlamaIndex, CrewAI, or raw SDKs.

  • ·LangChain loader plus an ETag/TTL-cached client
  • ·Detached-JWS and did:web verification
  • ·run_action with the same safety gate and dry-run sandbox
  • ·Canonical JSON output byte-identical to the TypeScript reference
$ pip install ahtml
from ahtml import AHTMLClient

Quickstart flow for ahtml (Python)

Consumer layer · npm

@ahtmljs/langchain

LangChain.js document loader. URL to embeddings in three lines.

For: RAG pipelines, vector stores, and retrieval chains on LangChain.js.

  • ·Returns LangChain Document[] preserving Document.chunks as separate records
  • ·Citation anchors, byte ranges, and source URLs in per-chunk metadata
  • ·No re-chunking; splits at server-declared boundaries deterministically
  • ·@langchain/core 0.3+ peer dep
$ npm install @ahtmljs/langchain
import { AHTMLLoader } from '@ahtmljs/langchain';

Quickstart flow for @ahtmljs/langchain

Tooling layer · npm

@ahtmljs/cli

Scaffold, audit, score, certify, or proxy any site from your terminal.

For: Anyone adopting AHTML, or anyone who wants MCP tools from any URL today.

  • ·init detects Next, Vite, Hono, Astro, or SvelteKit and wires everything
  • ·analyze, score, doctor, extract, and benchmark work on any URL
  • ·badge, submit (to the AHTML Index), and conformance certification
  • ·mcp <url> is a stdio MCP proxy: any site becomes typed MCP tools
$ npm install -g @ahtmljs/cli
$ npx @ahtmljs/cli init

Quickstart flow for @ahtmljs/cli

Infrastructure layer · npm

@ahtmljs/kv

Pluggable KV and cache backends. Same caching from one server to an edge fleet.

For: Sites that cache snapshots or rate-limit agents across multiple instances.

  • ·Drop-in backends for the AHTMLClient cache and rate-limiting surfaces
  • ·In-memory, Upstash Redis, and Cloudflare KV adapters
  • ·Backend-agnostic token-bucket RateLimiter
  • ·Tiny, dependency-light; bring your own store
$ npm install @ahtmljs/kv
import { UpstashKV } from '@ahtmljs/kv';

Quickstart flow for @ahtmljs/kv

Tooling layer · npm

@ahtmljs/webmcp

WebMCP bridge. Expose page actions as native browser tools.

For: Sites that want in-page AI assistants to discover and run their typed actions.

  • ·Registers AHTML page actions as WebMCP browser tools (Chrome 149+ origin trial)
  • ·Carries AHTML cost, reversibility, and confirmation metadata as annotations
  • ·Reuses the same action schema your snapshot already declares
  • ·Zero-install bookmarklet inspector included
$ npm install @ahtmljs/webmcp
import { registerWebMCP } from '@ahtmljs/webmcp';

Quickstart flow for @ahtmljs/webmcp

Infrastructure layer · npm

@ahtmljs/insights

Agent-traffic analytics. See which agents actually read your site.

For: Publishers who ship AHTML and want to know who consumes it.

  • ·Classifies RFC 9421-verified agents vs declared bots vs humans
  • ·Records fetches, formats, and action outcomes behind @ahtmljs/kv
  • ·Tested zero-PII guarantee; 1 ms or less p95 middleware overhead
  • ·summarize(), offline HTML dashboard, and OTel export
$ npm install @ahtmljs/insights
import { createInsights } from '@ahtmljs/insights';

Quickstart flow for @ahtmljs/insights

Tooling layer · npm

@ahtmljs/conformance

The language-agnostic conformance corpus and runner.

For: Anyone reimplementing AHTML in Go, Rust, PHP, or anything else.

  • ·Versioned fixtures covering every RFC-2119 MUST in SPEC.md
  • ·Signature vectors including negatives, plus dry-run gates
  • ·Signed result attestations you can publish
  • ·The TS reference and the Python SDK both pass 100% through the same runner
$ npm install @ahtmljs/conformance
$ ahtml conformance manifest.json

Quickstart flow for @ahtmljs/conformance

Infrastructure layer · npm

@ahtmljs/index

The AHTML Index. A registry and crawler so agents can find adopters.

For: Anyone running or querying the registry of AHTML-enabled sites.

  • ·Opt-in submission with validate, score, and signature checks
  • ·TTL/ETag-honoring re-crawl; unchanged sites cost one 304
  • ·Opt-out delisting that honors RSL and site policy
  • ·MCP query surface: search_sites and sites_with_action
$ npm install @ahtmljs/index
$ ahtml submit https://example.com

Quickstart flow for @ahtmljs/index

Infrastructure layer · npm

@ahtmljs/badge

Hosted score-badge service. Public, self-updating proof your site is agent-ready.

For: Publishers who want a README-embeddable score badge.

  • ·README-embeddable SVG with a linked score report
  • ·Score is byte-identical to a local ahtml score run
  • ·TTL-honoring cache plus per-IP rate limit
  • ·Deployable as a Cloudflare Worker or any fetch-handler runtime
$ npm install @ahtmljs/badge
$ ahtml badge https://example.com

Quickstart flow for @ahtmljs/badge


The dependency graph: schemaextract next / astro / sveltekit / vite / hono (emit) · schemaagent / langchain / ahtml-py (consume). One contract on both sides of the wire.

Quickstart

Pick a package. Follow three steps.

Each package is additive. Your existing pages keep rendering, your existing API keeps running; agents get an extra lane on the same origin.

Next.js sites: one route, every machine surface.

For: Next 14+ App Router or Pages Router projects.

Step 01 · npm

Install

npm install @ahtmljs/next @ahtmljs/schema
Step 02 · next.config.mjs

Wrap next.config

import { withAHTML } from '@ahtmljs/next';

export default withAHTML({}, {
  site: 'https://shop.com',
  policy: { agents_welcome: true },
});
Step 03 · app/ahtml/[[...path]]/route.ts

Add the route

import { createAHTMLRoute } from
  '@ahtmljs/next/handler';
import { buildSnapshot } from
  '@/lib/ahtml';

export const { GET, HEAD } =
  createAHTMLRoute(buildSnapshot);

Your snapshot now serves at:

  • /ahtml/*: typed snapshot per route (compact or JSON via Accept)
  • /ahtml/mcp.json: auto-generated MCP tools manifest
  • /ahtml/openapi.json: auto-generated OpenAPI 3.1 document
  • /.well-known/ahtml.json: site-wide discovery manifest
  • /llms.txt: compatibility shim for Cursor / Continue / Cline
What you get

One config. Every protocol.

01

MCP, emitted

Your snapshot's actions become MCP tool definitions at /ahtml/mcp.json. No separate MCP server.

02

OpenAPI, emitted

Actions with execute_url become full OpenAPI 3.1 operations. Codegen-ready.

03

JSON-LD, ingested

Existing schema.org blocks become a Level-0 snapshot with zero developer work.

04

llms.txt, shimmed

Auto-emit a clean llms.txt from registered routes. Free interop with Cursor / Continue / Cline.

05

ETag + diff

Conditional GET via If-None-Match. ?since=<etag> returns just the change list.

06

Content negotiation

Compact text for LLMs by default. Canonical JSON for signing and programmatic clients.

07

Typed actions

Every action carries auth, cost, reversibility, side effects, and confirmation level.

08

Policy enforcement

Token-bucket rate limit at the edge. Sites stay in control of what agents can do.

09

Provenance

Detached JWS over canonical JSON, verified against a did:web identity. Agents detect tampering.

10

Verified agents

RFC 9421 signed requests. Sites know which agent is calling; imposters fail verification.

11

Dry-run sandbox

SPEC §4.7: agents rehearse an action before it mutates or charges. Simulated responses never touch real state.

12

Agent insights

Traffic analytics for publishers: which agents read you, in which format, with a tested zero-PII guarantee.

Where AHTML fits

Above llms.txt. Below MCP. Beside schema.org.

We're not a competitor to any of them. AHTML compiles to MCP, OpenAPI, JSON-LD, and llms.txt, and ingests from schema.org as a free Level-0 source.

HTMLllms.txtAHTML compactAHTML JSON
Token efficiency for agentsbaselinegoodbestgood
Typed entitiesimplicittext only
Typed actionsimplicittext only
Cost / reversibility
Side-effect declarations
Site-wide policypartial
Freshness / TTL
Conditional fetch (ETag)partial
Pagination semantics
MCP-emittable
OpenAPI-emittable
Cryptographically signabledigest
Token efficiency for agents
HTML
baseline
llms.txt
good
AHTML compact
best
AHTML JSON
good
Typed entities
HTML
implicit
llms.txt
text only
AHTML compact
AHTML JSON
Typed actions
HTML
implicit
llms.txt
text only
AHTML compact
AHTML JSON
Cost / reversibility
HTML
llms.txt
AHTML compact
AHTML JSON
Side-effect declarations
HTML
llms.txt
AHTML compact
AHTML JSON
Site-wide policy
HTML
llms.txt
partial
AHTML compact
AHTML JSON
Freshness / TTL
HTML
llms.txt
AHTML compact
AHTML JSON
Conditional fetch (ETag)
HTML
partial
llms.txt
AHTML compact
AHTML JSON
Pagination semantics
HTML
llms.txt
AHTML compact
AHTML JSON
MCP-emittable
HTML
llms.txt
AHTML compact
AHTML JSON
OpenAPI-emittable
HTML
llms.txt
AHTML compact
AHTML JSON
Cryptographically signable
HTML
llms.txt
AHTML compact
digest
AHTML JSON

= AHTML

Live demo

Four products. Eight endpoints each.

Each card below is a real Next.js route on this site. Click it to see the regular HTML view. Then append /ahtml/ to the URL to see the same data as a typed snapshot. Or fetch it with Accept: application/ahtml+text.

FAQ

Frequently asked questions.

What is AHTML?

AHTML is an open-source (MIT) snapshot format and toolkit that lets any website publish an agent-readable, token-efficient view of each page: typed entities plus typed actions with explicit cost, reversibility, auth, and side-effects. It auto-emits MCP, OpenAPI 3.1, JSON-LD, llms.txt, RSL, and Markdown from that single source, while browsers keep the same HTML.

Is AHTML a replacement for MCP?

No. AHTML emits MCP. MCP is the agent’s tool-calling protocol; AHTML is the per-page contract that auto-generates an MCP manifest at /ahtml/mcp.json from your existing site, so you don’t run a separate MCP server with parallel auth and deploys.

How is AHTML different from llms.txt?

llms.txt is unstructured markdown: useful as a sitemap for IDE agents, but it can’t express typed entities or executable actions. AHTML auto-emits llms.txt as a compatibility shim and adds the typed contract; in the real-LLM benchmark llms.txt scored 89% on fact extraction vs 100% for AHTML JSON.

How many tokens does AHTML save vs raw HTML?

Measured with the real OpenAI and Anthropic tokenizers: 4.5× to 7.3× fewer tokens on the lean benchmark corpus (5.6× on the flagship page). On production-bloat pages of 200 to 500 KB the ratio scales toward 50× to 100×, because the snapshot stays near ~2 KB.

Does AHTML make LLM agents more accurate?

Yes. In a multi-model benchmark (146 runs, 20 fact-extraction tasks across gpt-4o-mini, claude-haiku-4.5, gemini-2.5-flash, and llama-3.3-70b), accuracy rose from 91% on raw HTML to 100% on AHTML JSON.

Do I need to migrate my site to use AHTML?

No. AHTML is additive: it adds endpoints (/ahtml/*, /.well-known/ahtml.json, /llms.txt) next to your existing routes, and the HTML you serve to browsers is unchanged.

Which frameworks does AHTML support?

Next.js 14+/15 App Router (@ahtmljs/next), Astro (@ahtmljs/astro), SvelteKit (@ahtmljs/sveltekit), Vite-based apps such as SolidStart (@ahtmljs/vite), and Hono on Node, Bun, Deno, Cloudflare Workers, and AWS Lambda (@ahtmljs/hono). You can also use @ahtmljs/schema directly with hand-rolled routes in any framework, and `npx @ahtmljs/cli init` detects and wires all five supported frameworks.

Does AHTML work on sites that haven’t adopted it?

Yes. @ahtmljs/cli and @ahtmljs/agent extract typed snapshots from ordinary HTML (schema.org, OpenGraph, microdata, data-attributes), and `npx @ahtmljs/cli mcp <url>` turns any URL into MCP tools today.

Can I use AHTML from Python?

Yes. `pip install ahtml` gives you the Python consumer SDK: a LangChain loader, an ETag/TTL-cached client, detached-JWS and did:web verification, and run_action with the same safety gate and dry-run sandbox as the TypeScript agent. Its canonical JSON output is byte-identical to the TypeScript reference.

How much does AHTML cost?

Nothing. All sixteen @ahtmljs packages and the ahtml Python SDK are MIT-licensed open-source libraries that run inside your own app. There is no SaaS, no per-request pricing, and no lock-in.

Longer answers in the full FAQ and the 2026 comparison.

Roadmap

Where this went, and goes.

1.1 · shipped

Reach the other half

Python SDK on PyPI with byte-identical parsing, the extractor plugin API, and native Astro + SvelteKit adapters.

1.2 · shipped

Ten-minute adoption

ahtml init scaffolds any supported framework; the score badge and agent-traffic insights reward publishing.

1.3 · shipped

Protocol, certified

A language-agnostic conformance corpus with signed attestations, and the AHTML Index so agents can find adopters.

1.4 · shipped

Safe to transact

The dry-run sandbox: agents rehearse priced, irreversible actions and see signed predicted costs before money moves.

The full post-1.0 plan, with acceptance criteria mapped to CI tests, lives in ROADMAP.md.

Ship it

Your next visitor might be Claude.

One command. It detects Next, Astro, SvelteKit, Vite, or Hono and wires everything.

$npx @ahtmljs/cli init
Score your siteCompare to llms.txtNext.js guide
MIT licensed · zero migration · v1.1.0
Made byDibbayajyoti Roy