How to connect Playwright to Toolspoke
Let your Toolspoke agents open websites in a headless Chromium: read pages, extract data, click, fill forms and inspect console and network traffic. It runs in Toolspoke's hosted sandbox, with nothing to install and no credential.
Checked against Playwright's documentation on 2026-11-25.
Toolspoke's Playwright toolkit runs Microsoft's Playwright browser automation for you, with a headless Chromium, in Toolspoke's hosted sandbox. An agent can read a page's structure, click, type and see what the page loaded. Nothing runs on your machine, and there's no Node.js or browser to install. Once it's installed, any agent in the project can use it.
This guide covers what the hosted browser can and can't reach, which actions change things on the websites an agent visits, and an agent worth building with it.
Why a hosted browser
The browser runs in Toolspoke's hosted sandbox, not on anyone's machine. That's useful when:
- a team should share one setup and one set of rules about which actions are allowed;
- you want every page an agent opened and every form it filled recorded in an audit log;
- you'd rather a website saw a server in a data centre than your own browser and IP address.
Microsoft states that its Playwright automation is not a security boundary. Running it in an isolated sandbox, away from your files and your network, is one way to keep it at arm's length.
What an agent can do once it's connected
The toolkit has 9 named actions. Six only read:
open_pageopens a URL and returns the page's accessibility snapshot: headings, links, buttons and form fields, with the references needed to act on them. Start here.find_on_pageopens a URL and returns only the parts of the snapshot that match some text or a regular expression. It's much smaller thanopen_pagewhen you know what you're after.extract_textreturns the page's rendered text, optionally for one CSS selector. It works for content that only appears after JavaScript runs.evaluateruns a JavaScript function inside the page and returns its result. Use it to pull structured data out of the DOM.console_messagesreturns the console output the page produced. It's quick for finding JavaScript errors.network_requestslists the requests the page made, with status codes. Static assets are left out unless you ask, so it shows you the JSON APIs a page calls.
Three can change things on the website:
| Action | What it does | Kind |
|---|---|---|
click | Opens a URL, clicks one element and returns the resulting page | Write |
fill_form | Opens a URL, fills fields and optionally submits | Write |
run_flow | Opens a URL and runs a sequence of steps in one browser session | Write |
A click can place an order, post a comment or delete a record, depending on the site. That's why these are writes.
What you need
- A Toolspoke workspace, and a project to install the toolkit in.
- Public websites to visit. The hosted browser can't reach private-network addresses (see below).
What runs where
This replaces the vendor setup steps other guides have. Read it before you rely on the toolkit.
A new browser for every call. Each action starts Chromium, opens the URL, does its work and closes. Nothing carries over: no cookies, no login, no open tab. So two click calls in a row don't continue from each other. For anything with more than one step, such as dismiss a cookie banner, search, then open a result, the agent uses run_flow, which runs every step in one session.
Text, not pictures. The toolkit returns accessibility snapshots, text and data. It doesn't return screenshots.
Timeouts. A page gets 25 seconds to load, and each action gets 8 seconds. The window is 1280 × 800.
Network. The sandbox reaches the public internet. It can't reach private or loopback addresses. So http://localhost:3000 means the sandbox itself, not your laptop, and your intranet, staging behind a VPN, and 192.168.… addresses are all out of reach. Use a public preview URL for those.
User agent. The browser sends Chromium's default User-Agent. You can override it when you install the toolkit.
Step 1: Install the Playwright toolkit in Toolspoke
- In Toolspoke, open the project your agents work in. Find Playwright in the marketplace and add it.
- Leave User agent blank unless a site needs a particular one.
open_page answered. The credential works.
There's no credential. Adding Playwright gives the project a sandbox image with Chromium in it. Toolspoke checks it by opening https://example.com.
Step 2: Decide what agents may do on websites
In the project's toolkit settings, Playwright's actions are grouped as read, write and destructive. Each one can be switched on or off for everyone in the project. An action that's switched off can't be called, whatever the prompt says.
A sensible start: leave the six reads on and switch off click, fill_form and run_flow. Agents can then read, search and inspect any public page, but they can't press anything. Switch run_flow on when you need multi-step flows, and keep an eye on the audit log at first.
Playwright actions in your project
Agents can call 6 of 9, and none of them change anything.
open_pageOpen a URL and return the page's accessibility snapshot: headings, links, buttons and form fields with the selectors needed to interact with them.find_on_pageOpen a URL and search its accessibility snapshot for text or a regular expression, returning only the matching nodes with a few lines of context.extract_textOpen a URL and return its rendered text content, optionally scoped to one CSS selector.evaluateOpen a URL and run a JavaScript function inside the page, returning its result.console_messagesOpen a URL and return the browser console output it produced, newest last.network_requestsOpen a URL and list the network requests the page made, with status codes.
clickOpen a URL, click one element and return the resulting page snapshot.fill_formOpen a URL, fill one or more fields and optionally submit, then return the resulting page snapshot.run_flowOpen a URL and run an ordered sequence of interactions in one browser session, then return the final snapshot.
Never give an agent a password just because a form asks for one. Without one, fill_form has nothing to log in with.
Every call is recorded with the agent and person behind it, the request, the response, the status and the duration.
Step 3: Build an agent that uses it
In Toolspoke, create an agent and describe its job in one sentence. The builder proposes the instructions, the toolkits it needs, a schedule and where it should answer. You add or skip each one, then create the agent. Every piece stays editable afterwards.
It only reads, so it fits the actions left on in step 2. The same agent answers when someone asks it in Slack or emails it, and it replies in the thread it was asked in.
Try it
Ask the agent in Slack, by email or in its chat:
- Open https://news.ycombinator.com and list the top 10 stories with their links.
- On our public pricing page, find every mention of 'per seat'.
- Extract the text of the main article at this URL, without the navigation.
- Which JSON APIs does https://example.com/search call when it loads? Show the status codes.
- Open our marketing site and tell me if it logs any JavaScript errors to the console.
- Go to the docs site, accept the cookie banner, search for 'webhooks' and open the first result.
The last one needs run_flow switched on. The Playwright toolkit page lists every action.
Troubleshooting
It can't open localhost or an internal address.
The browser runs in Toolspoke's sandbox, which can't reach private or loopback addresses. Use a public preview URL instead.
A second click "forgot" the first one.
Every call starts a fresh browser. Use run_flow to chain steps.
Navigation timed out.
The page took longer than 25 seconds to load. Try a lighter URL, or extract_text with a selector.
An element couldn't be found.
Take references from a fresh open_page or find_on_page, or use a CSS selector. References from an earlier call can go stale when the page changes.
The site blocks the browser or shows a CAPTCHA.
Some sites refuse automated or data-centre traffic. Try the site's API instead.
Questions
Does the agent see my browser, cookies or saved passwords?
No. The hosted browser is a fresh Chromium in the sandbox with nothing of yours in it.
Can it take screenshots or download files?
No. It returns page snapshots, text, script results, console output and network requests.
Which Playwright version does it run?
The one Toolspoke has pinned for the toolkit. It may lag behind Microsoft's latest release.