DEV Community

sumeet saraf
sumeet saraf

Posted on

AMTP: HTTP for the Agentic Web — A New Markdown-First Protocol for AI Agents

The web was built for humans. But AI agents are struggling with it.

AMTP agent markdown transfer protocol

Traditional approaches — DOM parsing, headless browsers, or forcing LLMs to read raw HTML — are brittle, expensive, and token-heavy.

Today, I'm open-sourcing AMTP (Agent Markdown Transfer Protocol) — a new protocol designed as HTTP for the Agentic Web.

The Problem

AI agents today face several major challenges when interacting with websites:

  • Extremely high token usage when processing full HTML pages
  • Brittle scraping that breaks with any UI change
  • No native action support — agents must simulate clicks and forms
  • Poor session handling for authenticated actions
  • Lack of real-time updates

We need a better way.

Introducing AMTP

AMTP allows websites to serve clean, semantic Markdown optimized for Large Language Models and autonomous agents, alongside their normal HTML and JSON responses.

It uses content negotiation (Accept: text/amtp) so one backend can serve all three consumers: browsers, APIs, and agents.

Key Features

  • ~90% fewer tokens compared to HTML
  • Native actions, forms, and navigation (hypermedia style)
  • Built-in session & authentication bridging (works with your existing Passport, JWT, etc.)
  • Streaming support for real-time updates
  • Security-first design with scopes and validation
  • Easy integration via Express/Fastify middleware

How It Works

Here's a quick example using the AMTP middleware:

import { amtp } from '@amtp/protocol';
import express from 'express';

const app = express();

app.use(amtp({
  // Define what agents can see and do
  routes: {
    '/dashboard': {
      title: "User Dashboard",
      content: "Welcome back, {{user.name}}",
      actions: [
        {
          name: "view_orders",
          label: "View My Orders",
          href: "/orders",
          method: "GET"
        }
      ]
    }
  }
}));
Enter fullscreen mode Exit fullscreen mode

From the agent side, the response is clean Markdown with embedded action metadata — perfect for LLMs to understand and act upon.

Real-World Use Cases

  • Agent-native SaaS platforms (Let users say “cancel my subscription” to their AI assistant)
  • E-commerce agents that can reliably browse and purchase
  • Personal automation agents that work with your existing logged-in sessions
  • Multi-agent workflows across different websites
  • Efficient crawling and indexing

Comparison

Feature Raw HTML JSON API AMTP
Token Efficiency Poor Good Excellent
Action Support None Manual Native
Session/Auth Bridging Hard Medium Built-in
LLM Readability Poor Medium Excellent
Streaming Difficult Possible Native

Getting Started

npm install @amtp/protocol
Enter fullscreen mode Exit fullscreen mode

Visit the repository for:

  • Full protocol specification
  • Grammar and examples
  • Client SDK
  • Reference implementations

GitHub: https://github.com/sumeetingenuity/amtp

The Vision

AMTP is an early but functional step toward a truly agent-ready web — where any website can become natively compatible with AI agents without sacrificing control or security.

I’d love your feedback, contributions, and real-world use cases.

What’s the biggest pain point you face when building agents that interact with websites?

Top comments (0)