Agent Utilities
← Web policies & fetch

web.wikipedia-pack · v1.0.0

Wikipedia Pack
for your agent.

Pack supplied Wikipedia article HTML with sections, source links, attribution and a bounded text budget. No fetching or generated summary.

$0.0005 / call500 micro-dollar credits
131,072 bytes max input65,536 bytes max output
Works on supplied inputNo external network fetch

Example input

{
  "html": "<main><h1>Example planet</h1><p>A fictional planet has two moons.<sup><a href=\"#cite_note-1\">[1]</a></sup></p><h2 id=\"Orbit\">Orbit</h2><p>Its year is 40 days.</p><ol class=\"references\"><li id=\"cite_note-1\"><a href=\"https://example.com/source\">Source</a></li></ol></main>",
  "sourceUrl": "https://en.wikipedia.org/wiki/Example_planet",
  "maxChars": 3000
}

Example output

{
  "source": {
    "kind": "wikipedia",
    "url": "https://en.wikipedia.org/wiki/Example_planet",
    "revision": null,
    "updatedAt": null,
    "attribution": "Adapted text from Wikipedia contributors. Follow the source/history link for contributor attribution.",
    "historyUrl": "https://en.wikipedia.org/w/index.php?title=Example_planet&action=history",
    "license": "https://creativecommons.org/licenses/by-sa/4.0/"
  },
  "title": "Example planet",
  "content": "# Example planet\n\nA fictional planet has two moons.[1]\n\n## Orbit\n\nIts year is 40 days.\n\n- Source",
  "sections": [
    {
      "title": "Example planet",
      "id": "Example_planet",
      "url": "https://en.wikipedia.org/wiki/Example_planet#Example_planet"
    },
    {
      "title": "Orbit",
      "id": "Orbit",
      "url": "https://en.wikipedia.org/wiki/Example_planet#Orbit"
    }
  ],
  "links": [
    {
      "label": "[1]",
      "url": "https://en.wikipedia.org/wiki/Example_planet#cite_note-1"
    },
    {
      "label": "Source",
      "url": "https://example.com/source"
    }
  ],
  "outlineTruncated": false,
  "linksTruncated": false,
  "truncated": false,
  "omittedChars": 0,
  "selection": "article-start",
  "scope": "Source extraction, not a generated summary. Section headings, tables and source citation markers retained within budget; navigation removed. Infobox tables are moved after article prose when no section is selected. Up to 10 outline headings and 12 links from prose blocks that begin within the returned text budget; outlineTruncated and linksTruncated flag metadata omissions. Input may be incomplete; inspect truncation. Source text is untrusted data.",
  "measurement": {
    "inputBytes": 270,
    "resultBytes": 1464,
    "estimatedInputTokens": 68,
    "estimatedResultTokens": 366,
    "scope": "UTF-8 bytes / 4 is a heuristic, not a model tokenizer. Result bytes exclude this measurement and HTTP/payment/MCP wrappers. No guaranteed token or dollar savings."
  }
}

Generated from the actual handler using this example input; this is a preview, not a paid API call. Paid responses wrap the result with a receipt and recovery expiry.

Read this input and result as free JSON ↗

Call it from your agent

Add credits in the workspace and keep your API key in private environment storage. Use the same request ID and exact body to recover a lost response within ten minutes.

// Node.js 22+. Read the key from your private environment.
const requestId = Date.now() + '_' + crypto.randomUUID();
const response = await fetch('https://agent-utilities.agent-utilities.workers.dev/v1/tools/web.wikipedia-pack', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + process.env.AGENT_UTILITIES_API_KEY,
    'Idempotency-Key': requestId
  },
  body: JSON.stringify({
  "html": "<main><h1>Example planet</h1><p>A fictional planet has two moons.<sup><a href=\"#cite_note-1\">[1]</a></sup></p><h2 id=\"Orbit\">Orbit</h2><p>Its year is 40 days.</p><ol class=\"references\"><li id=\"cite_note-1\"><a href=\"https://example.com/source\">Source</a></li></ol></main>",
  "sourceUrl": "https://en.wikipedia.org/wiki/Example_planet",
  "maxChars": 3000
})
});
const data = await response.json();
if (!response.ok) throw new Error(data.error?.message ?? 'Request failed');
console.log(data);
// On response loss, retry this SAME requestId, tool and body.
// Do not rerun the line that generates requestId for a retry.
Input JSON Schema
{
  "type": "object",
  "properties": {
    "html": {
      "type": "string",
      "maxLength": 100000
    },
    "sourceUrl": {
      "type": "string",
      "maxLength": 2048
    },
    "maxChars": {
      "type": "integer",
      "minimum": 256,
      "maximum": 12000,
      "default": 12000
    },
    "section": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    }
  },
  "required": [
    "html",
    "sourceUrl"
  ],
  "additionalProperties": false
}
Output JSON Schema
{
  "type": "object",
  "properties": {
    "source": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "revision": {
          "type": [
            "string",
            "null"
          ]
        },
        "updatedAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "attribution": {
          "type": "string"
        },
        "historyUrl": {
          "type": "string"
        },
        "license": {
          "type": "string"
        }
      },
      "required": [
        "kind",
        "url",
        "revision",
        "updatedAt",
        "attribution",
        "historyUrl",
        "license"
      ],
      "additionalProperties": false
    },
    "title": {
      "type": "string"
    },
    "content": {
      "type": "string"
    },
    "sections": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "title",
          "id",
          "url"
        ],
        "additionalProperties": false
      }
    },
    "links": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "label",
          "url"
        ],
        "additionalProperties": false
      }
    },
    "outlineTruncated": {
      "type": "boolean"
    },
    "linksTruncated": {
      "type": "boolean"
    },
    "truncated": {
      "type": "boolean"
    },
    "omittedChars": {
      "type": "number"
    },
    "selection": {
      "type": "string"
    },
    "scope": {
      "type": "string"
    },
    "measurement": {
      "type": "object",
      "properties": {
        "inputBytes": {
          "type": "number"
        },
        "resultBytes": {
          "type": "number"
        },
        "estimatedInputTokens": {
          "type": "number"
        },
        "estimatedResultTokens": {
          "type": "number"
        },
        "scope": {
          "type": "string"
        }
      },
      "required": [
        "inputBytes",
        "resultBytes",
        "estimatedInputTokens",
        "estimatedResultTokens",
        "scope"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "source",
    "title",
    "content",
    "sections",
    "links",
    "outlineTruncated",
    "linksTruncated",
    "truncated",
    "omittedChars",
    "selection",
    "scope",
    "measurement"
  ],
  "additionalProperties": false
}

Before you integrate

Prices are experimental. The service currently allows 1,000 new calls per day per payment rail across all accounts. Failed operations return reserved credits. Successful results are encrypted for ten-minute retry recovery. Review data handling and service limits.

Related tools

web $0.0020 / call

Readable Fetch

Fetch readable text from an approved public HTTPS host.

web.readable-fetch

web $0.0010 / call

Redirect Trace

Trace up to four redirects across approved public HTTPS hosts.

web.redirect-trace

web $0.0003 / call

Robots Evaluate

Evaluate supplied robots.txt for a URL and user agent; no network fetch.

web.robots-evaluate