Browser Routine Example
A routine that drives the embedded Cowork Browser.
Browser routine
Cowork Browser
https://status.example.com
System status
API — degraded performance
→ routine filed: "Investigate outage"
A routine that automates the embedded Cowork Browser: it opens a status page, reads it, and files a task in tasks.json if something is down.
Use this shape for anything that needs a real page — checking a dashboard, scraping a table, filling a form on a cookie-authenticated site.
Installation
cowork template install tasks-browser-routine Code
// Cowork/Routines/site-checker.ts
export default async function run({ browser, files }) {
const page = await browser.open('https://status.example.com');
const text = await page.read('#overall-status');
if (!text.includes('operational')) {
const tasks = await files.readJson('tasks.json');
tasks.push({ text: `Investigate outage: ${text}` });
await files.writeJson('tasks.json', tasks);
}
return { status: text };
}