cd /news/ai-agents/turn-a-website-task-into-an-api-you-… · home › topics › ai-agents › article
[ARTICLE · art-175212] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Turn a website task into an API you can call on rows of input

A Browsa engineer demonstrated a pattern for turning a one-off AI agent website task into a reusable, callable API: the agent runs the task once with a JSON output schema and records the steps as a "recipe," which is then replayed across rows of input to produce consistent typed columns exportable as CSV or JSON. In the example, a single agent run on books.toscrape.com took 11.1 seconds and 7 credits, while replaying the recording across three URLs took 39 seconds at 8 credits per row. The engineer noted recording does not cut per-row cost or speed on simple pages, but guarantees the same output shape and repeats recorded steps instead of re-planning.

recommendation

Record a successful agent run as a recipe with a strict output schema, then replay it across input rows to get consistent typed columns instead of re-planning the task each time.

more in playbook: Designing agent systems
by read2 min views2 publishedNov 24, 2026

Disclosure: I work on Browsa, the cloud browser used here.

An AI agent is good at working out how to do something on a website. It's a waste to have it work it out again for every row of a spreadsheet. The pattern this post shows: let the agent do the task once, record what it did, then replay the recording on each input and get the same typed columns every time.

The example uses books.toscrape.com, a sandbox site made for scraping practice.

import time
from browsa import Client

client = Client()  # reads BROWSA_API_KEY
BOOK = "https://books.toscrape.com/catalogue"

job = client.run_task(
    task="Open the product page and return title, price and in_stock",
    llm="browsa",
    initial_url=f"{BOOK}/sharp-objects_997/index.html",
    output_schema={
        "type": "object",
        "properties": {
            "title": {"type": "string"},
            "price": {"type": "string"},
            "in_stock": {"type": "boolean"},
        },
        "required": ["title", "price", "in_stock"],
    },
    record_recipe=True,
)
print(f"agent run: {job.outcome} in {job.duration_ms / 1000:.1f} s, {job.credits_charged} credits")
print(job.final_result)
agent run: completed in 11.1 s, 7 credits
{"price": "£47.82", "title": "Sharp Objects", "in_stock": true}

Two details matter here:

output_schema: answer column.initial_url: url input of the recording.

robot = client.robots.create(
    name="Book prices",
    from_job_id=job.id,
    inputs=[
        {"url": f"{BOOK}/sharp-objects_997/index.html"},
        {"url": f"{BOOK}/soumission_998/index.html"},
        {"url": f"{BOOK}/tipping-the-velvet_999/index.html"},
    ],
)
t0 = time.time()
run = client.robot_runs.wait(client.robots.run(robot.id).id)
print(f"robot run: {run.status} in {time.time() - t0:.0f} s")
print(client.robot_runs.export(run.id))  # CSV
robot run: completed in 39 s
row,status,error_code,credits,input.url,price,title,in_stock
0,ok,,8,https://books.toscrape.com/catalogue/sharp-objects_997/index.html,£47.82,Sharp Objects,true
1,ok,,8,https://books.toscrape.com/catalogue/soumission_998/index.html,£50.10,Soumission,true
2,ok,,8,https://books.toscrape.com/catalogue/tipping-the-velvet_999/index.html,£53.74,Tipping the Velvet,true

Each row replays the recording on its own URL. The columns are the ones from the schema, and the CSV (or JSON) is ready for a sheet or a database.

A row with an input the recording doesn't take is rejected before anything runs:

client.robots.run(robot.id, inputs=[{"link": f"{BOOK}/soumission_998/index.html"}])
UNKNOWN_INPUT inputs[0]: "link" is not a param of this recipe, so the run would ignore it; its params are "url"

Rows that fail while running are free, too.

A row costs the same credits as the agent task it was recorded from: here, 8 per row. Recording doesn't make a row cheaper, and on a page this simple it isn't faster either (39 s for three rows). What it buys you is the same JSON shape on every row, a typed table you can export, and runs that repeat the recorded steps instead of planning them again.

── more in #ai-agents 4 stories · sorted by recency
── more on @browsa 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/turn-a-website-task-…] indexed:0 read:2min 2026-11-24 · —