Environment Variables
Core infrastructure for a Harnesst deployment is configured through environment variables. Workspace integrations and their encrypted credentials are managed from Settings. This page lists the deployment-level variables; follow the Cloud Run or VM / Docker host guide for deployment-specific wiring.
A full example lives in .env.example at the repo root.
Required variables
These must be set for Harnesst to start. Missing any of them will fail backend boot.
| Variable | Notes |
|---|---|
DB_HOST / DB_PORT | PostgreSQL host and port reachable from the backend |
DB_USER / DB_PASSWORD / DB_NAME | PostgreSQL credentials and database name |
REDIS_HOST / REDIS_PORT | Reachable from the backend (OAuth tokens are cached here) |
BACKEND_JWT_SECRET_KEY | 32+ random characters — used to sign session cookies |
BACKEND_ENCRYPTION_SALT | Secret used to encrypt credentials stored through Settings |
FRONTEND_URL | Public URL of the web app (used as OAuth redirect base) |
BACKEND_URL | Internal URL the Next.js proxy uses to reach the backend (web only) |
In production, also set:
| Variable | Value | Why |
|---|---|---|
BACKEND_COOKIE_SECURE | true | Forces session cookies to be HTTPS-only (recommended) |
LLM providers
An LLM credential is not required for the application to boot, but at least one provider must be configured before an agent can run. Admins can add credentials after startup under Settings → Models, or provide the environment variables below. Google also works with Application Default Credentials. Configuring a provider makes its models eligible for the picker — configure multiple to give agent authors a choice. Which models actually appear (and which one is preselected) is managed by workspace admins under Settings → Models; see Available models.
| Provider | Environment variable | Models |
|---|---|---|
| Anthropic | ANTHROPIC_API_KEY | claude-haiku-4-5, claude-sonnet-4-6, claude-sonnet-5, claude-opus-4-6, claude-opus-4-8, claude-opus-5 |
| OpenAI | OPENAI_API_KEY | gpt-4o-mini, gpt-5, gpt-5-mini, gpt-5-nano, gpt-5.1, gpt-5.2, gpt-5.4, gpt-5.5, gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra |
GOOGLE_API_KEY | gemini-3-flash-preview, gemini-3-pro-preview, gemini-3.5-flash, gemini-3.6-flash, gemini-3.7-flash, gemini-3.8-flash | |
| DeepSeek | DEEPSEEK_API_KEY | deepseek-v4-flash, deepseek-v4-pro |
| Xiaomi | XIAOMI_API_KEY | mimo-v2.5-pro, mimo-v2.5 |
| OpenRouter | OPENROUTER_API_KEY | z-ai/glm-5.2, z-ai/glm-5.3, z-ai/glm-5.3-flash, qwen/qwen3.8-max, qwen/qwen3.8-27b, qwen/qwen3.8-2.4t-a95b |
| Meta | METAAI_API_KEY | muse-spark-1.2 |
Anthropic models run with thinking enabled by default; Google models run with include_thoughts=True. Defaults live in app/model_providers/catalog.py.
Google via Application Default Credentials
GOOGLE_API_KEY is not the only way to enable Gemini. If it is unset but Application Default Credentials are available — a GCP service account on Cloud Run/GKE/Compute, gcloud auth application-default login, or GOOGLE_APPLICATION_CREDENTIALS — the backend serves Gemini models through Vertex AI using those credentials instead of the Gemini Developer API. The identity needs permission to call Vertex AI (e.g. the Vertex AI User role). When GOOGLE_API_KEY is set, it always wins.
Authentication
Google OAuth is configured by an admin under Settings → Authentication. The page provides the exact redirect URI to register in Google Cloud and stores the client credentials encrypted in PostgreSQL. See User Management.
Sandbox
There are no sandbox environment variables. Code-execution sandboxes (OpenSandbox, Daytona, Google Cloud Run) are registered by a workspace admin under Settings → Sandboxes, with their endpoint and credential stored encrypted in the database, and bound to agents from the agent editor. See Sandbox.
The one indirect requirement: a Cloud Run sandbox with a GCS snapshot bucket needs the backend to hold Application Default Credentials that can write to that bucket.
Observability (optional)
Langfuse is configured under Settings → Observability. Its keys are stored encrypted in PostgreSQL. Details: Observability (Langfuse).
Slack (optional)
Slack credentials are configured on each agent. Bot tokens and signing secrets are stored encrypted in PostgreSQL. Workspace admins can enable or disable all agent-specific Slack bots under Settings → Messaging. Details: Slack integration.
Tuning & debugging
| Variable | Default | Notes |
|---|---|---|
LOG_LEVEL | INFO | Set to DEBUG for verbose logs (MCP traces, etc.) |
AGENT_RECURSION_LIMIT | 100 | Max LangGraph steps per agent invocation |
INVOKE_PROFILING | false | Emit per-step timing on each agent invocation |
RUN_WAKE_POLL_SECONDS | 0.5 | Redis wake-token polling cadence for idle dispatchers |
RUN_CLAIM_FALLBACK_SECONDS | 10 | Postgres safety polling cadence when a wake is lost |
RUN_CLAIM_INTERVAL_SECONDS | 0.5 | Deprecated compatibility setting; no longer used |