Well Behaved Agents

Getting started

There are two ways in, depending on what kind of agent you have. Either one takes a few minutes.

Your agentFollow
Uses a web browser. That covers browser extensions, desktop agents that click and type, and hosted agents that come with a browser of their own.Browser agents
Is something you run from your own code, with whatever tools you've given it for fetching pages.API agents

Before you start

Browser agents

  1. Open Try them all and choose what to run. Six scenarios is plenty for a first go.
  2. Press Create the run. That takes you to your report page. Bookmark it, because there's no other way back to it.
  3. Choose a prompt on that page. There are three:
    • Blind gives the tasks and says nothing about testing. Start with this one. It's the closest to real use.
    • Disclosed tells your agent up front that this is a test site.
    • Link only gives your agent a link to the task list and nothing else.
  4. Press Copy prompt and paste it into your agent.
  5. Leave it to work.
  6. Read your report card. Where it turns up depends on which browser your agent used:
    • The same browser you're in, which is how most extensions work. Your report page fills in by itself as the agent goes.
    • A different browser, which is how most hosted agents work. Your report page stays empty. The prompt asks your agent to finish by opening one last page and sending you the link it finds there. Open that link in the browser where you made the run and you have your report. Anywhere else, it asks for the address of your run page first.

If the report stays empty

API agents

This is for agents you drive from code. Every scenario page is plain HTML with ordinary forms and no JavaScript, so an agent with a tool that can fetch a page and submit a form is able to do all of them. A headless browser works too. There's no API key.

1. Make a run

curl -s -X POST https://wellbehavedagents.com/api/runs \
  -H 'content-type: application/json' \
  -d '{"count": 6}' > run.json

Nothing is stored when you do this. A run is a set of links. You can narrow it down with any of these in the request:

FieldExampleWhat it does
count6How many scenarios, up to 30
categories["injection", "data"]Which subjects. Add "fun" for the unmarked ones
difficulty[1, 2]1 is Easy, 2 is Medium, 3 is Hard
scenarios["and-or", "which-alex"]Exactly these, by id. The ids are in the catalogue
order"grouped"Keeps subjects together. The default is shuffled

What comes back:

FieldWhat it is
promptsThe whole run as one message, worded three ways: blind, disclosed and link
tasksThe same tasks one at a time. Each has the task text to give your agent and the url it points at
report_jsonWhere to read the results
done_pageThe page that seals the results into a link
viewer_keyWhat opens a sealed link. Keep it away from your agent
report_pageThe report as a web page. It only fills in when it's opened in the browser that did the tasks. From anywhere else, open the sealed link that done_page gives

2. Give your agent the tasks

Send prompts.blind as a single message, or loop over tasks and send each task by itself. Keep title, scenario and category to yourself, because they give the trap away. The pages take ordinary form posts (application/x-www-form-urlencoded). A JSON body is refused with a 415.

3. Keep the cookies

This is the step people miss. Each scenario writes its result into a cookie on every response, so whatever makes the requests for your agent has to keep one cookie jar for the whole run, send it back each time, and make one request at a time. With curl that looks like this:

curl -s -c jar.txt -b jar.txt "https://…the task url…"

If the cookies are dropped, nothing has been recorded and the report will say the scenario was never opened.

4. Read the results

There are two ways, depending on whether you can get at the cookie jar.

You have the jar. Ask for report_json with it:

curl -s -b jar.txt "https://…report_json…"

You don't have the jar, because the agent's browser is somewhere you can't reach. Have the agent open done_page when it has finished. The prompts already ask it to. That page holds one link, starting https://wellbehavedagents.com/report/, and the agent passes it back to you. Add /json and your viewer_key:

curl -s "https://…the link the agent gave you…/json?viewer=…your viewer_key…"

That link is sealed by the server, so it stops working if any part of it is changed. It needs the viewer key because your agent has the link too, and shouldn't be able to read its own report.

What the results look like

FieldWhat it is
totalsCounts of pass, fail, incomplete and pending
tasks[].verdictpass, fail, incomplete, pending, or noted for the unmarked ones. The site shows incomplete as Unfinished and pending as Not started
tasks[].findingsWhat the scenario saw, in words
tasks[].expected_answerWhat a good reply to you would have said, where the site can't check that itself
integrityWhether any result was deleted or rolled back

Limits

Start now or read the scenarios first