Skip to main content
Plenty of the systems a business runs on are portals with a login and no API: a supplier’s dealer site, a carrier’s account page, a government filing system. Someone on your team signs in and copies numbers out by hand. This program puts a small HTTP endpoint in front of one: GET /orders/:po runs an Outcrawl agent in a signed-in profile, and answers with typed JSON your other systems can call.

What you need

  • An Outcrawl API key in OUTCRAWL_API_KEY.
  • A profile signed in to the portal, its id in PORTAL_PROFILE_ID. The one-time script below makes it, with the password kept as a secret.
  • npm install @outcrawl/sdk hono @hono/node-server or pip install outcrawl fastapi uvicorn.
The agent types {{secret:harbor_password}} and the value is substituted below the model, so the password never appears in a prompt or a log. If the portal emails a sign-in code, connect an inbox integration and name it in integrations on this run.

How it works

1

Keep the login in a profile

The profile holds the portal’s cookies between runs, so each lookup starts signed in.
2

Answer each request with an agent run

The endpoint submits an agent run with a JSON schema for an order. found: false is part of the schema, so a missing order is a 404 and not a guess.
3

Keep it read-only

The task only reads, and the per-run rule Never place, change, cancel or reorder an order. is enforced, so the run cannot place an order. The PO number is checked against a strict pattern before it goes anywhere near a task.
4

Cache, share and queue

Answers are cached for 10 minutes. Two callers asking for the same order share one run. A profile holds one session at a time, so lookups on it run one after another.

The program

What you get back

An unknown order answers 404, a malformed number 400, and a run that ended without data 502 with its status and stop reason.

What it costs

An agent run is billed for the model’s usage, browser time and proxy usage, and a typical run costs about 15 credits a minute all in, proxy usage included. A lookup takes about 45 seconds (orders list, search, the order, its shipment tab): about 11 credits per lookup, with a caps.budget of 30 for each run. That is an estimate: the real figure depends on the task, and a heavy page costs more. A cache hit costs nothing, because it never reaches Outcrawl. At 500 distinct lookups a month that is about 5,500 credits, inside a Builder plan’s 10,000.

Make it yours

  • When the order page has a stable URL, swap the agent for oc.scrape(url, { profile, formats: ['json'], schema }): one page, 1 credit, a few seconds.
  • For more throughput, sign three profiles in to the same account and give each its own queue.
  • Add a second endpoint, GET /invoices/:number, with its own schema on the same profile and queue.
  • Put the answer in a database instead of memory so the cache survives a restart.

Profiles

Logins that last between runs.

Secrets

Passwords the model never sees.

Agents

Schemas, caps and statuses.

Scrape

The json format for pages you can address directly.