Skip to main content
Where nobody can run 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

  1. Sign in to beacon.sh and open API Keys in the dashboard (beacon.sh/dashboard/api-keys).
  2. Create a key with the Publish shared traces (traces:write) permission, which is all beacon share needs, including refresh and --follow. Choose an expiry.
  3. Copy the key. It starts with bcn_api_ and is shown only once.
Store it as a secret in your CI system, for example a GitHub Actions secret or a masked GitLab CI/CD variable named BEACON_API_KEY. Never commit it.

Use the key

No 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
The link reaches the script through an environment variable rather than being written into it, so nothing in the share output can change what the script runs. A failed share leaves the job green (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 --json in CI and read data.shared_url from the result.
  • Use --harness auto when the job could run more than one runtime, or name the one it runs.
  • Keep the default direct visibility, or use --visibility private, for sessions that touched proprietary code. Without a terminal, public needs --yes.
  • Run beacon share --print once in the pipeline to read exactly what it uploads.
  • Share after the agent finishes rather than with --follow: --follow needs 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.

beacon share reference

Credential order and every flag.

Beacon CI telemetry

Capture agent runs in CI for runtimes without a session store.