beacon login (CI runners, containers, scheduled jobs, a server you reach over SSH), beacon share authenticates with a Beacon API key instead. The key works the same way everywhere beacon share runs, including the beacon-trace-share skill and the pre-push hook.
Create an API key
- Sign in to beacon.sh and open API Keys in the dashboard (beacon.sh/dashboard/api-keys).
- Create a key with the Publish shared traces (
traces:write) permission, which is allbeacon shareneeds, includingrefreshand--follow. Choose an expiry. - Copy the key. It starts with
bcn_api_and is shown only once.
BEACON_API_KEY. Never commit it.
Use the key
beacon login is needed. Prefer the environment variable to --key, which puts the key on the command line where process listings can see it.
beacon share uses the first credential available: --key, then a beacon login sign-in carrying traces:write, then BEACON_API_KEY. On a machine that is also signed in, pass --key to use the key. The key is sent only in the request’s Authorization header to beacon.sh’s API (api.beacon.sh), redirects are refused, and it is never printed. For a self-hosted Beacon service, set BEACON_AUTH_URL (or --auth-url) to that service, and BEACON_API_URL too if its API is on another host.
Run the share in the agent’s job
beacon share reads the session from the machine it runs on, so run it in the same job as the agent, after it. Claude Code and Codex CLI keep sessions in stores beacon share reads directly, so nothing else needs to be installed. For a runtime whose sessions Beacon reads only from its runtime log, start Beacon CI telemetry before the agent and pass the CI log with --log-path.
GitHub Actions
This workflow runs an agent on a pull request, shares its session, adds the link to the job summary, and comments it on the pull request:.github/workflows/agent.yml
exit 0); remove that to make a missing trace fail the build.
GitLab CI
.gitlab-ci.yml
after_script runs in the same job even when the agent fails, so the session is still on disk.
Docker
Install Beacon in the image and pass the keys in at run time:Dockerfile
-e NAME without a value passes the variable from your shell, so the key is not written on the command line.
Headless machines and SSH
Tips
- Use
--jsonin CI and readdata.shared_urlfrom the result. - Use
--harness autowhen the job could run more than one runtime, or name the one it runs. - Keep the default
directvisibility, or use--visibility private, for sessions that touched proprietary code. Without a terminal,publicneeds--yes. - Run
beacon share --printonce in the pipeline to read exactly what it uploads. - Share after the agent finishes rather than with
--follow:--followneeds the session to exist when it starts, and most CI runners stop background processes when their step ends. - Revoke a key from API Keys on beacon.sh as soon as it is no longer needed.
Related
beacon share reference
Credential order and every flag.
Beacon CI telemetry
Capture agent runs in CI for runtimes without a session store.