◧ BUILD WITH CLOUDFLARE

LAB 02 / CLOUDFLARE SANDBOXES + WORKERS AI

Give your agent
a place to prove it.

Build an Autonomous Code Repair Agent in an Edge Sandbox

A failing app. A real Linux environment. An AI-proposed fix.
Build the loop that turns a plausible answer into tested code.

Open the repair bench ↓
150 minutes, hands on0 local installs for attendees1 private workspace per browser3 repair attempts maximum

YOUR REPAIR BENCH

Make the failure useful.

Checking runtime…
You can read and edit the starter locally. Live tests need the event access code and a configured Cloudflare runtime.

Your facilitator supplies this. Your workspace stays private in this browser.

Resume a saved workspace

Paste your pass or the contents of your recovery file. It restores your original workspace and remaining quotas. No event code needed.

02 / EDIT THE APPLICATION

solution.mjs

Edit the function, change your repair instructions, then run the loop. Only this module is patchable.

Ready to inspect

03 / WATCH THE EVIDENCE

Execution log

SERVER OUTPUT
No run yet. Output appears only when a real server operation occurs.

INDEPENDENT EVALUATION

Not evaluated

Public checks explain failures. Separate Worker-side checks score boundary cases that the model cannot edit.

APP PREVIEW

The first test’s real container output will appear here.

04 / REVIEW & KEEP

Proposed changes

A model proposal is just a proposal until the independent checks pass.

No proposed patch yet.

My repair service saves your current editor and packages the full Worker, frontend, tests and configuration with your source and agent policy as deployment defaults. Results and your private recovery pass are separate downloads. No credentials enter either source archive.

KEEP YOUR WORKSPACE

Come back to the service you built.

Download a private recovery pass to reopen this same saved workspace in a fresh browser for up to 90 days. Your existing run budget stays with it. Keep the file private; anyone holding it can resume your workspace.

Open your private workspace to create a recovery pass. This pass is separate from your source and result downloads.

Download again to rotate the pass: the previous pass stops working. Revocation blocks future recovery; signed-in sessions last until their normal expiry. Live execution stays subject to the sponsored runtime and your remaining quotas.

THE 150-MINUTE WORKSHOP

Build the loop. Understand every step.

BROWSER FIRST

You are building a repair service, not just watching a chatbot. The browser is your editor; Cloudflare runs the code. No repository, terminal installation, or personal API key is required for the sponsored lab.

00–15 MIN

1. Open your private workspace

Enter the event code. Read the contract for the delivery quote. Find the off-by-one comparison in the starter. Explain what should happen at exactly 5,000 cents.

Checkpoint: you can describe the bug without running an AI model.

15–35 MIN

2. Make Linux show the failure

Uncheck “Ask Workers AI to repair failures” and run. The Worker starts a Linux container, writes your module, and invokes Node as an unprivileged user. Read the stdout, exit code, and public checks.

Checkpoint: a real failing baseline with a concrete expected/actual difference.

35–60 MIN

3. Shape your repair agent

Edit the instruction to require integer cents and explain the express surcharge. Set one attempt. Enable repair and run again. Your saved policy controls the model request and the retry loop.

Checkpoint: inspect the generated patch before copying it into the editor.

60–85 MIN

4. Test the evaluator

Replace the function with a constant answer that passes the first public check. Disable repair and run. Observe the independent checks reject it. Then restore the starter and try two repair attempts.

Checkpoint: explain why a model saying “fixed” cannot pass this lab.

85–110 MIN

5. Transfer the loop to a new bug

Switch to the stock badge. Change the instructions to handle reserved inventory and exact low-stock boundaries. Use the evaluated patch, change one line, and predict which check will fail before running.

Checkpoint: your agent repairs a second application under the same limits.

110–135 MIN

6. Package your repair service

Download the complete source and your settings separately. In the source, trace Participant.run() → RunSandbox.evaluate() → judge(). The facilitator handles the sponsored deployment; use the deployment guide for your own supported account.

Checkpoint: you have the service source, your policy, and a reviewable patch.

135–150 MIN

7. Show the evidence

Refresh the page to verify your saved result persists. Download a recovery pass and use “Resume a saved workspace” in a fresh browser. Show your baseline, patch, independent score, and app preview. Explain the budget limits and the stop button. Discuss how you would extend this to your own codebase.

Checkpoint: a reproducible repair, with evidence and a clear next step.

WHAT EACH SERVICE DOES

A small system, clear boundaries.

Workers serves this page and checks your session. Durable Objects keeps your policy, run budget, and result. Containers executes your source in a fresh Linux environment with the Internet disabled. Workers AI proposes a replacement module.

Containers remain in the sponsored account. A temporary Worker claim does not transfer this runtime. The coordinator provides any available post-workshop claim flow separately.

If something goes wrong

Runtime unavailable: the page is in an honest read/edit mode. Ask the facilitator to enable the live deployment. No terminal output is simulated.

AI output rejected: simplify your instructions and rerun within your budget. The model must return bounded JSON containing a full source module.

Code times out: remove infinite loops. Execution is killed after ten seconds; the whole repair run has a 150-second ceiling.

Disconnected: the run stops and retains its last completed evaluation. Refresh to reload saved settings and results, then rerun. Keep the same browser profile; the HttpOnly cookie is your session.

Need to keep building: export source and your settings before the six-hour session expires. Your own deployment needs supported paid Cloudflare services. A technical consultation can follow a successful deployment.