Caracal services are configured entirely through environment variables. There are no config files for services. Client-side tooling uses caracal.toml. SDKs accept typed config structs.
Jump to: Postgres · Redis · STS · API · Gateway · Coordinator · Audit · caracal.toml · SDK config types · CLI env vars
All services read DATABASE_URL to connect to Postgres.
Variable Required Default Description DATABASE_URLYes — PostgreSQL connection string (postgres://user:pass@host:port/db)
All services read REDIS_URL to connect to Redis.
Variable Required Default Description REDIS_URLYes — Redis connection URL (redis://:pass@host:6379) REDIS_PASSWORDNo — Alternative to embedding the password in REDIS_URL
Redis must be configured with maxmemory-policy noeviction. Stream data uses db0; rate limit data uses db1.
Variable Required Default Description DATABASE_URLYes — Postgres connection string REDIS_URLYes — Redis connection string ZONE_KEKYes — 32-byte hex-encoded Key Encryption Key for zone signing keys; must not be all zeros OPA_URLYes — OPA REST API base URL (e.g., http://opa:8181) AUDIT_STREAM_URLNo REDIS_URLRedis URL for audit event publishing, if separate from main Redis STREAMS_HMAC_KEYNo — Hex-encoded key for HMAC-signing audit stream messages; if unset, messages are unsigned TLS_CERT_FILENo — Path to TLS certificate PEM for HTTPS; both TLS_CERT_FILE and TLS_KEY_FILE must be set together TLS_KEY_FILENo — Path to TLS private key PEM INSECURE_HTTPNo falseAllow HTTP (no TLS) in production mode; unsafe — for local development only LOG_LEVELNo infoLog verbosity: debug, info, warn, error PORTNo 8080Listening port
Key cache: Zone signing keys are cached in-memory for 15 minutes. Changes to zone keys (e.g., after rotation) take effect within one cache TTL.
Variable Required Default Description DATABASE_URLYes — Postgres connection string REDIS_URLYes — Redis connection string ADMIN_TOKENYes — Bearer token required for all /v1/* admin routes STS_URLYes — Internal URL of the STS service (e.g., http://sts:8080) INSECURE_STSNo falseSkip TLS verification when calling STS; for internal networks with self-signed certs only OUTBOX_POLL_MSNo 250Milliseconds between outbox poll cycles OUTBOX_BATCH_SIZENo 32Events per outbox poll batch OUTBOX_MAX_ATTEMPTSNo 100Maximum delivery attempts per outbox row before marking dead TLS_CERT_FILENo — Path to TLS certificate PEM TLS_KEY_FILENo — Path to TLS private key PEM LOG_LEVELNo infoLog verbosity PORTNo 3000Listening port
Variable Required Default Description DATABASE_URLYes — Postgres connection string REDIS_URLYes — Redis connection string STS_URLYes — Internal URL of the STS service BINDINGS_RELOAD_MSNo 30000How often (ms) to reload resource bindings from Postgres JTI_CACHE_SIZENo 10000Maximum entries in the JTI replay cache TLS_CERT_FILENo — Path to TLS certificate PEM TLS_KEY_FILENo — Path to TLS private key PEM LOG_LEVELNo infoLog verbosity PORTNo 8081Listening port
Variable Required Default Description DATABASE_URLYes — Postgres connection string REDIS_URLYes — Redis connection string OUTBOX_POLL_MSNo 1000Milliseconds between outbox poll cycles OUTBOX_BATCH_SIZENo 50Events per outbox poll batch OUTBOX_MAX_ATTEMPTSNo 10Maximum delivery attempts per outbox row before marking dead MAX_DEPTHNo 10Maximum agent session nesting depth MAX_CHILDRENNo 10Maximum child sessions per parent MAX_PER_ZONENo 50Maximum concurrent agent sessions per zone MAX_PER_APPNo 200Maximum concurrent agent sessions per application DEFAULT_TTL_SECONDSNo 3600Default agent session TTL in seconds TLS_CERT_FILENo — Path to TLS certificate PEM TLS_KEY_FILENo — Path to TLS private key PEM LOG_LEVELNo infoLog verbosity PORTNo 4000Listening port
Variable Required Default Description DATABASE_URLYes — Postgres connection string REDIS_URLYes — Redis connection string AUDIT_HMAC_KEYYes — Hex-encoded key for HMAC-SHA256 chain verification STREAMS_HMAC_KEYNo — Hex-encoded key for verifying stream message signatures from STS AUDIT_RETENTION_DAYSNo 365How many days of audit events to retain; partitions older than this are dropped AUDIT_MAX_DELIVERIESNo 5Maximum delivery attempts per audit event before routing to DLQ AUDIT_EXPORT_S3_BUCKETNo — S3 bucket name for Parquet export; export is disabled if unset AUDIT_EXPORT_S3_ENDPOINTNo AWS default S3-compatible endpoint URL (use for MinIO or other non-AWS stores) AUDIT_EXPORT_S3_REGIONNo us-east-1S3 region AWS_ACCESS_KEY_IDNo — AWS credentials for S3 export; uses instance profile if unset AWS_SECRET_ACCESS_KEYNo — AWS credentials for S3 export TLS_CERT_FILENo — Path to TLS certificate PEM TLS_KEY_FILENo — Path to TLS private key PEM LOG_LEVELNo infoLog verbosity PORTNo 9090Listening port
caracal.toml is the client-side configuration file used by the CLI. It is discovered in this order:
Path in CARACAL_CONFIG environment variable (if set)
./caracal.toml in the current working directory
$XDG_CONFIG_HOME/caracal/caracal.toml (defaults to ~/.config/caracal/caracal.toml)
zone_url = " https://your-caracal-api.example.com "
application_id = " app-xyz456 "
app_client_secret = " secret-... "
continue_on_failure = false # If true, CLI continues after non-fatal errors
# Named credentials forwarded to external services
env = " DATABASE_URL " # Environment variable holding the credential value
resource = " postgres " # Resource identifier this credential is for
# Optional credentials that warn or error if missing
on_failure = " warn " # "warn" or "error"
mode = " block " # "block" or "log"
Field Type Required Description zone_urlstring Yes Base URL of the Caracal API service zone_idstring Yes Zone this client operates in application_idstring Yes Application identity for credential exchange app_client_secretstring Yes Client secret for application authentication continue_on_failureboolean No Whether to continue after non-fatal errors (default: false) credentialsarray No Named credentials to forward to external services credentials[].envstring Yes (in block) Environment variable containing the credential value credentials[].resourcestring Yes (in block) Resource identifier the credential is for optional_credentialsarray No Credentials that may be absent; controls failure behavior optional_credentials[].on_failurestring Yes (in block) "warn" or "error"mcp_governance.modestring No "block" (reject unauthorized tool calls) or "log" (permit but record)
import { Caracal } from ' @caracal/sdk ' ;
import { CoordinatorClient } from ' @caracal/sdk ' ;
const client = new Caracal ( {
coordinator: new CoordinatorClient ( { baseUrl: ' http://localhost:4000 ' } ) ,
applicationId: ' app-xyz456 ' ,
subjectToken: ' subject-jwt-... ' ,
gatewayUrl: ' http://localhost:8081 ' ,
{ resourceId: ' api ' , upstreamPrefix: ' http://upstream:3000 ' }
defaultKind: ' instance ' , // AgentKind: 'instance' | 'ephemeral'
CaracalConfig interface:
Field Type Required Description coordinatorCoordinatorClientYes Coordinator connection zoneIdstringYes Zone identifier applicationIdstringYes Application identifier subjectTokenstringYes Subject identity token gatewayUrlstringNo Gateway URL for resource routing resourcesResourceBinding[]No Resource-to-upstream mappings defaultKindAgentKindNo Default agent kind for spawned sessions defaultTtlSecondsnumberNo Default TTL for spawned sessions
from caracalai_sdk import Caracal, CaracalConfig, CoordinatorClient, ResourceBinding
client = Caracal ( CaracalConfig (
coordinator = CoordinatorClient ( base_url = ' http://localhost:4000 ' ) ,
application_id = ' app-xyz456 ' ,
subject_token = ' subject-jwt-... ' ,
gateway_url = ' http://localhost:8081 ' ,
resources = [ ResourceBinding ( resource_id = ' api ' , upstream_prefix = ' http://upstream:3000 ' ) ],
default_kind = AgentKind.INSTANCE ,
default_ttl_seconds = 3600 ,
CaracalConfig dataclass:
Field Type Required Description coordinatorCoordinatorClientYes Coordinator connection zone_idstrYes Zone identifier application_idstrYes Application identifier subject_tokenstrYes Subject identity token gateway_urlstr | NoneNo Gateway URL for resource routing resourceslist[ResourceBinding]No Resource-to-upstream mappings default_kindAgentKindNo Default agent kind for spawned sessions default_ttl_secondsint | NoneNo Default TTL for spawned sessions
sdk " github.com/garudex/caracal/packages/sdk/go "
Coordinator : coordinator , // *CoordinatorClient
ApplicationID : " app-xyz456 " ,
SubjectToken : " subject-jwt-... " ,
GatewayURL : " http://localhost:8081 " ,
Resources : []sdk.ResourceBinding{
{ ResourceID : " api " , UpstreamPrefix : " http://upstream:3000 " },
DefaultKind : sdk . AgentKindInstance ,
Caracal struct:
Field Type Required Description Coordinator*CoordinatorClientYes Coordinator connection ZoneIDstringYes Zone identifier ApplicationIDstringYes Application identifier SubjectTokenstringYes Subject identity token GatewayURLstringNo Gateway URL for resource routing Resources[]ResourceBindingNo Resource-to-upstream mappings DefaultKindAgentKindNo Default agent kind for spawned sessions DefaultTTLSecondsintNo Default TTL for spawned sessions
Environment variables that affect the CLI and SDK runtime when caracal.toml is not in use:
Variable Description CARACAL_CONFIGOverride path to caracal.toml CARACAL_ENV_FILEOverride path to .env file loaded by the CLI CARACAL_API_URLAPI base URL (default: http://localhost:3000) CARACAL_COORDINATOR_URLCoordinator base URL (default: http://localhost:4000) CARACAL_COORDINATOR_TOKENJWT with agent:lifecycle scope for coordinator routes CARACAL_ADMIN_TOKENBearer token for admin API routes CARACAL_ZONE_IDDefault zone ID for admin commands CARACAL_APPLICATION_IDApplication ID for SDK initialization CARACAL_SUBJECT_TOKENSubject token for SDK initialization CARACAL_GATEWAY_URLGateway URL for resource routing CARACAL_RESOURCESComma-separated resource bindings: resourceId=prefix,resourceId2=prefix2 XDG_CONFIG_HOMEBase directory for caracal.toml discovery XDG_DATA_HOMEBase directory for runtime assets