Configuration

Configure engine networking, retries, storage, clustering, and production routing.

Environment Variables

API and Webhooks

VariableDefaultDescription
API_HOST0.0.0.0HTTP listen host
API_PORT8080HTTP API port
WEBHOOK_BASE_URLhttp://localhost:8080Base URL the engine uses to construct async callback URLs. Must be reachable from your Step handlers.
LOG_LEVELinfodebug, info, warn, error

Step Execution

VariableDefaultDescription
STEP_TIMEOUT30000Global HTTP Step timeout fallback (ms). Overridden per Step by http.timeout.

Caching

VariableDefaultDescription
MEMO_CACHE_SIZE65536In-memory memoization cache entries (LRU)
TIMEBOX_CACHE_SIZE32768Cached current-state projections shared by Timebox stores

Retry Defaults

Applied when a Step omits retry fields or sets them to zero:

VariableDefaultDescription
RETRY_MAX_RETRIES10Default max retries (cannot be 0)
RETRY_INITIAL_BACKOFF1000Initial backoff in milliseconds (must be > 0)
RETRY_MAX_BACKOFF60000Backoff cap in milliseconds (must be >= RETRY_INITIAL_BACKOFF)
RETRY_BACKOFF_TYPEexponentialfixed, linear, or exponential

Invalid retry defaults fail engine startup.

Raft Storage

VariableDescription
RAFT_NODE_IDLocal node identifier
RAFT_ADDRESSLocal Raft listen address (e.g. 127.0.0.1:9701)
RAFT_DATA_DIRDurable local state directory
RAFT_SERVERSBootstrap cluster members (e.g. node1=host1:9701,node2=host2:9702)
RAFT_LOG_TAIL_SIZENumber of recent write-ahead log entries retained in memory (default 20480)

Clustering

Argyll uses Raft for consensus. Run at least 3 nodes for high availability.

Single Node (development)

RAFT_NODE_ID=argyll-1
RAFT_ADDRESS=127.0.0.1:9701
RAFT_DATA_DIR=/tmp/argyll-raft/argyll-1
RAFT_SERVERS=argyll-1=127.0.0.1:9701

Three-Node Cluster

# On each node, set its own RAFT_NODE_ID and RAFT_ADDRESS,
# but the same RAFT_SERVERS listing all nodes:
RAFT_NODE_ID=argyll-1
RAFT_ADDRESS=argyll-1:9701
RAFT_DATA_DIR=/var/lib/argyll/raft/argyll-1
RAFT_SERVERS=argyll-1=argyll-1:9701,argyll-2=argyll-2:9702,argyll-3=argyll-3:9703

A write is committed only after enough voting nodes accept it. Only the Raft leader accepts writes; reads can be served from any node.

Health Check

GET /health

Returns 200. The response header X-Argyll-Raft-State contains the node’s role: leader, candidate, follower, or unknown. Use this for load balancer routing.

HAProxy Leader-Aware Routing

Route write traffic only to the Raft leader:

backend argyll_write
  option httpchk GET /health
  http-check expect hdr name "X-Argyll-Raft-State" value -m str leader
  server n1 argyll-1:8080 check
  server n2 argyll-2:8080 check
  server n3 argyll-3:8080 check

backend argyll_read
  option httpchk GET /health
  http-check expect status 200
  server n1 argyll-1:8080 check
  server n2 argyll-2:8080 check
  server n3 argyll-3:8080 check

Write paths: mutating /engine/steps and /engine/spaces requests, POST /engine/flows, and POST /callbacks/*. Read-style POSTs like POST /engine/plan and POST /engine/flows/query can go to any node.

Health Checks on Steps

HTTP Steps can declare a health check endpoint:

{
  "http": {
    "invoke": { "endpoint": "https://api.example.com/process" },
    "health": "https://api.example.com/health"
  }
}

The engine polls the health check with GET to track Step availability. Invocation outcomes continue to determine execution success.

Security

Deploy the engine behind an authenticated reverse proxy. Network isolation or mTLS provides service-to-service protection in production.

Lua Script Steps run inside the engine with the io, os, and debug modules excluded. Use only for trusted scripts.