Overview
beacon-sandbox is a testing tool for Beacon contributors. It starts a throwaway machine, installs your local Beacon build on it, runs a real Claude Code session inside it, and then checks whether Beacon recorded what the agent actually did.
Use it when you have changed something about how Beacon captures telemetry and you want proof that it still works against a live agent, not just that the unit tests pass.
Nothing runs on your own machine, so your local Beacon setup is untouched, and the machine is destroyed when the test finishes.
It runs on two platforms, and where the throwaway machine comes from is the only real difference:
Everything after that is shared: the same scenario files, the same checks, the same verdicts, and the same
verify and --mutate commands. Most of this page applies to both. If you are working on Windows, read Testing the Windows build for the parts that differ, and skip the Modal setup below.
This is a tool for working on Beacon. It is not part of Beacon itself, it is not included in any release, and installing Beacon does not install it. Beacon’s own telemetry collection stays local and offline as always.
Why a sandbox instead of unit tests
Beacon’s unit tests feed it example telemetry and check the output. That catches a lot, but it cannot answer the question that matters most: when a real agent runs a real command, does Beacon record it? Real agents produce messier telemetry than any handwritten example. A field can quietly stop being filled in, and every unit test still passes because none of them ever saw what the live agent actually sends. The catch is that AI sessions are not repeatable. Ask an agent to run a command twice and you get two slightly different sessions, so there is no fixed expected output to compare against. The tool works around this with markers rather than exact comparison:- Each test puts a random one-off string into the prompt, then checks that string appears in Beacon’s log. Since the tool invented the string, a match cannot be coincidence.
- The agent is also asked to write that string into a file. If the file is there, the agent did the work, so a missing record is Beacon’s problem rather than the model having a lazy day.
Before you start
This section covers the Linux backend. Testing the Windows build needs neither a Modal account nor any of the setup below. See Setting it up in the Windows section instead. You need two accounts, and neither can be set up for you:
You also need Go installed, and you should be working inside a clone of this repository.
Setup
1
Install and sign in to Modal
modal token new opens your browser to sign in, then saves credentials to ~/.modal.toml. You only do this once.2
Provide your Anthropic API key
The simplest way is an environment variable. See other options if you would rather not put it there.
3
Run the setup check
doctor looks at everything else the tool needs and tells you exactly what to do about anything missing. --fix downloads what it can for you.One-time setup
doctor finishes with the command to run next:
doctor prints the fix beside it. Run the fix, then run doctor again.
doctor is worth running any time a test behaves strangely. Most confusing failures turn out to be a missing or outdated build artifact, and it will tell you.Keeping your API key out of your shell
Three ways to supply the key, in the order the tool looks for them:
To create the Modal secret:
modal secret create my-anthropic-key ANTHROPIC_API_KEY=sk-ant-...
The Modal secret option keeps the key furthest from your machine, but it comes with one small trade-off: because the tool never sees the key itself, it cannot double-check that the key never leaked into the collected logs. It will say so in the results rather than quietly skipping that check.
Your first test
Build Beacon for Linux, then run a single test:Run one test
PASS means Beacon recorded everything this test looked for.
Understanding the results
Every test ends in one of three states:
A
FAIL tells you which expectation broke and why that expectation exists:
Warnings mean “could not check”
Alongside pass and fail, you may see[WARN] lines. These are not failures, but they are not clean results either. Each one means a check could not run:
If you are reporting results to someone else, mention these. Silence from this tool is meant to mean “checked and clean”, so a warning is worth passing on.
A failure is not always a Beacon bug
Tests encode what Beacon should do. When Beacon’s behaviour legitimately improves, an old expectation can go out of date and start failing. Before concluding you have found a bug:- Read the failing expectation’s
whyand compare it against the event counts in the output. Did the event move somewhere else rather than disappear? - If your change touched
collector-builder/, check that you rebuilt it. See the warning below. - Only then treat it as a gap in Beacon.
The tests you can run
These run on the Linux backend. The Windows ones are listed in Testing the Windows build.
Use one test while you are iterating. Run all of them before opening a pull request.
The
s0* tests collect through a temporary collector, the path Beacon uses in CI and cloud agents. The i0* tests install Beacon properly first, so they cover things the others cannot: whether config lands where Beacon says it did, whether the service actually starts, and whether a permanently installed collector receives telemetry.
i02 is the slowest test by some margin, and the reason is worth knowing. A system-mode install on Linux is managed by systemd, and systemd only runs as process 1, but Modal’s own startup process holds that slot, so systemd refuses to start. The way around it is a privileged container inside the sandbox, where systemd is process 1, with the whole test running in there. The tool sets this up when a test asks for it:
Asking for a real systemd
expect_service_kind is not redundant with expect_status_running. Beacon falls back to a plain background collector when it finds no service manager, and that fallback also reports itself as running. Without naming the backend you expect, a test meant to cover systemd could quietly pass while covering the fallback instead.
Testing the Windows build
Modal offers Linux machines only, so Windows needs a different disposable machine. It uses a GitHub-hosted Windows runner, which is already one: a fresh virtual machine per job, with administrator rights, UAC disabled, and a real Service Control Manager. That is everything an endpoint install needs. The difference from the Linux path is where the sandbox is. On Modal the tool starts a machine and drives it from outside. On Windows the runner is the sandbox, and the tool runs inside it. The collected output is uploaded and judged on your machine afterwards by the same code that judges a Modal run, so a Windows verdict comes from the same rules as a Linux one. Runner minutes are free on this public repository, so unlike the Linux tests these cost only the Anthropic API session.Running one
Dispatch a Windows test
scenario empty to run every Windows test. Each takes a few minutes, and the whole set takes about fifteen.
w03 is the one that matters most. It goes through hooks Beacon installed rather than a temporary collector, which is what a real user gets. It is also the only test that can confirm the command string Beacon writes into a runtime’s settings is one that runtime can execute.
Setting it up
Dispatching needs write access to the repository, plus anANTHROPIC_API_KEY secret in the windows-sandbox environment. It is scoped to an environment rather than the repository, matching how the release secrets are handled:
Store the key, without it entering your shell history
--dangerously-skip-permissions, and the per-session budget in a scenario is a client-side cap rather than an account guard.
The workflow is
workflow_dispatch only, deliberately. It needs an API key to run a real session, and on a public repository that secret must never be reachable from a fork’s pull request. So there is no pull_request trigger, and there must never be a pull_request_target one.One check works differently there
Every Linux run fingerprints your own Beacon state before and after, so a test that accidentally installed something on your machine is caught rather than assumed impossible. That comparison only means something when the sandbox is a different machine. On Windows it is not, because the install being tested is itself the change the guard would report. The run records a different kind of evidence instead: that the machine is disposable, a GitHub-hosted runner with one fresh VM per job. The verdict says which of the two it relied on rather than silently reporting the comparison as clean:Commands
verify is worth knowing about. Every run saves its output under runs/, and verify re-checks that saved output without starting a sandbox or calling the API. If you are adjusting what a test expects, use verify rather than paying for another run.
Writing your own test
Tests are YAML files inbeacon-sandbox/scenarios/:
A minimal test
{{canary}}becomes the random one-off string for that run.{{sentinel}}and{{workdir}}are also substituted.sentinelis the file the agent must leave behind. It has to contain the canary, so a file created by setup does not count.whyis required on every expectation, because a failure nobody can interpret is not useful.optional: truerecords an expectation without failing the run, for something known to be missing.
Checking that the checks work
A test that cannot fail is worse than no test, so you can deliberately damage a saved run and confirm the tool notices:Confirm a PASS can become a FAIL
drop-commands, drop-action:<action>, and plant-secret. Each should turn a PASS into a FAIL. The tool’s own unit tests do this automatically and need no accounts, no API key, and no cost:
Limitations
- The systemd tests run nested.
i02runs inside a container within the sandbox, so it is slower and needs a few more minutes of patience than the others. - It checks presence, not completeness. It confirms the thing it planted was recorded. It cannot tell you whether Beacon missed something it never knew to look for.
- Linux x86 only on Modal, x64 only on Windows. Neither backend offers a choice of processor architecture, so the ARM builds are not covered.
- It costs money and takes minutes. Each test is a real API session.
- Occasional flakiness is normal. Telemetry arrives asynchronously, so the tool waits for activity to settle rather than a fixed delay. Use
--repeat 3to tell a flaky result from a broken one. - The agent version is pinned. Claude Code’s behaviour changes between releases, so the sandbox installs a fixed version. Updating it is a deliberate change.
Related
Contributing
Building Beacon, running the test suites, and opening a pull request.
Validate a local install
Checking Beacon on your own machine, rather than testing Beacon itself.
beacon ci exec
The collection path these tests exercise.
Event schema
The fields tests can check.

