Agent Utilities
← HTML & pages

html.images · v1.0.0

Images
for your agent.

Extract up to 200 image URLs, alt text and source attributes; does not fetch images.

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

Example input

{
  "html": "<img src=\"/cup.png\" alt=\"Blue cup\" width=\"200\">",
  "baseUrl": "https://example.com/"
}

Example output

{
  "images": [
    {
      "url": "https://example.com/cup.png",
      "alt": "Blue cup",
      "width": "200",
      "height": "",
      "srcset": "",
      "loading": ""
    }
  ],
  "total": 1,
  "truncated": false,
  "scope": "Image markup only; srcset is returned verbatim and remote images are not fetched."
}

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.

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/html.images', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + process.env.AGENT_UTILITIES_API_KEY,
    'Idempotency-Key': requestId
  },
  body: JSON.stringify({
  "html": "<img src=\"/cup.png\" alt=\"Blue cup\" width=\"200\">",
  "baseUrl": "https://example.com/"
})
});
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
    },
    "baseUrl": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2048
    }
  },
  "required": [
    "html"
  ],
  "additionalProperties": false
}
Output JSON Schema
{
  "type": "object",
  "properties": {
    "images": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "alt": {
            "type": [
              "string",
              "null"
            ]
          },
          "width": {
            "type": "string"
          },
          "height": {
            "type": "string"
          },
          "srcset": {
            "type": "string"
          },
          "loading": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "alt",
          "width",
          "height",
          "srcset",
          "loading"
        ],
        "additionalProperties": false
      }
    },
    "total": {
      "type": "number"
    },
    "truncated": {
      "type": "boolean"
    },
    "scope": {
      "type": "string"
    }
  },
  "required": [
    "images",
    "total",
    "truncated",
    "scope"
  ],
  "additionalProperties": false
}

Before you integrate

Prices are experimental. The service currently allows 1,000 new calls per day 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

html $0.0005 / call

Main Text

Extract article text from supplied HTML.

html.main-text

html $0.0003 / call

JSON-LD

Parse up to 50 JSON-LD blocks from supplied HTML.

html.jsonld

html $0.0005 / call

Tables

Extract source table cells without expanding spans.

html.tables