Skip to content

Environment variables ​

Carmel Agent is configured with environment variables. It reads .env, .env.local, packages/server/.env, and packages/server/.env.local at startup; variables set directly, for example in Compose, take precedence over the files.

With Compose, put settings in the .env next to compose.yaml. Variables that compose.yaml does not pass through already need to be added under its environment: section.

Core ​

VariableDefaultDescription
HOST127.0.0.1 (0.0.0.0 in the image)Address the server binds to.
PORT8797Port for the API and web client.
NODE_ENVproduction in the imageSet to production for real deployments. Enables secure cookies and requires CARMEL_SECRET_KEY.
CARMEL_PUBLIC_URL—The absolute URL people open Carmel Agent at. Required for SSO; used for messaging-app /web links and links agents write.
CARMEL_AGENT_DATA_DIRdata (/data in the image)Base directory for databases, workspaces, and runtime state.
DATABASE_URLdata/carmel-agent.sqliteSQLite database for metadata and accounts.
CARMEL_PI_SESSION_DIRdata/pi-sessions.sqlite.durable/Directory of per-session conversation databases. See Session storage.
CLIENT_DIST_DIRBuilt-inOverride the directory of the built web client.

Secrets ​

VariableDefaultDescription
CARMEL_SECRET_KEY—Encrypts provider API keys, OAuth credentials, environment and session secrets, and messaging-app credentials. Required by Compose and in production.

Generate it once with openssl rand -hex 32, set it before adding any credentials, and back it up with your data. If it changes, existing encrypted values can no longer be decrypted.

Development can run without a key, in which case credentials are stored in plain text — use disposable credentials there. Messaging-app integrations and credentials submitted through chat forms always require a key.

Browser and proxy security ​

VariableDefaultDescription
CARMEL_ALLOWED_ORIGINS—Comma-separated extra browser origins allowed to make cookie-authenticated changes, for when the web client is served from a different origin.
CARMEL_TRUSTED_PROXY—Comma-separated IPs of trusted reverse proxies. X-Forwarded-For and X-Forwarded-Host are honored only from these addresses.

See Production setup.

Single sign-on ​

OIDC is off until CARMEL_OIDC_ISSUER is set. See Users and sign-in for a walkthrough.

VariableDefaultDescription
CARMEL_OIDC_ISSUER—Required. Issuer URL. Carmel Agent reads <issuer>/.well-known/openid-configuration.
CARMEL_OIDC_CLIENT_ID—Required. Client ID from the provider.
CARMEL_OIDC_CLIENT_SECRET—Client secret. Leave unset for a public client; PKCE is always used.
CARMEL_OIDC_PROVIDER_NAMESSOName on the sign-in button.
CARMEL_OIDC_SCOPESopenid profile email (+ groups)Space- or comma-separated scopes. groups is added automatically only when you don't set this variable.
CARMEL_PASSWORD_LOGINtrueSet to false to make SSO the only sign-in method. Requires OIDC.
CARMEL_OIDC_MATCH_BYemail,usernameHow a first-time identity is matched to an existing account: username, email, either order, or none.
CARMEL_OIDC_AUTO_CREATEtrueCreate an account when nothing matches. false allows only pre-created accounts.
CARMEL_OIDC_REQUIRE_VERIFIED_EMAILtrueOnly match by email when email_verified is true.
CARMEL_OIDC_USERNAME_CLAIMpreferred_usernameClaim used for the username.
CARMEL_OIDC_EMAIL_CLAIMemailClaim used for the email.
CARMEL_OIDC_NAME_CLAIMnameClaim used for the display name.
CARMEL_OIDC_GROUPS_CLAIMgroupsClaim used for group membership.
CARMEL_OIDC_ALLOWED_GROUPS—Comma-separated. Only members of these groups can sign in.
CARMEL_OIDC_ADMIN_GROUPS—Comma-separated. Members are administrators and everyone else is a user, re-checked at every sign-in.

Run limits ​

VariableDefaultDescription
CARMEL_AGENT_MAX_TOOL_CALLS250Tool calls one run may complete before it is stopped.
CARMEL_AGENT_STALL_TIMEOUT_MS900000 (15 min)How long a run may go without activity before it is stopped.
CARMEL_AGENT_REQUEST_TIMEOUT_MS600000 (10 min)Deadline for a single provider request.
CARMEL_AGENT_MAX_CONCURRENT_TASKS2Scheduled runs allowed at once.

Web tools ​

VariableDefaultDescription
EXA_API_KEY—Enables the exa_search tool for agents with Web access.

fetch_url needs no key: it fetches pages directly and extracts their main content locally with Defuddle.

Sandbox ​

VariableDefaultDescription
CARMEL_PODMAN_SOCKETAuto-detectedPath to the container API socket. Works with Podman and Docker. See socket detection.
CARMEL_HOST_UIDServer process UIDNon-zero host UID for runner commands and file ownership. Required when the server is containerized; must match the server's UID.
CARMEL_HOST_GIDServer process GIDNon-zero host GID, as above.
CARMEL_HOST_DATA_DIR—Host path backing CARMEL_AGENT_DATA_DIR. Required when the server runs in a container.
CARMEL_BASH_IMAGEghcr.io/mudkipme/carmel-agent-runner:latestRunner image. Missing registry images are pulled on first use.
CARMEL_BASH_MEMORY_MB512Memory cap per runner, in MB.
CARMEL_BASH_CPUS1CPU limit per runner.
CARMEL_BASH_PIDS_LIMIT512Process limit per runner.
CARMEL_BASH_IDLE_MINUTES15Idle minutes before a runner is removed.
CARMEL_BASH_GPU—Comma-separated CDI device IDs for runners, such as nvidia.com/gpu=all.
CARMEL_BASH_SELINUX_RELABELtrueRelabel runner bind mounts with :z. Set false to disable.

Knowledge ​

VariableDefaultDescription
CARMEL_KNOWLEDGE_EMBED_MODELembeddinggemma-300M-Q8_0 (hf: URI)Embedding model for every agent: an hf: URI or an absolute GGUF path. Also the default QMD_EMBED_MODEL in shells. Restart and rebuild embeddings after changing it.
CARMEL_KNOWLEDGE_IMAGECARMEL_BASH_IMAGE, then the published runnerKnowledge worker image. Must include qmd 2.8.3 and be pulled before use.
CARMEL_KNOWLEDGE_MEMORY_MB4096Memory limit per Knowledge worker, in MiB.
CARMEL_KNOWLEDGE_CPUS2CPU limit per Knowledge worker.
CARMEL_KNOWLEDGE_UPDATE_TIMEOUT_MS900000 (15 min)Deadline per index refresh, in milliseconds (at most 2147483647).
CARMEL_KNOWLEDGE_EMBED_TIMEOUT_MS21600000 (6 h)Deadline per embedding job, including model loading.
CARMEL_KNOWLEDGE_GPUInherits CARMEL_BASH_GPUCDI devices for Knowledge workers. Set it empty to disable passthrough.

The default embedding model is hf:ggml-org/embeddinggemma-300M-GGUF/embeddinggemma-300M-Q8_0.gguf. A local model file is mounted read-only; for a containerized server, make it visible at the same absolute host path or place it under the data directory.

Compose only ​

These are read by compose.yaml, not by the server.

VariableDefaultDescription
CARMEL_IMAGEghcr.io/mudkipme/carmel-agent:latestServer image.
CARMEL_USERNS_MODEkeep-idUser namespace mode. Use host for rootful runtimes.
CARMEL_RUNTIME_SOCKETRootless Podman user socketHost socket mounted into the server.
CARMEL_SOCKET_GIDCARMEL_HOST_GIDGroup added to the server for socket access.

Command line ​

VariableDescription
CARMEL_PASSWORDPassword for the user:create command, instead of --password. See Users and sign-in.

Development ​

VariableDescription
CARMEL_SERVER_URLAPI address for the Vite dev server's proxy. Defaults to http://localhost:8797.
CARMEL_DEV_HOSTSComma-separated extra hostnames the Vite dev server accepts, for LAN access.
PI_TELEMETRYSet to 0 to disable Pi's provider attribution headers.