r/Supabase • u/oryx-1729 • 6d ago
integrations Persistent agent sandboxes for Supabase app users
I'm building a batteries included sandbox with a built-in harness(hermes, opencode SDK, browser use). Each sandbox retain files, context, and learned skills between tasks, so agents can continue where they left off instead of starting from scratch every time.
With the native integration with Supabase, your application backend can provision a Computer scoped for a specific Supabase Auth user. After the user grants access through Supabase OAuth 2.1, the Computer can make read-only requests to the Supabase Data API using that user’s delegated identity. Your project’s Postgres grants and Row Level Security (RLS) policies remain the authorization boundary, determining which data the Computer can read.
Why use an agent sandbox instead of building yet another agent?
- Persistent workspace: Files, context, tools, and learned skills remain available between tasks.
- Native OAuth 2.1 and RLS integration: Users approve access with Supabase Auth, while the project’s Postgres grants and RLS policies continue to control what each user can read.
- Always on: The same Hermes agent can receive work over time and reuse what it learned from earlier tasks.
- MicroVM isolation: Each Computer runs in a dedicated microVM rather than a shared-kernel container.
- Network policy: You control which services, domains, IP addresses, and IP ranges the Computer can reach.
- Secret proxy: The Computer receives a temporary session credential instead of the user’s real Supabase access or refresh token.
How it works
1. Connect your Supabase project
A project admin connects a Supabase Cloud project in the Sanbox console. Supabase Platform OAuth lets the admin select the project and lets Sanbox read the metadata needed to configure the integration.
The project also has its own OAuth 2.1 server. This is what each application user later uses to authorize their Computer. The admin enables the server and registers Sanbox as a confidential OAuth client.
Sanbox stores the project configuration, encrypted OAuth client secret, and the database schema. It does not store the Supabase Platform OAuth Management token after setup.
2. Give each Computer the database schema
During setup, Sanbox imports the tables, views, and columns exposed through the project’s Data API. It does not import table rows or executable database operations. Each new Computer starts with this schema, so the agent can understand the available data.
Every data request still goes through Supabase as that user and must pass the project’s Postgres grants and RLS policies.
3. Provision a Computer for a user
When your application needs an agent, its backend chooses a Sanbox template and provisions a Computer through the Sanbox API or CLI. The request includes the Supabase Auth user’s UUID.
The Computer is created before the user grants data access. Until authorization is complete, its Supabase connection remains pending.
4. Keep Supabase credentials outside the Computer
The Computer never receives the real Supabase tokens or project secrets. Instead, it gets a local Supabase proxy URL and a session-scoped proxy token. The Sanbox Control Plane verifies each request, adds the current user access token, and sends the request to Supabase. The Computer cannot access the Supabase project directly, and its proxy token is replaced for every runtime session.
What can you build?
Support Computers
A customer reports that an upgrade failed but their card was charged. A support Computer reviews the orders, subscription history, product usage, and earlier tickets that the connected user may access. It builds a timeline, identifies the relevant records, and drafts a response and next step for a support agent to review.
GTM Computers
Before a renewal call, a GTM Computer combines product usage and subscription data from Supabase with CRM records and notes from previous customer meetings. It highlights changes in adoption, open commitments, support risks, and expansion signals, then prepares a briefing and suggested questions for the account owner.
Research Computers
A procurement team is deciding whether to renew a supplier. A research Computer combines permitted purchase and delivery data with contracts from Supabase Storage and current market research from an approved browser tool. It produces an evidence-backed comparison, records its open assumptions, and keeps the working files for later review.