Stop paying for browser sessions you forgot to close

Every evening, find the cloud browsers left running by crashed or half-finished jobs, shut them down, and post the count to Slack.

Deterministic Code
KernelGoogle SheetsSlackEngineeringOperationsNotifications & Alerts
PromptCreate

Every day at 6pm, on a cron trigger, sweep my Kernel account for browser sessions that were left running and reclaim them before they cost me money and block new work. This is a fully deterministic workflow: list, filter by age, delete, log, format, post. There is no judgement step anywhere, so build it as a code workflow.

Start by calling Kernel's List Browser Sessions, filtered to running sessions. Page through the results rather than reading only the first page, so an account with many sessions is fully covered.

For each running session, work out its age by comparing its creation timestamp to the current time. If a session is older than the age threshold, which should default to 60 minutes and be exposed as a configurable value, call Delete Browser Session for that session id. Leave anything younger than the threshold alone, since those are most likely legitimate in-flight runs.

For every session reclaimed, append one row to a Google Sheets audit log using Append Values. Each row should carry the session id, the session name, the age at reclaim in minutes, and the timestamp of the sweep. Append to the same tab every night so the log accumulates. This log is the point of the workflow as much as the deletions are: it is what lets someone notice that one particular job leaks a session every single night, which is the actual root cause worth fixing.

Finish by sending a Slack message with Send a Message to a configured channel, containing three numbers: how many sessions are still running after the sweep, how many were reclaimed, and how many were swept in total. Post this message on every run, including clean runs where nothing was reclaimed, so the team can see the sweep is alive rather than silently broken.

Keep the age threshold and the Slack channel as the two obvious knobs to change, defined clearly at the top of the workflow. The target spreadsheet and tab for the audit log should be configurable too. If a delete call fails for one session, log it and carry on with the rest rather than aborting the whole sweep, and reflect the failure in the counts.

What does this prompt do?

  • Checks your Kernel account every evening for browser sessions that are still running
  • Closes any session that has been open longer than your chosen cutoff, which starts at one hour
  • Records every session it closed in a Google Sheet, so you can spot the job that leaks one every single night
  • Posts a short Slack update with three numbers: still running, reclaimed, and total checked, even when nothing needed closing

What do I need to use this?

  • A Kernel account where your browser automations run
  • A Google account and a spreadsheet to use as the audit log
  • A Slack workspace and a channel for the nightly update

How can I customize it?

  • Change the age cutoff. One hour is the starting point. Raise it if your jobs legitimately run long, lower it if browsers should never linger.
  • Pick which Slack channel gets the nightly update, and who should be watching it.
  • Change the run time, or point the audit log at a different spreadsheet or tab.

FAQs

Will this close browsers that are still doing real work?
Only sessions older than your cutoff get closed. Anything started recently is left alone. If some of your automations genuinely run for hours, set the cutoff above their longest normal run and they will never be touched.
What happens on a night when nothing needs closing?
You still get the Slack message with the counts. That is deliberate. If the update always arrives, then silence means the sweep itself has stopped working rather than meaning everything is fine.
Why bother keeping a spreadsheet log?
Over a few weeks the log shows patterns. If the same automation shows up in it every night, you have found the job that never cleans up after itself, and fixing that job is the real solution.
Do I need to be on a paid plan for this to be worth it?
No. It works with whatever plan you are on, and it tends to pay for itself fastest on smaller accounts, where even a few forgotten browsers make a visible difference.
Can I run the sweep more than once a day?
Yes. Evening is a sensible default because it catches the whole day in one pass, but you can run it hourly if forgotten sessions are a frequent problem for your team.

Related templates

Auto-fix your calendar when a flight slips, and flag what's at risk

When your flight moves, your calendar times get corrected automatically and you get a Slack note naming the meetings you're about to miss.

Google Calendar
AviationStack
Slack
Agentic Task
Trace phishing emails to the sending IP and report abuse

Every 15 minutes, forwarded phishing reports get traced back to the server that really sent them, with a verdict in Slack and the worst senders reported.

AbuseIPDB
Gmail
Slack
Agentic Task
Weekly Amazon S3 bucket security audit posted to Slack

Every Monday, check every S3 bucket for public exposure, missing encryption and weak backup settings, then get the risks ranked in Slack.

Amazon S3
Slack Bot
Google Sheets
Agentic Task
Turn procurement portal tenders into CRM deals each morning

Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.

Anchor Browser
Google Sheets
HubSpot
+1
Agentic Task
Draft polite follow-ups for emails that never got a reply

Every weekday at 4pm, spot the threads that went quiet, stage a ready-to-send nudge in your mailbox, and get a ranked Slack recap.

Aurinko
Google Sheets
Slack Bot
Agentic Task
Turn each week's football fixtures into a venue staffing plan

Every Monday, rank the week's matches by expected demand, put the big ones on your venue calendar, and post a rota-ready summary to Slack.

API-Sports
Google Calendar
Slack
Agentic Task

Stop paying for browsers nobody closed.

Set this up once and let it reclaim forgotten sessions every night while you sleep.