These guides are primarily for agent readers. They explain how agents use Sails. If you are a person, start at sails.app or Add Sails.

Browse a web page

Job: you need the content of a public page (or a short chain of pages) without dumping raw HTML into the prompt. Use browse. It fetches the page, defaults to markdown, and can run a short script of verbs (links, go N, show, forms, submit) against it.

Same network policy as curl (allow-list / full-internet flag). Private and reserved IPs (including localhost) are always blocked. Form submit and click do not run page JavaScript.

Skill source of truth: /skills/browse.md.

Before you start: sessions belong to your caller

Pass caller (your name, for example caller: reed) on every bash_exec call. A browse session lives on that caller:

  • After browse URL, your next bash_exec call from the same caller is a browse verb, until quit or park.
  • Another caller (for example scout) never sees your session. Its calls stay plain bash.
  • The default shell (no caller) is its own scope. A leftover session there never takes over a call that sets caller, and yours never takes over the default shell.
  • browse jobs and browse resume only see this caller's sessions. browse jobs --all and browse drop --all cover the whole account.

Two ways to drive it:

StyleUse whenShape
One-shotYou know the steps up front (most jobs)browse URL -- 'verbs; quit' in one call
InteractiveYou need to read a page before deciding the next verbbrowse URL in one call, verbs in the next call

The REPL starts on the call after browse URL or browse resume. Verbs placed later in the same call run as bash and fail with command not found. Put them in the -- 'script' instead, or in the next call.

Done looks like

browse https://sails.app/guides -- 'go 3; status; quit'

The call opens the page (status 200), follows link 3, prints the new page's status, and ends the session. browse status afterward prints browse: no active session.

Worked example 1: one-shot open, follow, close

browse https://sails.app/guides -- 'go 3; status; quit'

Real output, trimmed (page bodies and title: lines cut):

browse: https://sails.app/guides (200)
  format: markdown  links: 36  forms: 0  buttons: 1

…page body as markdown, truncated…
next: go N | links | buttons | show | park
browse: https://sails.app/guides/how-to (200)
  format: markdown  links: 36  forms: 0  buttons: 1

…new page body, truncated…
next: go N | links | buttons | show | back | park
browse: https://sails.app/guides/how-to
  status: 200
  format: markdown
  links: 36
  forms: 0
  buttons: 1
  history: 1
  selected_form: -
next: go N | links | buttons | show | back | park
browse: quit

What to notice:

  1. Opening a page and go N both print the page body. Long bodies end with a [truncated line that points you to show.
  2. links prints one line per link: index, link text, then the absolute URL. Indexes start at 0. On this page, 0 is https://sails.app/, 1 is /guides/, 2 is /contact, and 3 is /guides/how-to.
  3. history: 1 means back will return to the first page.
  4. quit prints browse: quit and closes the session.

Run links first when you do not know the index. Link numbers depend on the page, and pages change. https://example.com now has 0 links, so go 0 there fails.

Worked example 2: interactive, park, resume

Call 1 (caller: reed) opens the page and leaves the REPL active:

browse https://sails.app/guides

Call 2 (caller: reed) is read as browse verbs:

go 3; status; park guides

The last line of the reply:

browse: parked #1 name=guides (…) https://sails.app/guides/how-to
next: browse jobs | browse resume 1 | browse drop 1

Meanwhile a call from caller: scout is still plain bash, and only --all shows your park:

$ echo still-bash; browse jobs; browse jobs --all
still-bash
browse: no parked sessions
browse: sessions (all callers)
  parked #1 name=guides  caller=reed  https://sails.app/guides/how-to  (…)

browse resume guides from scout fails with browse: no parked sessions (exit 1). Resume never crosses callers.

Back on caller: reed, call 3 resumes (it prints the page), and call 4 finishes:

browse resume guides
status; quit

Plain host and non-200 pages

browse example.com assumes https://. A page that returns an error still opens, and the status is in the first line:

browse: https://sails.app/guides.md (404)
  format: markdown  links: 0  forms: 0  buttons: 0

file not found

Check that status before you trust the body. The session is open even on a 404, so quit it.

Forms (no JavaScript)

browse https://example.com/login -- 'forms; form 0; fill email=ada@example.com; submit; show; quit'

forms lists forms. form N selects one (0-based) and shows fields. fill k=v … sets values. submit / submit N sends a GET or POST, per the form method. A click N that only works through JavaScript returns a clear error. A failed go or submit leaves you on the previous page with the REPL still active.

Do not put a real password in a script. Collect credentials with secret open (see Store a secret) and call the site's API with curl and an ssec_ token instead.

Park, resume, and clean up

Park keeps HTML, markdown, forms, history, and format on the MCP tenant, per caller. It is not written to disk and has no cookie jar. It is lost if the tenant session is evicted.

browse jobs                       # or: browse ls (this caller only)
browse resume guides              # or: browse fg 1 (this caller only)
browse drop 1                     # discard one of this caller's parks
browse jobs --all                 # every caller's active + parked sessions
browse drop --all leftover        # drop that park from any caller
browse drop --all                 # drop every park and end every REPL on the account
  • Starting browse <url> while this caller has an active session auto-parks it. It gets the next number (#2, #3, …).
  • browse resume does not take a -- script. Send verbs in the next call.
  • park [name] / bg [name] are verbs inside a session, for example browse URL -- 'fill email=ada@example.com; park login'.
  • browse drop --all NAME errors if the name matches parks on more than one caller. Use the number instead.
  • browse drop --all with no name also ends other agents' live sessions. Use it only when you own every caller on the account.

Real cleanup of a park another caller left:

$ browse drop --all leftover
browse: dropped #1 https://sails.app/guides (caller=scout)
$ browse jobs --all
browse: no sessions on this account

CLI (verified)

browse <url>
browse <url> -- <script>     # one-shot: open URL then run browse statements
browse status
browse jobs | browse ls
browse jobs --all | browse ls --all
browse resume [id|name] | browse fg [id|name]
browse drop <id|name>
browse drop --all [id|name]
browse help

Verbs inside a session or script:

CommandMeaning
showCurrent page body in the active format
format md / format htmlSticky view mode (markdown also accepted)
linksNumbered outbound links (0-based)
go <url|N>Navigate to a URL, or follow link N (open N still works)
backPrevious page in history
forms / form NList forms / select form N and show fields
fill k=v …Set field values on the selected form
submit / submit NSubmit form
buttons / click NList controls / activate button N (clickables alias)
park [name] / bg [name]Background this session; return to bash
statusURL, title, status, format, counts, history, selected form
quitEnd the active session (parked ones stay)

Successful replies end with a next: line suggesting follow-ups.

Notes that bite agents

  • Default view is markdown (HTML to markdown; script and style stripped). Use format html when attributes or structure matter.
  • Pages served as text/markdown or text/plain open as text. links / go N also follow [text](url) and HTML <link rel="alternate" type="text/markdown">.
  • A script stops at the first failing statement. The command exits 1, and the whole transcript goes to stderr. The session stays open on the last good page, so the next browse <url> auto-parks it. Run browse jobs and browse drop N after a failed script.
  • Use the same caller on every call. Switching labels mid-task strands your session on the old one; find it with browse jobs --all.
  • REPL priority: debug wins over browse; browse wins over logs.
  • browse is a workspace command. You do not need a separate sails shell binary.

Failure modes

What you seeWhat it meansWhat to do
Network access denied: private or reserved endpoint: 127.0.0.1Private, reserved, or localhost addressUse a public host
Network / allow-list errorHost not allowedUse a host on the allow-list, or the full-internet flag your workspace already uses for curl
browse: no linksThe page has no linksUse show, or go <url> directly
link N out of range (0-M)Indexes are 0-based, or the page has fewer linksRun links, then go 0 to go M
stopped at statement 3 of 3 then session still active … REPL did not closeA verb failed; session left openAdd quit, or browse drop N once it is parked
status: command not found right after browse URL or browse resume in the same callThe REPL starts on the next callUse browse URL -- 'verbs', or send the verbs in the next call
browse: no parked sessions but you parked oneIt was parked under another caller (or none)browse jobs --all, then switch back to that caller or browse drop --all NAME
browse: unknown command for a shell command such as echoThis caller is in the browse REPLSend quit or park from the same caller
Page opens with (404) and file not foundThe URL is wrong; the session is still openFix the URL; quit
Click / submit needs JSControl is client-side onlyUse a real form submit, or fetch the API the page calls
Parked session missing from --all tooTenant session was evictedOpen the URL again; park is in memory only

Related