cloudflare-agent-proxy
v1.0.0
Published
Cloudflare Worker proxy for the agent:// protocol
Readme
Cloudflare Agent Proxy
A Cloudflare Worker that acts as a global edge proxy/gateway for the agent:// protocol. Resolves agent domains via the AGENIUM DNS system and proxies requests to the resolved endpoints.
Features
- Edge Routing —
worker-url/agent://name.tld/path→ resolved agent endpoint - DNS Caching — Cloudflare KV-based cache with TTL from DNS responses
- Agent Discovery — Fetch agent cards at
/discover/name.tld - Rate Limiting — Per-IP rate limiting (configurable)
- CORS — Configurable CORS headers
Endpoints
| Route | Description |
|-------|-------------|
| /agent://name.tld/path | Proxy request to resolved agent |
| /resolve/name.tld | Resolve domain, return endpoint info |
| /discover/name.tld | Fetch agent card (/.well-known/agent.json) |
| /health | Health check |
Setup
1. Install dependencies
npm install2. Create KV namespace
npx wrangler kv:namespace create AGENT_DNS_CACHE
npx wrangler kv:namespace create AGENT_DNS_CACHE --previewUpdate wrangler.toml with the returned namespace IDs.
3. Configure (optional)
Edit wrangler.toml vars:
[vars]
DNS_SERVER = "https://dns.agenium.net"
RATE_LIMIT_PER_MINUTE = "60"
CORS_ORIGINS = "*"4. Develop locally
npm run dev5. Deploy
npm run deployUsage
# Proxy a request to an agent
curl https://your-worker.workers.dev/agent://weather.agent/forecast?city=london
# Resolve an agent domain
curl https://your-worker.workers.dev/resolve/weather.agent
# Discover agent capabilities
curl https://your-worker.workers.dev/discover/weather.agentDomain Registration
Supports optional domain registration on the Agenium DNS system using a marketplace API key (dom_<64 hex>). Pass api_key parameter to auto-register your agent on startup. Get your API key from the Telegram Domain Marketplace.
License
MIT
