Use case

Agent-safe web fetching

Fetch public webpages through SSRF guardrails and return clean markdown extraction plus prompt-injection risk signals before an agent summarizes, reasons, or calls another tool.

Problem

Agents should not ingest raw webpage content blindly. Pages can be huge, malformed, blocked, adversarial, or filled with instructions aimed at the model rather than the human reader.

Who needs it

  • Browser-agent builders that need a safe web fetch API for AI agents.
  • Research and summarization agents that need clean text before downstream reasoning.
  • Tool-using agents that need an SSRF guard and bounded external content handling.

When an agent should use it

  • Before summarization, browsing, research, citation gathering, or downstream tool calls.
  • When the caller needs readable markdown, content hashes, and prompt-injection risk signals from a public URL.

Relevant Primitive402 tool

Fetches a public URL, extracts clean readable markdown, and flags prompt-injection patterns before an AI agent reads it.

Primitive402 toolsafe_fetch_url
Local routePOST /v1/safe-fetch-url
x402 routePOST /x402/v1/safe-fetch-url
MCP tool namesafe_fetch_url
SDK methodsafeFetchUrl()
Price$0.01 USDC on Base Sepolia testnet during public beta

curl example

curl -s https://primitive402.dev/v1/safe-fetch-url \
  -H 'content-type: application/json' \
  -d '{
  "url": "https://example.com",
  "output": "markdown"
}' | jq

TypeScript SDK example

import { createNano402Client } from "@nano402/api/sdk";

const client = createNano402Client({
  baseUrl: "https://primitive402.dev"
});

const result = await client.safeFetchUrl({
  "url": "https://example.com",
  "output": "markdown"
});
console.log(result);

Example JSON response

{
  "finalUrl": "https://example.com",
  "cleanMarkdown": "# Example Domain\n\nThis domain is for use in examples.",
  "contentHash": "sha256:...",
  "riskLevel": "low",
  "detectedInjectionPatterns": []
}

Useful search terms

agent-safe web fetching, safe web fetch API for AI agents, clean markdown extraction, SSRF guard, prompt-injection risk signals

Safety and limitations

Primitive402 does not guarantee content safety, factual truth, legal validity, purchase correctness, or policy completeness. External content is untrusted, low-confidence results may still be valid analysis signals, and high-stakes decisions need human review.

Related docs