Weekly E2B sandbox cost and usage brief to Slack and Notion
Every Monday morning, Geni reviews last week's E2B sandbox usage, finds where you are overpaying for idle compute, and posts a brief to Slack and Notion.
Build me an agent workflow that produces a weekly E2B sandbox utilization and cost optimization brief. It should run on a cron every Monday at 9am team time.
When it runs, the agent should pull data from E2B for the previous 7 days using these operations:
1. List Sandboxes to enumerate every sandbox that is currently running or paused, including their template, metadata (team, project, agent name), state, start time, and resource allocation.
2. List Sandboxes Metrics to batch-fetch CPU, memory, and disk usage for those sandboxes so we can compute average and peak utilization per sandbox.
3. Get Team Metrics to retrieve the aggregated team-wide CPU, memory, and disk picture over the last 7 days.
4. Get Team Maximum Metrics with metric=concurrent_sandboxes to read our concurrency limit, so the brief can call out how close we ran to the cap and whether we are paying for headroom we never use.
Then the agent should analyze the data and produce a brief that does three things:
- Groups usage by template and by sandbox metadata (team, project, agent name) so a reader can see which templates and which projects are driving cost.
- Identifies sandboxes that consumed compute but stayed mostly idle. Default rule: average CPU under 5 percent across the sandbox's lifetime is a right-sizing or pause candidate. Make the threshold easy to tweak.
- Drafts concrete right-sizing recommendations: templates that look oversized and could be shrunk, sandboxes that should be paused instead of left running long, and headroom against the concurrency cap that we never approach.
Output two versions of the brief in the same run:
Slack version (tight): post to a designated Slack channel using Send a Message. It should be short: the top 3 findings and a one-line trend versus the prior week. The channel name should be a parameter I can set during setup.
Notion version (detailed): append a new dated entry to a Notion ops journal page using Append Block Children. Include a one-paragraph executive summary, a per-template usage table (avg CPU, avg memory, peak concurrency, sandbox count, idle count), a per-project breakdown, the list of right-sizing recommendations with the sandbox or template IDs, and the team concurrency picture (peak concurrency vs cap).
The Notion page ID should be a parameter I can set during setup. Make it append as a new section under a date heading like "E2B weekly brief, week of <date>" so the page becomes a running history I can scroll back through.
Other expectations:
- This is read-only. Do not kill, pause, or modify any sandboxes. The brief surfaces recommendations only.
- If E2B returns zero sandboxes for the week (quiet week), still post both the Slack and Notion entries so the history is unbroken; just say no activity this week and skip the recommendations section.
- Tone is operational and direct. No marketing language. Numbers first, recommendations second.
Additional information
What does this prompt do?
- Looks at every sandbox you ran last week, how busy each one actually was, and how close you got to your concurrency limit.
- Groups the picture by template and by tags like team, project, or agent so you can see who and what is driving cost.
- Calls out sandboxes that were live but mostly idle, templates that look oversized, and headroom you are paying for but never using.
- Posts a tight top-three summary to Slack and a more detailed brief, with per-template tables, to a Notion ops journal page.
What do I need to use this?
- An E2B team account with an API key so the brief can read last week's sandboxes and team metrics.
- A Slack workspace and the channel you want the Monday brief posted in.
- A Notion workspace and a page where the running history of weekly briefs should live.
How can I customize it?
- Change the day and time. Monday at 9am team time is the default, but you can move it to Friday afternoon or any cadence you prefer.
- Pick a different Slack channel, or send to a private channel only the platform team can see.
- Swap the Notion destination, or point it at a database instead of a single ops journal page.
- Tune what counts as idle, for example raise or lower the average CPU threshold that flags a sandbox as a right-sizing candidate.
Frequently asked questions
Do I need a paid E2B plan for this to work?
Will this kill or pause any sandboxes for me?
How is this different from the hourly idle-sandbox cleanup prompt?
Can I send the brief to email or somewhere other than Slack and Notion?
How does it know which team or project a sandbox belongs to?
Stop guessing where your E2B bill is going.
Connect E2B, Slack, and Notion once, and Geni delivers a weekly utilization and cost-optimization brief every Monday at 9am.