Configuration
testrelic-deepeval is configured through environment variables, the credentials file, or explicit arguments. You rarely need more than testrelic login to get started — this page covers the full set of options.
Environment variables
| Variable | Purpose |
|---|---|
TESTRELIC_API_KEY | Your TestRelic API key |
TESTRELIC_BASE_URL | Override the cloud base URL |
TESTRELIC_PROJECT | Project identity to attach the run to |
TESTRELIC_REPO_GIT_ID | Repository git identity for the run |
Create an API key from your org — see API keys.
Authentication precedence
When the SDK resolves a setting, it uses the first source that provides a value:
- Explicit arguments (for example, CLI flags or
evaluate()keyword arguments) - Environment variables
- Credentials file (
~/.testrelic/credentials.toml) - Defaults
Credentials file
testrelic login writes credentials to ~/.testrelic/credentials.toml (mode 0600 on POSIX). Remove them with testrelic logout.
Base URL override
The cloud endpoint defaults to https://platform.testrelic.ai/api/v1/evals in the final release. (Pre-release builds default to stage.) Override it with TESTRELIC_BASE_URL or at login:
testrelic login --api-key <key> --base-url <url>
Project and repo identity
Use TESTRELIC_PROJECT and TESTRELIC_REPO_GIT_ID to control which project and repository a run is attached to. The SDK also auto-detects CI context — branch, commit, and CI URL — for GitHub Actions, GitLab, Jenkins, CircleCI, and Buildkite, so these are usually inferred automatically in CI.
Offline queue location
Undeliverable uploads are written to ~/.testrelic/queue/ and replayed with testrelic drain.
evaluate() wrapper options
The programmatic wrapper is a drop-in for deepeval.evaluate():
from testrelic import evaluate
results = evaluate(test_cases, metrics, **kwargs)
test_cases— your DeepEval test cases.metrics— the DeepEval metrics to evaluate against.**kwargs— forwarded todeepeval.evaluate().
Authentication and identity follow the same precedence rules above. Explicit keyword arguments take priority over environment variables and the credentials file. The return value is whatever deepeval.evaluate() returns; the upload happens automatically.