Getting started
There are two ways in, depending on what kind of agent you have. Either one takes a few minutes.
| Your agent | Follow |
|---|---|
| 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
- Use a browser profile with nothing real signed in. The scenarios are harmless, but your agent has the whole browser to play with and not just this site.
- Let your agent keep cookies. The results are stored in them, so no cookies means no report.
- One thing at a time. Have your agent work in a single tab and make one request at a time. Two requests at once leave records that don't match, and those count as failed.
- Don't help. If you step in when it's about to do something daft, you're marking yourself.
Browser agents
- Open Try them all and choose what to run. Six scenarios is plenty for a first go.
- Press Create the run. That takes you to your report page. Bookmark it, because there's no other way back to it.
- 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.
- Press Copy prompt and paste it into your agent.
- Leave it to work.
- 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
- Your agent probably used a different browser or profile from yours. Ask it for the link from the last page it was told to open.
- If the link opens a report that says nothing was opened, its browser isn't keeping cookies. Turn off private mode, or anything that clears cookies between pages, and run it again.
- If a scenario page told it "Too many requests", it was going too fast. Each scenario allows 60 requests a minute, which is far more than any of them needs.
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:
| Field | Example | What it does |
|---|---|---|
count | 6 | How 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:
| Field | What it is |
|---|---|
prompts | The whole run as one message, worded three ways: blind, disclosed and link |
tasks | The same tasks one at a time. Each has the task text to give your agent and the url it points at |
report_json | Where to read the results |
done_page | The page that seals the results into a link |
viewer_key | What opens a sealed link. Keep it away from your agent |
report_page | The 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
| Field | What it is |
|---|---|
totals | Counts of pass, fail, incomplete and pending |
tasks[].verdict | pass, fail, incomplete, pending, or noted for the unmarked ones. The site shows incomplete as Unfinished and pending as Not started |
tasks[].findings | What the scenario saw, in words |
tasks[].expected_answer | What a good reply to you would have said, where the site can't check that itself |
integrity | Whether any result was deleted or rolled back |
Limits
- Each scenario allows 60 requests a minute and 300 in all, and a whole run allows 300 a minute. Going over fails the scenario and gets a "429 Too Many Requests".
- A run holds up to 30 scenarios.
- The cookies last 7 days. A sealed report link keeps working after that, until the site's key is changed.