DEV Community

nanoempireai
nanoempireai

Posted on

How to Make Your FastAPI App Discoverable by AI Agents

How to Make Your FastAPI App Discoverable by AI Agents

Your FastAPI app works perfectly for humans. But AI agents can't find it.

Here's why: agents don't browse Google or read your landing page. They crawl
specific machine-readable files that tell them what your API does, what it costs,
and how to pay you.

If those files don't exist, agents skip you entirely — even if your API is better
than the competition.

What Agents Look For

When an autonomous agent needs a service (parse a document, check the weather,
translate text), it searches three things:

1. llms.txt — Your API's Resume

This file sits at yourdomain.com/llms.txt and tells agents what you offer:

# My API

## Services
- Document Parser: Convert PDFs to Markdown
  Price: Free 5/day, $0.01/call after
  Endpoint: POST /api/parse
Enter fullscreen mode Exit fullscreen mode

Without this file, agents have no idea you exist.

2. agents.json — Structured Offers

Schema.org formatted JSON that frameworks like LangChain parse:

{
  "@context": "https://schema.org",
  "@type": "Service",
  "name": "Document Parser",
  "offers": {"price": "0.01", "priceCurrency": "USD"},
  "EntryPoint": {"urlTemplate": "https://myapi.com/api/parse"}
}
Enter fullscreen mode Exit fullscreen mode

3. Payment Support (x402)

Agents won't fill out signup forms. They need to pay programmatically via
the x402 protocol (HTTP 402 + USDC on Base).

The flow: your API returns HTTP 402 with a payment challenge → the agent pays
in USDC (gasless) → retries with a signed receipt → gets the response.

Implementation Checklist

  • Create /llms.txt at your domain root
  • Add /agents.json with schema.org Service entries
  • Add x402 middleware to your endpoints
  • Submit to Smithery.ai and Glama.ai registries
  • Set up a proof chain so buyers can verify your reliability

The Free Tier Trick

You don't need crypto payments to start. Offer 5 free calls per day per IP.
Agents will discover you, test you, and come back when they need more.
Add x402 when volume justifies it.

SDK That Does It All

pip install nano-empire-tollbooth

from nano_empire_tollbooth import monetize

@monetize(price_usd=0.05)
def parse_diagram(content: str) -> str:
    return my_parsing_logic(content)
Enter fullscreen mode Exit fullscreen mode

Live proof chain: https://api.nanoempireai.com/proof/summary
SDK: https://pypi.org/project/nano-empire-tollbooth/

Top comments (0)