Skip to content

Configuration Reference

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.

VariableRequiredDefaultDescription
DATABASE_URLYesPostgreSQL connection string (postgres://user:pass@host:port/db)

All services read REDIS_URL to connect to Redis.

VariableRequiredDefaultDescription
REDIS_URLYesRedis connection URL (redis://:pass@host:6379)
REDIS_PASSWORDNoAlternative to embedding the password in REDIS_URL

Redis must be configured with maxmemory-policy noeviction. Stream data uses db0; rate limit data uses db1.


VariableRequiredDefaultDescription
DATABASE_URLYesPostgres connection string
REDIS_URLYesRedis connection string
ZONE_KEKYes32-byte hex-encoded Key Encryption Key for zone signing keys; must not be all zeros
OPA_URLYesOPA REST API base URL (e.g., http://opa:8181)
AUDIT_STREAM_URLNoREDIS_URLRedis URL for audit event publishing, if separate from main Redis
STREAMS_HMAC_KEYNoHex-encoded key for HMAC-signing audit stream messages; if unset, messages are unsigned
TLS_CERT_FILENoPath to TLS certificate PEM for HTTPS; both TLS_CERT_FILE and TLS_KEY_FILE must be set together
TLS_KEY_FILENoPath to TLS private key PEM
INSECURE_HTTPNofalseAllow HTTP (no TLS) in production mode; unsafe — for local development only
LOG_LEVELNoinfoLog verbosity: debug, info, warn, error
PORTNo8080Listening 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.


VariableRequiredDefaultDescription
DATABASE_URLYesPostgres connection string
REDIS_URLYesRedis connection string
ADMIN_TOKENYesBearer token required for all /v1/* admin routes
STS_URLYesInternal URL of the STS service (e.g., http://sts:8080)
INSECURE_STSNofalseSkip TLS verification when calling STS; for internal networks with self-signed certs only
OUTBOX_POLL_MSNo250Milliseconds between outbox poll cycles
OUTBOX_BATCH_SIZENo32Events per outbox poll batch
OUTBOX_MAX_ATTEMPTSNo100Maximum delivery attempts per outbox row before marking dead
TLS_CERT_FILENoPath to TLS certificate PEM
TLS_KEY_FILENoPath to TLS private key PEM
LOG_LEVELNoinfoLog verbosity
PORTNo3000Listening port

VariableRequiredDefaultDescription
DATABASE_URLYesPostgres connection string
REDIS_URLYesRedis connection string
STS_URLYesInternal URL of the STS service
BINDINGS_RELOAD_MSNo30000How often (ms) to reload resource bindings from Postgres
JTI_CACHE_SIZENo10000Maximum entries in the JTI replay cache
TLS_CERT_FILENoPath to TLS certificate PEM
TLS_KEY_FILENoPath to TLS private key PEM
LOG_LEVELNoinfoLog verbosity
PORTNo8081Listening port

VariableRequiredDefaultDescription
DATABASE_URLYesPostgres connection string
REDIS_URLYesRedis connection string
OUTBOX_POLL_MSNo1000Milliseconds between outbox poll cycles
OUTBOX_BATCH_SIZENo50Events per outbox poll batch
OUTBOX_MAX_ATTEMPTSNo10Maximum delivery attempts per outbox row before marking dead
MAX_DEPTHNo10Maximum agent session nesting depth
MAX_CHILDRENNo10Maximum child sessions per parent
MAX_PER_ZONENo50Maximum concurrent agent sessions per zone
MAX_PER_APPNo200Maximum concurrent agent sessions per application
DEFAULT_TTL_SECONDSNo3600Default agent session TTL in seconds
TLS_CERT_FILENoPath to TLS certificate PEM
TLS_KEY_FILENoPath to TLS private key PEM
LOG_LEVELNoinfoLog verbosity
PORTNo4000Listening port

VariableRequiredDefaultDescription
DATABASE_URLYesPostgres connection string
REDIS_URLYesRedis connection string
AUDIT_HMAC_KEYYesHex-encoded key for HMAC-SHA256 chain verification
STREAMS_HMAC_KEYNoHex-encoded key for verifying stream message signatures from STS
AUDIT_RETENTION_DAYSNo365How many days of audit events to retain; partitions older than this are dropped
AUDIT_MAX_DELIVERIESNo5Maximum delivery attempts per audit event before routing to DLQ
AUDIT_EXPORT_S3_BUCKETNoS3 bucket name for Parquet export; export is disabled if unset
AUDIT_EXPORT_S3_ENDPOINTNoAWS defaultS3-compatible endpoint URL (use for MinIO or other non-AWS stores)
AUDIT_EXPORT_S3_REGIONNous-east-1S3 region
AWS_ACCESS_KEY_IDNoAWS credentials for S3 export; uses instance profile if unset
AWS_SECRET_ACCESS_KEYNoAWS credentials for S3 export
TLS_CERT_FILENoPath to TLS certificate PEM
TLS_KEY_FILENoPath to TLS private key PEM
LOG_LEVELNoinfoLog verbosity
PORTNo9090Listening port

caracal.toml is the client-side configuration file used by the CLI. It is discovered in this order:

  1. Path in CARACAL_CONFIG environment variable (if set)
  2. ./caracal.toml in the current working directory
  3. $XDG_CONFIG_HOME/caracal/caracal.toml (defaults to ~/.config/caracal/caracal.toml)
# Required fields
zone_url = "https://your-caracal-api.example.com"
zone_id = "zone-abc123"
application_id = "app-xyz456"
app_client_secret = "secret-..."
# Optional fields
continue_on_failure = false # If true, CLI continues after non-fatal errors
# Named credentials forwarded to external services
[[credentials]]
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
[[optional_credentials]]
env = "SLACK_TOKEN"
resource = "slack"
on_failure = "warn" # "warn" or "error"
# MCP governance mode
[mcp_governance]
mode = "block" # "block" or "log"
FieldTypeRequiredDescription
zone_urlstringYesBase URL of the Caracal API service
zone_idstringYesZone this client operates in
application_idstringYesApplication identity for credential exchange
app_client_secretstringYesClient secret for application authentication
continue_on_failurebooleanNoWhether to continue after non-fatal errors (default: false)
credentialsarrayNoNamed credentials to forward to external services
credentials[].envstringYes (in block)Environment variable containing the credential value
credentials[].resourcestringYes (in block)Resource identifier the credential is for
optional_credentialsarrayNoCredentials that may be absent; controls failure behavior
optional_credentials[].on_failurestringYes (in block)"warn" or "error"
mcp_governance.modestringNo"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' }),
zoneId: 'zone-abc123',
applicationId: 'app-xyz456',
subjectToken: 'subject-jwt-...',
// Optional
gatewayUrl: 'http://localhost:8081',
resources: [
{ resourceId: 'api', upstreamPrefix: 'http://upstream:3000' }
],
defaultKind: 'instance', // AgentKind: 'instance' | 'ephemeral'
defaultTtlSeconds: 3600,
});

CaracalConfig interface:

FieldTypeRequiredDescription
coordinatorCoordinatorClientYesCoordinator connection
zoneIdstringYesZone identifier
applicationIdstringYesApplication identifier
subjectTokenstringYesSubject identity token
gatewayUrlstringNoGateway URL for resource routing
resourcesResourceBinding[]NoResource-to-upstream mappings
defaultKindAgentKindNoDefault agent kind for spawned sessions
defaultTtlSecondsnumberNoDefault TTL for spawned sessions
from caracalai_sdk import Caracal, CaracalConfig, CoordinatorClient, ResourceBinding
client = Caracal(CaracalConfig(
coordinator=CoordinatorClient(base_url='http://localhost:4000'),
zone_id='zone-abc123',
application_id='app-xyz456',
subject_token='subject-jwt-...',
# Optional
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:

FieldTypeRequiredDescription
coordinatorCoordinatorClientYesCoordinator connection
zone_idstrYesZone identifier
application_idstrYesApplication identifier
subject_tokenstrYesSubject identity token
gateway_urlstr | NoneNoGateway URL for resource routing
resourceslist[ResourceBinding]NoResource-to-upstream mappings
default_kindAgentKindNoDefault agent kind for spawned sessions
default_ttl_secondsint | NoneNoDefault TTL for spawned sessions
import (
sdk "github.com/garudex/caracal/packages/sdk/go"
)
client := &sdk.Caracal{
Coordinator: coordinator, // *CoordinatorClient
ZoneID: "zone-abc123",
ApplicationID: "app-xyz456",
SubjectToken: "subject-jwt-...",
// Optional
GatewayURL: "http://localhost:8081",
Resources: []sdk.ResourceBinding{
{ResourceID: "api", UpstreamPrefix: "http://upstream:3000"},
},
DefaultKind: sdk.AgentKindInstance,
DefaultTTLSeconds: 3600,
}

Caracal struct:

FieldTypeRequiredDescription
Coordinator*CoordinatorClientYesCoordinator connection
ZoneIDstringYesZone identifier
ApplicationIDstringYesApplication identifier
SubjectTokenstringYesSubject identity token
GatewayURLstringNoGateway URL for resource routing
Resources[]ResourceBindingNoResource-to-upstream mappings
DefaultKindAgentKindNoDefault agent kind for spawned sessions
DefaultTTLSecondsintNoDefault TTL for spawned sessions

Environment variables that affect the CLI and SDK runtime when caracal.toml is not in use:

VariableDescription
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