Skip to content
Docs menu

Preview sites

Build a GitHub repository with a change in your agent's own workspace and get a temporary URL for review, without committing or pushing. Connect GitHub, publish a static build, how sites are served and sandboxed, and the limits.

View .md

A preview site is a static website (HTML, CSS, JavaScript, images) an agent publishes from a build, for a person to review before anything is committed or pushed. It lives at

https://<name>-<random id>.cloud.petawork.ai/

when the install has a preview domain, and always at /preview/<name>-<random id>/ on Petawork Cloud's own host. It expires on its own: after a day by default, a week at most.

The cloud never runs your build. The agent fetches the code, edits it, builds it and tests it in its own workspace (a Petawork Computer, the CLI, a CI runner); the cloud hands it the code and hosts only the static output. Design and trade-offs: ADR 0103.

The workflow

Given a repository and a change ("make the homepage hero shorter in acme/website"), an agent with the Studio tools (/workspace/mcp/studio, see Studio for agents) does:

  1. studio_github_get: is GitHub connected for this person? If not, it gives them the link to connect it (below).

  2. studio_github_archive_get {"repo": "acme/website", "ref": "main"}: a download URL GitHub keeps valid for a few minutes. The agent unpacks it:

    mkdir -p repo && curl -sSL '<url>' | tar -xz --strip-components=1 -C repo
  3. It edits the code in repo/, then installs, tests and builds there (npm ci && npm test && npm run build). For the /preview/ address, build with relative asset paths (Vite: vite build --base=./).

  4. studio_site_publish {"name": "acme-website", "source": {"repo": "acme/website", "ref": "main"}} answers an upload_url, good for 15 minutes and one use. The agent sends the build directory:

    tar -czf - -C repo/dist . | curl -sS -X PUT --data-binary @- '<upload_url>'
  5. The answer has the site's url. A smoke test is a curl -fsS <url> that finds the page's title. The person opens it.

To change the preview after feedback, the agent edits and builds again, then calls studio_site_publish with site (the id it got back) for a new upload URL: the address stays the same. Nothing was committed or pushed at any point; when the person is happy, the agent commits and opens a pull request the usual way.

A small site can skip the upload: studio_site_publish takes files inline, [{"path": "index.html", "text": "…"}] or {"path": "logo.png", "base64": "…"}, up to 2 MB in all. That is the path for an assistant without a shell.

Tools

Tool What it does
studio_site_publish Make a site (or republish one with site): inline files, or an upload_url for a .tar.gz. expires_in_hours (1 to 168, default 24), spa (unknown paths answer index.html), source (repo, ref, commit, note, shown with the site)
studio_site_list The organisation's sites: url, state (pending until its files arrive, then live), files, size, who made it, when it expires. mine, cursor, limit
studio_site_delete Take a site down now
studio_github_get Whether the person connected GitHub (login, scopes), or the link to connect it
studio_github_repo_list The repositories the connection can read, most recently pushed first. query, cursor, limit
studio_github_archive_get A short-lived download URL for repo at ref (default: its default branch)

The REST twins are under /api/v1/studio/sites and /api/v1/studio/github (REST API).

Connecting GitHub

Each person connects their own account, in the browser: Studio > Preview sites (/studio/sites) > Connect GitHub, which goes through GET /auth/github/connect to GitHub's consent screen and back to GET /auth/github/callback/connect. Petawork asks for the repo scope, because GitHub has no narrower scope for reading private repositories; it only reads. The token is sealed in the vault, never shown, and used only for the GitHub tools of agents acting for that person (a personal key or an OAuth app). A team key or a service agent's key cannot use anyone's GitHub. Disconnect on the same page deletes the token and revokes it at GitHub.

An agent never connects or disconnects GitHub; it asks the person to.

Serving and safety

  • Paths: the file itself, then <path>.html, then <path>/index.html. Otherwise the site's 404.html (status 404), or index.html for a single-page app (spa).
  • Every page runs in a browser sandbox without access to its own origin: no cookies, no localStorage, no way to act as a signed-in Petawork user, on either address. A site that depends on storage may need a fallback for the preview. Scripts, forms, pop-ups and downloads work.
  • HTML pages without a <base> get one pointing at their own directory, so relative links work at both addresses.
  • Static only: nothing a site contains runs on the server. Only GET and HEAD.
  • Anyone with the URL can open a site; the random id makes it unguessable. Sites are never indexed (noindex).

Limits

Upload (packed) 4 MB
A site (unpacked) 25 MB, 2,000 files, index.html at the top
Inline files 2 MB in all
Per organisation 20 sites, 200 MB
Life 24 hours by default, 7 days at most; then deleted with its files

A refused archive spends its upload URL: publish again with site for a new one. Archives with links, .., hidden files (other than .well-known) or a backslash in a path are refused; macOS metadata (.DS_Store, ._*) is skipped. An archive of a single folder (dist/…) is served from inside it.

Who may do what: anyone with Studio write publishes; the creator or an org admin republishes and takes a site down; read-only credentials only list. Every change is in the audit log (studio.site.created, .republished, .uploaded, .deleted, .expired; studio.github.connected, .disconnected, .fetched).

For operators

Setting Effect
VENOM_PREVIEW_DOMAIN The wildcard domain sites get, e.g. cloud.petawork.ai. Unset: sites are only at /preview/<name>-<id>/ on the console's host. Set it only once *.<domain> resolves to the deployment with a certificate
GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET The GitHub OAuth app (the same one as "Sign in with GitHub"). Add https://<console host>/auth/github/callback/connect as a callback URL, or turn wildcard matching on for /auth/github/callback
VENOM_VAULT_KEYS Needed to keep the GitHub tokens. Without it, or without the app, GitHub cannot be connected

On Vercel, a wildcard domain needs Vercel to answer the certificate's DNS challenge: Vercel's nameservers for the zone, or, keeping another DNS provider, NS records for _acme-challenge.cloud pointing at ns1.vercel-dns.com and ns2.vercel-dns.com plus a CNAME for *.cloud to cname.vercel-dns-0.com.

Outbound calls: only to GitHub, only after a person connected their account, and only for their agents' GitHub tool calls and the disconnect. The code download is made by the agent, from its own workspace.