๐Ÿ› ๏ธ Tools API Reference

The agent's hands. Web search, page scraping, browser automation, and sandboxed code execution. Everything an agent needs to interact with the outside world.

๐Ÿ”‘ Base URL: https://api.agenttool.dev ยท All endpoints require Authorization: Bearer YOUR_API_KEY

๐Ÿ“ Note on paths: The doubled path segments (e.g. /v1/search/search) are intentional โ€” the first segment is the tool category, the second is the action.

POST /v1/scrape/scrape

Extract clean, structured content from a URL. Returns the page text, metadata, and optionally specific CSS selectors. Handles JavaScript-rendered pages.

๐Ÿ”’ Bearer token required

Request Body

FieldTypeRequiredDescription
url string required The page URL to scrape.
selectors string[] optional CSS selectors to extract specific elements (e.g. ["h1", ".price"]).
format string optional Output format: "text", "markdown", or "html". Default: "markdown".
wait_for string optional CSS selector to wait for before extracting (for JS-rendered content).
curl
curl -X POST https://api.agenttool.dev/v1/scrape/scrape \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/pricing",
    "selectors": [".plan-name", ".plan-price"],
    "format": "markdown"
  }'
SDK
const page = await at.tools.scrape("https://example.com/pricing", {
  selectors: [".plan-name", ".plan-price"],
  format: "markdown"
})

Response ยท 200

JSON
{
  "url": "https://example.com/pricing",
  "title": "Pricing โ€” Example",
  "content": "# Pricing\n\n## Starter\n$9/mo\n\n## Pro\n$29/mo",
  "extracted": {
    ".plan-name": ["Starter", "Pro", "Enterprise"],
    ".plan-price": ["$9/mo", "$29/mo", "Custom"]
  },
  "status_code": 200
}
POST /v1/browse/browse

Full browser automation. Navigate to a URL, interact with elements, take screenshots, and extract content from JavaScript-heavy pages. Uses a managed headless browser.

๐Ÿ”’ Bearer token required

Request Body

FieldTypeRequiredDescription
url string required URL to navigate to.
actions object[] optional Sequence of browser actions (click, type, scroll, wait, screenshot).
screenshot boolean optional Return a base64 screenshot. Default: false.
extract_content boolean optional Return the page text content. Default: true.
timeout_ms integer optional Max wait time in milliseconds. Default: 30000.
curl
curl -X POST https://api.agenttool.dev/v1/browse/browse \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/dashboard",
    "actions": [
      {"type": "click", "selector": "#login-btn"},
      {"type": "type", "selector": "#email", "text": "agent@example.com"},
      {"type": "click", "selector": "#submit"}
    ],
    "screenshot": true
  }'
SDK
const result = await at.tools.browse("https://example.com/dashboard", {
  actions: [
    { type: "click", selector: "#login-btn" },
    { type: "type", selector: "#email", text: "agent@example.com" },
    { type: "click", selector: "#submit" }
  ],
  screenshot: true
})

Response ยท 200

JSON
{
  "url": "https://example.com/dashboard",
  "final_url": "https://example.com/dashboard/home",
  "title": "Dashboard โ€” Example",
  "content": "Welcome back! You have 3 new notifications...",
  "screenshot": "data:image/png;base64,iVBORw0KGgo...",
  "actions_completed": 3,
  "status_code": 200
}
POST /v1/execute/execute

Execute code in a sandboxed environment. Supports Python and JavaScript. Each execution gets a fresh, isolated container with a 30-second timeout.

๐Ÿ”’ Bearer token required

Request Body

FieldTypeRequiredDescription
code string required The code to execute.
language string required "python" or "javascript".
timeout_seconds integer optional Max execution time. Default: 30, max: 60.
env object optional Environment variables available during execution.
curl
curl -X POST https://api.agenttool.dev/v1/execute/execute \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "import json\ndata = {\"hello\": \"world\", \"count\": 42}\nprint(json.dumps(data, indent=2))",
    "language": "python"
  }'
SDK
const result = await at.tools.execute(`
import json
data = {"hello": "world", "count": 42}
print(json.dumps(data, indent=2))
`, { language: "python" })

Response ยท 200

JSON
{
  "stdout": "{\n  \"hello\": \"world\",\n  \"count\": 42\n}\n",
  "stderr": "",
  "exit_code": 0,
  "execution_time_ms": 142,
  "language": "python"
}

Execution Errors

If the code raises an exception or syntax error, you'll still get a 200 response โ€” but exit_code will be non-zero and stderr will contain the error message. Check exit_code to determine success.

Error Reference

401 ยท Unauthorized

Missing or invalid API key.

422 ยท Validation Error

Request body is invalid. Common causes: missing url for scrape/browse, missing code or language for execute, unsupported language value.

408 ยท Timeout

The operation exceeded the timeout. For browse/scrape, try increasing timeout_ms. For execute, check for infinite loops.

429 ยท Rate Limited

Too many requests. Tools are rate-limited per agent to prevent abuse. Back off and retry.