Skip to content

Environment variables

Both SDKs read the same variables. A value passed to init() wins over the variable.

Variable What it is Default
WEHARNESS_INGEST_KEY The ingest key (whk_…). Required unless you pass key. —
OTEL_SERVICE_NAME The service name, when service is not passed unknown_service
WEHARNESS_OTLP_ENDPOINT Where spans are sent https://api.weharness.io/otlp/v1/traces
WEHARNESS_REVISION The commit your application runs See below

When revision is not passed, the SDKs take the first of these that is set:

  1. WEHARNESS_REVISION
  2. GITHUB_SHA (GitHub Actions)
  3. CI_COMMIT_SHA (GitLab CI)
  4. VERCEL_GIT_COMMIT_SHA (Vercel)
  5. RENDER_GIT_COMMIT (Render)
  6. SOURCE_VERSION (Heroku and others)
  7. GIT_COMMIT (Jenkins and others)

It becomes the resource attribute vcs.ref.head.revision. Without any of them, the code version is unknown.

Variable Value
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT https://api.weharness.io/otlp/v1/traces
OTEL_EXPORTER_OTLP_TRACES_HEADERS Authorization=Bearer%20whk_… (the space is written %20)
OTEL_SERVICE_NAME Your service’s name
OTEL_RESOURCE_ATTRIBUTES Optional, for example vcs.ref.head.revision=<commit sha>,service.version=1.4.0

When WeHarness runs your code in a session’s sandbox, an evaluation run or a preview, it sets variables for it:

Variable Set for What it is
WEHARNESS_EVAL_INPUT Evaluation runs The path of the file holding the case’s input. See Evaluations.
The OTLP endpoint and a key Evaluation runs Your agent’s traces from the case go to a key that exists only for the run, so tool and error checks can read them
Model provider variables Every sandbox The variables the providers’ official SDKs read, pointing at models.weharness.io with a token that works only for that sandbox. See Cloud work.

The sandbox never receives a WeHarness key or your own model key.