Spec reference

Generated from the Go structs by make schema; the JSON Schema is hikyaku.schema.json. Point your editor at it with # yaml-language-server: $schema=https://xavidop.github.io/hikyaku/schema/hikyaku.schema.json.

Durations read like 500ms, 30s, 5m, 1h, 7d; sizes like 512, 8KiB, 10MB. {{secrets.NAME}} and {{env.NAME}} are replaced when the spec loads; {{ .json.x }} templates run per message.

Top level (hikyaku.yaml)

KeyTypeDescription
version (required)integerSpec format version. Always 1. One of 1.
name (required)stringRelay name. Used in metrics, logs and the shared-state keys.
secretsmap of stringSecrets by name, each a mamori ref (env:NAME, file:///path, vault://…, or a comma-separated chain tried in order, such as env:A,file:///run/a). Reference one as {{secrets.NAME}}.
genkitGenkitGenkit plugins for the AI router.
modelsModelsDefault models, model retries and model fallback chains.
defaultsPolicyDelivery policy inherited by every destination (each field on its own).
sources (required)Source[]Where messages come from.
destinations (required)Destination[]Where messages go.
storesStore[]Shared-state backends (history, decision cache, dedupe, idempotency, budgets), referenced by name. The first one is the default store; with none, an in-process memory store is used.
dead_letterDeadLetterWhere a message goes when a required destination and all its fallbacks failed. Defaults to stderr.
routes (required)Route[]Which destinations get the messages of which sources.
serverServerAdmin API, workers and shutdown.
observabilityObservabilityLogs, OpenTelemetry traces and Prometheus metrics.
bufferBufferThe queue between sources and delivery workers.
egressEgressSSRF guard for destinations whose URL host is a per-message template.
pluginsPluginBinary[]Out-of-process plugins: binaries hikyaku starts and talks gRPC to. Each one adds the source and destination types it declares.
notifyNotify[]Alerts: a message sent to a destination when a message is dead-lettered or a circuit breaker changes.

Source

KeyTypeDescription
name (required)stringUnique source name.
type (required)stringProtocol: http, https, ws, wss, sse, stdin, file (M1); see the protocol matrix for the rest.
modestringlisten (hikyaku is the server), poll (pull on a schedule) or subscribe (long-lived client). Defaults per protocol. One of listen, poll, subscribe.
listenstringlisten: address, such as :8080.
pathstringlisten: request path (default /); file: the file to read.
methodsstring[]http listen: accepted methods (default POST, PUT).
tlsTLSTLS (and mTLS with client_ca_file) for listen, DTLS for udp; client TLS for poll and subscribe.
authAuthInbound authentication of listen sources.
ackstringdelivered (default) or accepted. http and grpc listen: delivered answers once the message is delivered or dead-lettered, accepted as soon as it is queued (on disk with a disk buffer). Subscribe sources: delivered acknowledges the broker once the outcome is final, accepted once the message is queued (safe with buffer.type: disk only). One of delivered, accepted.
respondRespondhttp and grpc listen: send a destination’s reply back to the caller (smart reverse proxy; grpc maps it into the method’s output type).
max_body_bytesSizeLargest accepted message (default 10MiB; grpc and openai 4MiB; tcp, udp and mqtt 1MiB). A listen source refuses a larger one (http 413, grpc RESOURCE_EXHAUSTED); a subscribe or poll source logs it and acknowledges it, so it cannot loop forever.
urlstringpoll or subscribe: the endpoint.
headersmap of stringpoll or subscribe: request headers.
oauth2OAuth2http poll: fetch an OAuth 2.0 access token with the client credentials grant and send it as a bearer token on every poll.
methodstringpoll: request method (default GET).
bodystringpoll: request body.
intervalDurationpoll: time between polls (default 30s).
timeoutDurationpoll (http, s3, gcs): per-request timeout (default 10s).
retryRetrypoll (http, s3): retries per poll before skipping to the next interval. gcs retries its reads itself.
dedupeDedupeDrop messages whose key was seen within the ttl, on any source (poll dedupe, cross-replica idempotency). A duplicate is acked as filtered and counted in hikyaku_deduped_total.
splitstringpoll: jq expression that splits one response into several messages, such as .items[]. s3, gcs: also lines, one message per non-empty line of an object (NDJSON).
reconnectReconnectsubscribe: reconnect policy.
failover_urlsstring[]subscribe (ws, wss, sse, grpc, nats, jetstream, mqtt, amqp, redis): URLs rotated through when the primary is down.
formatstringstdin and file: each line is a message body (default) or an envelope in wire form. One of body, envelope.
followbooleanfile: keep reading lines appended to the file.
brokersstring[]kafka: bootstrap brokers (host:port).
topicstringkafka, mqtt: the topic (mqtt: a topic filter); eventhubs: the event hub; servicebus: the topic (with subscription).
topicsstring[]kafka, mqtt: several topics (mqtt: filters) instead of topic.
groupstringkafka, redis streams, eventhubs: consumer group; mqtt v5: shared subscription group ($share//).
startstringWhere a new consumer starts. kafka, redis streams, eventhubs: earliest or latest (default latest); jetstream: all, new (default) or last. One of earliest, latest, all, new, last.
saslSASLkafka: SASL authentication.
usernamestringmqtt, nats, redis, amqp: user name (mqtt, amqp and redis also take it in the URL; this field wins).
passwordstringmqtt, nats, redis, amqp, smtp: password; use {{secrets.X}}.
tokenstringnats: authentication token; use {{secrets.X}}.
creds_filestringnats: a .creds file (JWT and NKey seed).
subjectstringnats: subject (wildcards * and > allowed); jetstream: filter subject of the consumer.
queuestringnats: queue group (members share the messages); amqp: the queue consumed; servicebus: the queue.
prefetchintegerMessages a subscribe source keeps in flight: amqp prefetch, jetstream max_ack_pending, redis streams entries read and not acknowledged, kafka records buffered, mqtt v5 receive maximum, pubsub max outstanding, servicebus prefetch (default 64); nats: messages buffered before the client drops them (default 65536). sqs: messages per receive, 1 to 10 (default 10).
ack_waitDurationjetstream: redelivery delay of an unacknowledged message; redis streams: how long a pending entry stays idle before it is reclaimed and delivered again (default 30s for both).
streamstringjetstream: the stream; redis: the stream key (XREADGROUP).
consumerstringredis streams: this consumer’s name in the group (default -); keep it stable, a restart resumes the entries it left pending.
durablestringjetstream: durable consumer name, so a restart resumes where it stopped (default the source name).
channelstringredis pub/sub: channel, or a pattern with * (PSUBSCRIBE).
qosintegermqtt: subscription QoS (default 1). One of 0, 1, 2.
client_idstringmqtt: client identifier, which keys a persistent session; kafka: client.id. Default hikyaku--.
clean_sessionbooleanmqtt: start a clean session (default false: the broker keeps the session and queued QoS 1/2 messages across reconnects).
protocol_versionstringmqtt: protocol version (default 5). One of 3.1.1, 5.
exchangestringamqp: exchange the queue is bound to (with routing_key).
routing_keystringamqp: binding key of the queue on exchange.
declarebooleanamqp: declare the queue (durable) and its binding when missing.
descriptor_setstringgrpc: a FileDescriptorSet file (protoc —descriptor_set_out —include_imports) describing the services.
servicesstring[]grpc listen: the services of descriptor_set to serve (default all); hikyaku.relay.v1.Relay is always served.
reflectionbooleangrpc listen: serve the reflection service (default true); subscribe: resolve method through server reflection when there is no descriptor_set (default true).
framestringtcp, udp: framing. newline (default): one message per line; length: each message after a length_bytes big-endian length; raw: tcp, a connection’s whole stream; udp, each datagram. One of newline, length, raw.
length_bytesintegertcp, udp: size of the length prefix with frame: length (default 4). One of 1, 2, 4, 8.
queue_urlstringsqs: the queue URL. sns, eventbridge: the SQS queue subscribed to the topic or rule.
wait_timeDurationsqs: long-poll wait (default 20s, at most 20s).
visibility_timeoutDurationsqs: how long a received message stays hidden (default the queue’s).
bucketstrings3, gcs: the bucket polled.
prefixstrings3, gcs: only objects under this prefix.
afterstrings3, gcs: what happens to an object once its messages are final: keep (remembered in state_store), delete (default) or move (to move_to). One of keep, delete, move.
move_tostrings3, gcs: prefix objects are moved under with after: move.
state_storestringStore (by name) that keeps a source’s progress: eventhubs checkpoints, s3/gcs objects already read with after: keep. Default the first store.
subscriptionstringpubsub: the subscription; servicebus: the topic subscription.
awsAWSsqs, sns, eventbridge, s3: AWS region and credentials (default the SDK’s chain).
gcpGCPpubsub, gcs: project and credentials (default Application Default Credentials).
azureAzureservicebus, eventhubs: connection string or namespace and credentials.
modelsstring[]openai: the model names /v1/models lists and clients may ask for (default [hikyaku]); route on msg.json.model.
cronstringschedule: when to emit a message, as a five-field cron expression (minute hour day-of-month month day-of-week) or @hourly, @daily, @weekly, @monthly, @yearly. Set cron or interval.
timezonestringschedule: the time zone cron is read in, such as Europe/Madrid (default UTC).
orderingOrderingDeliver messages with the same key one at a time, in arrival order.
optionsobjectSettings of a plugin type (a source registered by a custom build); the plugin decodes and validates them.

Destination

KeyTypeDescription
name (required)stringUnique destination name.
type (required)stringProtocol: http, https, ws, wss, sse, stdout, stderr, file, fault, group, grpc, tcp, udp, kafka, nats, jetstream, mqtt, amqp, redis, sqs, sns, eventbridge, s3, pubsub, gcs, servicebus, eventhubs, model, or a plugin’s type.
urlstringhttp/ws: target URL, which may contain per-message templates (hosts are checked against egress). grpc: grpc://host:port or grpcs://; tcp: tcp://host:port or tls://; udp: udp://host:port or dtls://; nats, mqtt, amqp, redis: the server URL.
methodstringhttp: method (default POST); grpc: full method name, /package.Service/Method.
headersmap of stringHeaders set on every request; values may be per-message templates.
bodystringPer-message template of the outgoing body (default: the message body).
tlsTLSClient TLS, DTLS for udp (mTLS with cert_file and key_file).
signSignhttp: sign every request with an HMAC of its body, so the receiver can check who sent it.
fromstringsmtp: the sender, as an address or as Name
.
tostring[]smtp: the recipients. Each entry is a per-message template that renders one address, or several separated by commas.
oauth2OAuth2http: fetch an OAuth 2.0 access token with the client credentials grant and send it as a bearer token.
pathstringfile: the file appended to; sse: the stream path (default /).
listenstringsse: address the event stream is served on.
formatstringfile/stdout/stderr: write each message as an envelope line (default) or its body. One of envelope, body.
framestringws: frame type, text (default) or binary. tcp, udp: framing, newline (default), length (a length_bytes big-endian prefix) or raw. One of text, binary, newline, length, raw.
eventstringsse: per-message template of the event name.
replayintegersse: events kept for Last-Event-ID resume (default 1000).
authAuthsse: authentication of the clients that read the stream: bearer, api_key, jwt, ip_allow (401 on failure; hmac does not apply).
faultFaultfault: the faults injected (local testing and the resilience suite).
brokersstring[]kafka: bootstrap brokers (host:port).
topicstringPer-message template of the topic. kafka, mqtt, pubsub: the topic; sns: the topic ARN; eventhubs: the event hub; servicebus: the topic.
keystringPer-message template of the message key. kafka: record key (partitioning); pubsub: ordering key; eventhubs: partition key; s3, gcs: object key (default //.json, or .ndjson for a batch).
saslSASLkafka: SASL authentication.
usernamestringmqtt, nats, redis, amqp, smtp: user name.
passwordstringmqtt, nats, redis, amqp, smtp: password; use {{secrets.X}}.
tokenstringnats: authentication token; use {{secrets.X}}.
creds_filestringnats: a .creds file (JWT and NKey seed).
subjectstringPer-message template of the subject. nats, jetstream: the subject published to; sns: the message subject; smtp: the email’s subject.
acksstringkafka: acknowledgements a produce waits for (default all, with the idempotent producer). One of all, leader, none.
compressionstringkafka: batch compression (default none). http: gzip compresses the request body and sets Content-Encoding (default none). One of none, gzip, snappy, lz4, zstd.
qosintegermqtt: publish QoS (default 1). One of 0, 1, 2.
retainbooleanmqtt: publish retained messages.
client_idstringmqtt: client identifier; kafka: client.id. Default hikyaku--.
protocol_versionstringmqtt: protocol version (default 5). One of 3.1.1, 5.
exchangestringamqp: exchange published to (default the default exchange, which routes by queue name).
routing_keystringamqp: per-message template of the routing key.
persistentbooleanamqp: persistent delivery mode (default true).
mandatorybooleanamqp: fail a message no queue is bound to receive (a permanent error) instead of dropping it.
declarebooleanamqp: declare the exchange (topic, durable) when missing.
streamstringredis: stream key appended to (XADD); jetstream: the stream a publish must land in (an expected-stream check).
channelstringredis: pub/sub channel published to; a per-message template.
max_lenintegerredis streams: approximate length the stream is trimmed to (MAXLEN ~).
descriptor_setstringgrpc: a FileDescriptorSet file describing method’s service.
reflectionbooleangrpc: resolve method through server reflection when there is no descriptor_set (default true).
length_bytesintegertcp, udp: size of the length prefix with frame: length (default 4). One of 1, 2, 4, 8.
queue_urlstringsqs: the queue URL.
group_idstringPer-message template of the ordering group. sqs, sns FIFO: message group ID; servicebus: session ID.
delayDurationsqs: delivery delay (at most 15m).
event_busstringeventbridge: event bus name or ARN (default the account’s default bus).
event_sourcestringeventbridge: the events’ source field (default hikyaku.).
detail_typestringeventbridge: per-message template of the detail-type (default the message subject, else hikyaku.message).
bucketstrings3, gcs: the bucket written to.
content_typestrings3, gcs: the objects’ content type (default the message’s).
queuestringservicebus: the queue (or topic).
awsAWSsqs, sns, eventbridge, s3: AWS region and credentials (default the SDK’s chain).
gcpGCPpubsub, gcs: project and credentials (default Application Default Credentials).
azureAzureservicebus, eventhubs: connection string or namespace and credentials.
modelstringmodel: the Genkit model that answers, provider/name (googleai/gemini-2.5-flash, openai/gpt-4o-mini, openrouter/anthropic/claude-sonnet-4.5, ollama/llama3.2).
generationGenerationmodel: generation settings applied when the request does not set them.
optionsobjectSettings of a plugin type (a destination registered by a custom build); the plugin decodes and validates them.
timeoutDurationPer-attempt timeout (default 5s).
deadlineDurationOverall budget across attempts and fallbacks (default none).
retryRetryRetry policy per endpoint.
circuit_breakerCircuitBreakerCircuit breaker per endpoint.
retry_budgetRetryBudgetCaps retries as a fraction of traffic.
fallbackstring[]Destinations tried in order after this one exhausts its retries, fails permanently, has its breaker open, its budget spent or its deadline hit.
requiredbooleanA required destination (default) must succeed, on its primary or a fallback, before the message is acked; a failure goes to the DLQ. A best-effort one is counted and logged.
idempotentbooleanThe endpoint dedupes by idempotency key; required for hedging.
idempotency_headerstringHeader carrying the idempotency key (default Idempotency-Key).
transformsTransform[]Transforms applied before delivering here.
strategystringgroup: how members are picked (default failover). One of failover, round_robin, weighted, least_latency.
membersMember[]group: the endpoints.
health_checkHealthCheckgroup: active health checks; unhealthy members are skipped until they recover.
hedgeHedgegroup: race another member when the first is slow (idempotent destinations only).
deliver_afterDurationHold each message of a route this long before delivering it here, counted from when it was received.
deliver_atstringPer-message template of the time to deliver at, in RFC 3339 (2026-12-24T09:00:00Z). A message it renders empty for follows deliver_after, or goes at once.
rate_limitRateLimitSend at most this many requests per second; the others wait their turn.
shadowbooleanA shadow destination gets a copy of what the routes send it, on the side: its failures never hold up, fail or dead-letter a message. For trying a new consumer against real traffic.
samplenumbershadow: the share of messages copied, from above 0 to 1 (0.05 is 5%; default 1, every message).
batchBatchDeliver messages in batches: one request (one Kafka produce, one SQS SendMessageBatch, one S3 object, one HTTP body) per batch.

Member

KeyTypeDescription
namestringMember name (default []).
weightintegerweighted: relative share (default 1).
type (required)stringProtocol: http, https, ws, wss, sse, stdout, stderr, file, fault, group, grpc, tcp, udp, kafka, nats, jetstream, mqtt, amqp, redis, sqs, sns, eventbridge, s3, pubsub, gcs, servicebus, eventhubs, model, or a plugin’s type.
urlstringhttp/ws: target URL, which may contain per-message templates (hosts are checked against egress). grpc: grpc://host:port or grpcs://; tcp: tcp://host:port or tls://; udp: udp://host:port or dtls://; nats, mqtt, amqp, redis: the server URL.
methodstringhttp: method (default POST); grpc: full method name, /package.Service/Method.
headersmap of stringHeaders set on every request; values may be per-message templates.
bodystringPer-message template of the outgoing body (default: the message body).
tlsTLSClient TLS, DTLS for udp (mTLS with cert_file and key_file).
signSignhttp: sign every request with an HMAC of its body, so the receiver can check who sent it.
fromstringsmtp: the sender, as an address or as Name
.
tostring[]smtp: the recipients. Each entry is a per-message template that renders one address, or several separated by commas.
oauth2OAuth2http: fetch an OAuth 2.0 access token with the client credentials grant and send it as a bearer token.
pathstringfile: the file appended to; sse: the stream path (default /).
listenstringsse: address the event stream is served on.
formatstringfile/stdout/stderr: write each message as an envelope line (default) or its body. One of envelope, body.
framestringws: frame type, text (default) or binary. tcp, udp: framing, newline (default), length (a length_bytes big-endian prefix) or raw. One of text, binary, newline, length, raw.
eventstringsse: per-message template of the event name.
replayintegersse: events kept for Last-Event-ID resume (default 1000).
authAuthsse: authentication of the clients that read the stream: bearer, api_key, jwt, ip_allow (401 on failure; hmac does not apply).
faultFaultfault: the faults injected (local testing and the resilience suite).
brokersstring[]kafka: bootstrap brokers (host:port).
topicstringPer-message template of the topic. kafka, mqtt, pubsub: the topic; sns: the topic ARN; eventhubs: the event hub; servicebus: the topic.
keystringPer-message template of the message key. kafka: record key (partitioning); pubsub: ordering key; eventhubs: partition key; s3, gcs: object key (default //.json, or .ndjson for a batch).
saslSASLkafka: SASL authentication.
usernamestringmqtt, nats, redis, amqp, smtp: user name.
passwordstringmqtt, nats, redis, amqp, smtp: password; use {{secrets.X}}.
tokenstringnats: authentication token; use {{secrets.X}}.
creds_filestringnats: a .creds file (JWT and NKey seed).
subjectstringPer-message template of the subject. nats, jetstream: the subject published to; sns: the message subject; smtp: the email’s subject.
acksstringkafka: acknowledgements a produce waits for (default all, with the idempotent producer). One of all, leader, none.
compressionstringkafka: batch compression (default none). http: gzip compresses the request body and sets Content-Encoding (default none). One of none, gzip, snappy, lz4, zstd.
qosintegermqtt: publish QoS (default 1). One of 0, 1, 2.
retainbooleanmqtt: publish retained messages.
client_idstringmqtt: client identifier; kafka: client.id. Default hikyaku--.
protocol_versionstringmqtt: protocol version (default 5). One of 3.1.1, 5.
exchangestringamqp: exchange published to (default the default exchange, which routes by queue name).
routing_keystringamqp: per-message template of the routing key.
persistentbooleanamqp: persistent delivery mode (default true).
mandatorybooleanamqp: fail a message no queue is bound to receive (a permanent error) instead of dropping it.
declarebooleanamqp: declare the exchange (topic, durable) when missing.
streamstringredis: stream key appended to (XADD); jetstream: the stream a publish must land in (an expected-stream check).
channelstringredis: pub/sub channel published to; a per-message template.
max_lenintegerredis streams: approximate length the stream is trimmed to (MAXLEN ~).
descriptor_setstringgrpc: a FileDescriptorSet file describing method’s service.
reflectionbooleangrpc: resolve method through server reflection when there is no descriptor_set (default true).
length_bytesintegertcp, udp: size of the length prefix with frame: length (default 4). One of 1, 2, 4, 8.
queue_urlstringsqs: the queue URL.
group_idstringPer-message template of the ordering group. sqs, sns FIFO: message group ID; servicebus: session ID.
delayDurationsqs: delivery delay (at most 15m).
event_busstringeventbridge: event bus name or ARN (default the account’s default bus).
event_sourcestringeventbridge: the events’ source field (default hikyaku.).
detail_typestringeventbridge: per-message template of the detail-type (default the message subject, else hikyaku.message).
bucketstrings3, gcs: the bucket written to.
content_typestrings3, gcs: the objects’ content type (default the message’s).
queuestringservicebus: the queue (or topic).
awsAWSsqs, sns, eventbridge, s3: AWS region and credentials (default the SDK’s chain).
gcpGCPpubsub, gcs: project and credentials (default Application Default Credentials).
azureAzureservicebus, eventhubs: connection string or namespace and credentials.
modelstringmodel: the Genkit model that answers, provider/name (googleai/gemini-2.5-flash, openai/gpt-4o-mini, openrouter/anthropic/claude-sonnet-4.5, ollama/llama3.2).
generationGenerationmodel: generation settings applied when the request does not set them.
optionsobjectSettings of a plugin type (a destination registered by a custom build); the plugin decodes and validates them.

Policy

KeyTypeDescription
timeoutDurationPer-attempt timeout (default 5s).
deadlineDurationOverall budget across attempts and fallbacks (default none).
retryRetryRetry policy per endpoint.
circuit_breakerCircuitBreakerCircuit breaker per endpoint.
retry_budgetRetryBudgetCaps retries as a fraction of traffic.

Retry

KeyTypeDescription
attemptsintegerTries per endpoint; 1 means no retry (default 5).
backoffDurationBase wait, doubled per try (default 200ms).
max_backoffDurationCap on the wait (default 10s).
jitterstringfull (default): random in [0, wait]; equal: wait/2 + random half; none. One of full, equal, none.
retry_onTagListError tags retried (default connect, timeout, 5xx, 429): ranges (5xx), codes (503), classes (connect, timeout) and protocol codes (ws:close_1011).
never_onTagListError tags never retried (default 4xx). A more specific retry_on tag wins, so 429 and 408 still retry.
respect_retry_afterbooleanWait what Retry-After (or a broker hint) says, capped by max_backoff (default true).

CircuitBreaker

KeyTypeDescription
enabledbooleanDefault true.
failure_rationumberOpen when failures/requests in the window reach this (default 0.5).
min_requestsintegerRequests in the window before the ratio counts (default 20).
open_forDurationHow long the breaker stays open (default 30s).
half_open_maxintegerTrial requests while half-open (default 5).
windowDurationRolling window of the failure ratio (default 60s).

RetryBudget

KeyTypeDescription
enabledbooleanDefault true.
rationumberRetries allowed per first attempt in the window (default 0.2).
min_per_secondnumberRetries always allowed per second (default 10).
storestringStore that shares the counters across replicas (default: in-process).

Route

KeyTypeDescription
name (required)stringUnique route name.
from (required)string[]Source names.
tostring[]Shortcut for a static router.
filterstringCEL expression over msg; false skips the route.
transformsTransform[]Transforms applied before routing.
routerRouterSpecThe router; default static over to:.

RouterSpec

KeyTypeDescription
type (required)stringstatic, rules (CEL), ai, or sticky (last destinations of the history key). One of static, rules, ai, sticky.
whenstringCEL condition over msg: only the messages it is true for reach this router; the others skip it, with no call, and go to the next router of the fallback chain. On an ai router it keeps model spend to the messages that need a model, such as has(msg.json.text), msg.headers[“X-Priority”] == “high” or msg.json.tier == “enterprise”. A condition that cannot be evaluated (a missing field) counts as false.
tostring[]static: destinations.
rulesRule[]rules: evaluated in order.
matchstringrules: first matching rule (default) or every match. One of first, all.
defaultstring[]rules: destinations when no rule matches (else the router fails over).
enginestringai: decision (System One, default) or generative (GenerateData on any model). One of decision, generative.
modelstringai: model (default models.decision or models.default).
fallback_modelsstring[]ai: overrides the global model fallback chain.
instructionsstringai: the system message, in front of every question.
statestringai: per-message template of what the model evaluates (default {{ .bodyText }}).
state_jsonbooleanai: the state is JSON (sent as an object).
candidatesCandidate[]ai: the destinations the model may pick, each with what it is for.
multibooleanai: true asks one yes/no per candidate (in one request) and delivers to every one above min_confidence; false asks one choice.
min_confidencenumberai: lowest probability accepted.
min_marginnumberai, single choice: top minus second must exceed this.
inputAIInputai: how the state is built.
timeoutDurationai: budget of the whole AI step, model fallbacks included (default 10s).
cacheCacheai: decision cache.
historyHistoryai and sticky: route with past calls of a key.
on_low_confidencestring[]ai: destinations when the model answered but was not sure.
fallback_on_low_confidencebooleanai: hand low-confidence answers to the router fallback instead of on_low_confidence.
shadowbooleanai: decide and log, but deliver through the fallback chain.
budgetAIBudgetai: when exceeded, the route goes straight to the router fallback.
fallbackRouterSpec[]Routers tried in order when this one errors, times out, is over budget or (fallback_on_low_confidence) is unsure.

Rule

KeyTypeDescription
when (required)stringCEL expression over msg (msg.json, msg.headers, msg.subject, msg.source, …).
to (required)string[]Destinations when it holds.

Candidate

KeyTypeDescription
name (required)stringA declared destination.
description (required)stringWhat it is for: the option’s criteria.

AIInput

KeyTypeDescription
max_bytesSizeCap on the whole state, history included (default 8KiB): oldest turns go first.
redactstring[]JSONPaths removed from a JSON state, such as $.card.number.
headersstring[]Headers included in the state (allowlist).

Cache

KeyTypeDescription
storestringShared store; default an in-process LRU.
keystringPer-message template of the cache key (default: a hash of the state).
ttlDurationDefault 10m.
sizeintegerLRU entries (default 10000).

History

KeyTypeDescription
storestringStore of the history (default store).
key (required)stringPer-message template of whose history: customer, conversation, session, device.
windowWindowWhat is sent to the model.
ttl (required)DurationHow long records are kept. Mandatory.
recordHistoryRecordWhat is stored.
stickyStickySend follow-ups where the previous call went.
on_store_errorstringignore (default): route without history; fallback: use router.fallback. One of ignore, fallback.

Window

KeyTypeDescription
max_entriesintegerNewest records sent (default 10).
max_ageDurationOldest record sent.

HistoryRecord

KeyTypeDescription
statestringredacted (default): the redacted state; summary: the summary template; none: only decision and outcome. One of redacted, summary, none.
summarystringPer-message template of the summary, such as {{ .json.type }} / {{ .json.subject }}.

Sticky

KeyTypeDescription
enabledbooleanTurn sticky routing on.
modestringmodel (default): ask the model whether it is a follow-up; always_last: always reuse the last destinations, no model call. One of model, always_last, off.
follow_up_thresholdnumberFollow-up probability needed (default 0.8).

AIBudget

KeyTypeDescription
max_calls_per_minuteintegerModel calls per minute.
max_tokens_per_hourintegerModel tokens per hour.
storestringStore that shares the counters across replicas (default: in-process).

Transform

KeyTypeDescription
filterstringCEL expression; false drops the message from this route or destination.
jqstringjq program over the JSON body; its output is the new body.
templatestringGo template rendered as the new body.
headersHeaderOpsSet, add or remove headers (values are templates).
codecstringRe-encode the body. One of json, text, base64_encode, base64_decode, form_to_json, cloudevents.
content_typestringSet the content type (alone, or after jq or template).
redactstring[]JSONPaths whose values are replaced with [redacted] in the JSON body, such as $.card.number or $..email.
validateSchemaCheckCheck the JSON body against a JSON Schema; a body that does not match is a failure.
enrichEnrichCall an HTTP endpoint and put its JSON answer into the JSON body.

HeaderOps

KeyTypeDescription
setmap of stringReplace.
addmap of stringAppend.
removestring[]Delete.

Store

KeyTypeDescription
name (required)stringUnique store name.
type (required)stringredis, or memory (in-process: local runs and tests). One of redis, memory.
addrstringredis standalone: host:port.
sentinelSentinelredis Sentinel.
clusterClusterredis Cluster.
usernamestringACL user.
passwordstringPassword, usually {{secrets.NAME}}.
tlsTLSTLS to Redis.
dbintegerDatabase number (standalone and Sentinel).
key_prefixstringKey prefix (default hikyaku).
timeoutDurationPer-operation timeout (default 50ms): reads must never stall routing.
retryRetryRetries per operation (default attempts 2, backoff 10ms).
circuit_breakerCircuitBreakerStops hammering a dead store (default on).

DeadLetter

KeyTypeDescription
type (required)stringProtocol: http, https, ws, wss, sse, stdout, stderr, file, fault, group, grpc, tcp, udp, kafka, nats, jetstream, mqtt, amqp, redis, sqs, sns, eventbridge, s3, pubsub, gcs, servicebus, eventhubs, model, or a plugin’s type.
urlstringhttp/ws: target URL, which may contain per-message templates (hosts are checked against egress). grpc: grpc://host:port or grpcs://; tcp: tcp://host:port or tls://; udp: udp://host:port or dtls://; nats, mqtt, amqp, redis: the server URL.
methodstringhttp: method (default POST); grpc: full method name, /package.Service/Method.
headersmap of stringHeaders set on every request; values may be per-message templates.
bodystringPer-message template of the outgoing body (default: the message body).
tlsTLSClient TLS, DTLS for udp (mTLS with cert_file and key_file).
signSignhttp: sign every request with an HMAC of its body, so the receiver can check who sent it.
fromstringsmtp: the sender, as an address or as Name
.
tostring[]smtp: the recipients. Each entry is a per-message template that renders one address, or several separated by commas.
oauth2OAuth2http: fetch an OAuth 2.0 access token with the client credentials grant and send it as a bearer token.
pathstringfile: the file appended to; sse: the stream path (default /).
listenstringsse: address the event stream is served on.
formatstringfile/stdout/stderr: write each message as an envelope line (default) or its body. One of envelope, body.
framestringws: frame type, text (default) or binary. tcp, udp: framing, newline (default), length (a length_bytes big-endian prefix) or raw. One of text, binary, newline, length, raw.
eventstringsse: per-message template of the event name.
replayintegersse: events kept for Last-Event-ID resume (default 1000).
authAuthsse: authentication of the clients that read the stream: bearer, api_key, jwt, ip_allow (401 on failure; hmac does not apply).
faultFaultfault: the faults injected (local testing and the resilience suite).
brokersstring[]kafka: bootstrap brokers (host:port).
topicstringPer-message template of the topic. kafka, mqtt, pubsub: the topic; sns: the topic ARN; eventhubs: the event hub; servicebus: the topic.
keystringPer-message template of the message key. kafka: record key (partitioning); pubsub: ordering key; eventhubs: partition key; s3, gcs: object key (default //.json, or .ndjson for a batch).
saslSASLkafka: SASL authentication.
usernamestringmqtt, nats, redis, amqp, smtp: user name.
passwordstringmqtt, nats, redis, amqp, smtp: password; use {{secrets.X}}.
tokenstringnats: authentication token; use {{secrets.X}}.
creds_filestringnats: a .creds file (JWT and NKey seed).
subjectstringPer-message template of the subject. nats, jetstream: the subject published to; sns: the message subject; smtp: the email’s subject.
acksstringkafka: acknowledgements a produce waits for (default all, with the idempotent producer). One of all, leader, none.
compressionstringkafka: batch compression (default none). http: gzip compresses the request body and sets Content-Encoding (default none). One of none, gzip, snappy, lz4, zstd.
qosintegermqtt: publish QoS (default 1). One of 0, 1, 2.
retainbooleanmqtt: publish retained messages.
client_idstringmqtt: client identifier; kafka: client.id. Default hikyaku--.
protocol_versionstringmqtt: protocol version (default 5). One of 3.1.1, 5.
exchangestringamqp: exchange published to (default the default exchange, which routes by queue name).
routing_keystringamqp: per-message template of the routing key.
persistentbooleanamqp: persistent delivery mode (default true).
mandatorybooleanamqp: fail a message no queue is bound to receive (a permanent error) instead of dropping it.
declarebooleanamqp: declare the exchange (topic, durable) when missing.
streamstringredis: stream key appended to (XADD); jetstream: the stream a publish must land in (an expected-stream check).
channelstringredis: pub/sub channel published to; a per-message template.
max_lenintegerredis streams: approximate length the stream is trimmed to (MAXLEN ~).
descriptor_setstringgrpc: a FileDescriptorSet file describing method’s service.
reflectionbooleangrpc: resolve method through server reflection when there is no descriptor_set (default true).
length_bytesintegertcp, udp: size of the length prefix with frame: length (default 4). One of 1, 2, 4, 8.
queue_urlstringsqs: the queue URL.
group_idstringPer-message template of the ordering group. sqs, sns FIFO: message group ID; servicebus: session ID.
delayDurationsqs: delivery delay (at most 15m).
event_busstringeventbridge: event bus name or ARN (default the account’s default bus).
event_sourcestringeventbridge: the events’ source field (default hikyaku.).
detail_typestringeventbridge: per-message template of the detail-type (default the message subject, else hikyaku.message).
bucketstrings3, gcs: the bucket written to.
content_typestrings3, gcs: the objects’ content type (default the message’s).
queuestringservicebus: the queue (or topic).
awsAWSsqs, sns, eventbridge, s3: AWS region and credentials (default the SDK’s chain).
gcpGCPpubsub, gcs: project and credentials (default Application Default Credentials).
azureAzureservicebus, eventhubs: connection string or namespace and credentials.
modelstringmodel: the Genkit model that answers, provider/name (googleai/gemini-2.5-flash, openai/gpt-4o-mini, openrouter/anthropic/claude-sonnet-4.5, ollama/llama3.2).
generationGenerationmodel: generation settings applied when the request does not set them.
optionsobjectSettings of a plugin type (a destination registered by a custom build); the plugin decodes and validates them.
retryRetryRetries of a DLQ write (default attempts 3).
fallbackstring[]Tried in order when the DLQ fails: destination names, or stdout / stderr. A message is acked only once some hop has it.

APIKeyAuth

KeyTypeDescription
headerstringHeader (default X-API-Key).
querystringA query parameter that may carry the key when the header is absent, for clients that cannot set headers (a browser’s EventSource or WebSocket). URLs end up in proxy logs: prefer the header when the client can send one.
keys (required)string[]Accepted keys.

AWS

KeyTypeDescription
regionstringRegion (default the SDK’s: AWS_REGION, the profile).
endpointstringCustom endpoint URL, such as LocalStack’s http://localhost:4566.
access_key_idstringStatic credentials (with secret_access_key); use {{secrets.X}}.
secret_access_keystringStatic credentials; use {{secrets.X}}.
session_tokenstringSession token of temporary static credentials.
profilestringShared config profile.
role_arnstringRole assumed (STS) on top of the base credentials.

Admin

KeyTypeDescription
listenstringAddress (default :9090).
tokenstringBearer token for mutating and history endpoints; without one they answer loopback only.
disabledbooleanDo not serve the admin API.

Auth

KeyTypeDescription
hmacHMACAuthVerify an HMAC signature of the body.
bearerBearerAuthRequire a bearer token.
jwtJWTAuthVerify a JWT against a JWKS.
api_keyAPIKeyAuthRequire an API key header.
webhookWebhookAuthVerify the signature of a well-known webhook sender (http sources).
ip_allowstring[]Allowed client IPs or CIDRs.

Azure

KeyTypeDescription
connection_stringstringConnection string (Endpoint=sb://…;SharedAccessKeyName=…;SharedAccessKey=…); use {{secrets.X}}.
namespacestringFully qualified namespace (.servicebus.windows.net), with Microsoft Entra credentials.
tenant_idstringClient secret credentials: tenant (default: the SDK’s DefaultAzureCredential).
client_idstringClient secret credentials: application (client) ID.
client_secretstringClient secret credentials: secret; use {{secrets.X}}.

Batch

KeyTypeDescription
max_messagesintegerMessages per batch (default 100).
max_bytesSizeBody bytes per batch (default 1MiB).
max_waitDurationHow long a batch waits to fill after its first message (default 1s).
formatstringBody of a batch for protocols without native batches (http, ws, file, …): ndjson (default), one body per line, or json_array of the bodies. One of ndjson, json_array.

BearerAuth

KeyTypeDescription
tokens (required)string[]Accepted tokens.

Buffer

KeyTypeDescription
typestringmemory (default) or disk: a bbolt write-ahead log, so queued messages survive a crash or restart and are delivered when the relay starts again. One of memory, disk.
sizeintegerQueued messages (default 10000); listen sources answer 503 when full.
pathstringdisk: the write-ahead log file (required with disk; one relay per file).
syncbooleandisk: fsync every write before the message counts as queued (default true). false is faster but a host crash (not a process crash) can lose the last writes.

Cluster

KeyTypeDescription
addrs (required)string[]Seed node addresses.

Dedupe

KeyTypeDescription
key (required)stringPer-message template of the dedupe key, such as {{ .json.id }}.
ttlDurationHow long a key is remembered (default 1h).
storestringStore that shares keys across replicas (default store).

Egress

KeyTypeDescription
allowstring[]Hosts (exact, or *.suffix) and CIDRs a templated URL may reach.
allow_privatebooleanLet templated URLs reach private, loopback and link-local addresses.

Enrich

KeyTypeDescription
url (required)stringThe endpoint to call, a per-message template such as https://crm.internal/customers/{{ .json.customer_id }}.
methodstringGET (default), or POST, which sends the message body. One of GET, POST.
headersmap of stringRequest headers (values are templates).
into (required)stringWhere the answer goes in the JSON body: a key, or a dotted path such as meta.customer.
timeoutDurationHow long the call may take (default 2s).
cacheDurationKeep each URL’s answer this long, in this process, and skip the call meanwhile (GET only; default: no cache).
on_errorstringWhen the call fails: fail (default) fails the transform, skip lets the message go on without the answer. One of fail, skip.

Fault

KeyTypeDescription
failPercentShare of attempts that fail, such as 50%.
fail_firstintegerFail the first N attempts, then follow fail.
latencyDurationAdded to every attempt.
errorstringHow an attempt fails (default status). One of status, connect, timeout.
statusintegerStatus of a failed attempt (default 503).
retry_afterDurationRetry-After hint of a failed attempt.
seedintegerRandom seed, for repeatable runs.

GCP

KeyTypeDescription
projectstringProject ID (pubsub: required).
credentials_filestringService account key file (default Application Default Credentials).
credentials_jsonstringService account key JSON; use {{secrets.X}}.
endpointstringCustom endpoint, such as an emulator’s localhost:8085 (pubsub) or http://localhost:4443/storage/v1/ (gcs).

Generation

KeyTypeDescription
temperaturenumberSampling temperature.
max_tokensintegerMaximum output tokens.
top_pnumberNucleus sampling probability mass.
systemstringSystem prompt prepended when the request has none.

Genkit

KeyTypeDescription
pluginsstring[]Plugins to initialize: systemone, googlegenai, anthropic, openai, openrouter, ollama, llmfake (test builds). Plugins named by a model’s provider prefix are added automatically.
systemoneSystemOneSystem One decision-model servers.
ollamaOllamaThe Ollama server of the ollama plugin and the ollama decision server.
openaiOpenAIThe server of the openai plugin.

HMACAuth

KeyTypeDescription
header (required)stringSignature header, such as X-Signature-256.
algostringHash (default sha256). One of sha256, sha1, sha512.
secret (required)stringShared secret, usually {{secrets.NAME}}.
prefixstringPrefix before the digest, such as sha256= (stripped if present).
encodingstringDigest encoding (default hex). One of hex, base64.

HealthCheck

KeyTypeDescription
pathstringhttp members: path probed with GET on the member’s origin (default: the sink’s own health check).
intervalDurationDefault 10s.
timeoutDurationDefault 2s.
unhealthy_afterintegerFailed probes in a row before a member is skipped (default 3).
healthy_afterintegerPassed probes in a row before it is used again (default 1).

Hedge

KeyTypeDescription
after (required)DurationStart another member when no answer came in this long.
maxintegerExtra members raced at most (default 1).

JWTAuth

KeyTypeDescription
jwks_url (required)stringJWKS endpoint.
issuerstringRequired iss.
audiencestringRequired aud.
algorithmsstring[]Accepted algorithms (default RS256, ES256).

Logs

KeyTypeDescription
levelstringDefault info. One of debug, info, warn, error.
formatstringDefault text on a terminal, json otherwise. One of json, text.

Metrics

KeyTypeDescription
prometheusbooleanServe /metrics (default true).

ModelFallback

KeyTypeDescription
defaultstring[]Generative models tried after models.default.
decisionstring[]Decision models tried after models.decision.

ModelRetry

KeyTypeDescription
attemptsintegerTries per model (default 3). Each try may include the System One plugin’s own two transport retries.
backoffDurationWait before the second try (default 500ms), doubling per try.
max_backoffDurationCap on the wait (default 10s).

Models

KeyTypeDescription
defaultstringDefault generative model, such as googleai/gemini-2.5-flash.
decisionstringDefault decision model, such as typesafe/jev-1.13.0. Pin a version in production.
retryModelRetryTries per model before the next model of the chain.
fallbackModelFallbackGlobal model fallback chains.

Notify

KeyTypeDescription
onstring[]The events that alert (default dead_letter and circuit_open).
to (required)string[]The destinations that get the alert, a JSON message.
everyDurationAt most one alert per event and subject in this time; the next one counts what happened meanwhile (default 1m).

OAuth2

KeyTypeDescription
token_url (required)stringThe authorization server’s token endpoint.
client_id (required)stringClient ID.
client_secret (required)stringClient secret, usually {{secrets.NAME}}.
scopesstring[]Scopes to ask for.
audiencestringThe audience parameter, for servers that need one (Auth0).
paramsmap of stringMore form parameters for the token request, such as resource.
client_authstringWhere the client ID and secret go: basic (HTTP Basic, the default) or body (form fields). One of basic, body.

OTel

KeyTypeDescription
endpointstringOTLP/HTTP endpoint; empty turns tracing off.
insecurebooleanPlain HTTP to the collector.
headersmap of stringExporter headers.
service_namestringDefault hikyaku.
sample_rationumberShare of traces kept (default 1).

Observability

KeyTypeDescription
logsLogsStructured logs on stderr.
otelOTelOpenTelemetry traces over OTLP/HTTP.
metricsMetricsPrometheus metrics on the admin API.

Ollama

KeyTypeDescription
urlstringBase URL (default http://localhost:11434).

OnInvalid

KeyTypeDescription
to (required)string[]Destinations that get the refused message, with the schema.error attribute set.

OpenAI

KeyTypeDescription
base_urlstringBase URL of the OpenAI API (default https://api.openai.com/v1, else OPENAI_BASE_URL when set). Point it at any OpenAI-compatible server, such as vLLM, LM Studio, LiteLLM or a gateway; its models are openai/. OPENAI_API_KEY is sent as a bearer token; a server other than the default may need none.

Ordering

KeyTypeDescription
keystringTemplate of the ordering key, such as {{ .json.customer_id }}. Empty: the source’s natural order unit (kafka partition, mqtt topic, amqp queue, sqs message group, …). A constant (“all”) orders the whole source.

PluginBinary

KeyTypeDescription
name (required)stringPlugin name, used in logs and metrics.
command (required)stringThe plugin binary: a path, relative to the spec file, or a name looked up on PATH.
argsstring[]Arguments passed to the binary.
envmap of stringEnvironment variables set for the plugin (values may use {{secrets.X}}).
sha256stringHex SHA-256 of the binary. When set, hikyaku refuses to start a binary that does not match.

RateLimit

KeyTypeDescription
per_second (required)numberRequests per second, on average (0.5 is one every two seconds).
burstintegerRequests that may go out at once after a quiet time (default per_second, rounded up).

Readiness

KeyTypeDescription
destinationsbooleanNot ready while a required destination can take nothing: every member of it, and of every fallback in its chain, is down (default true).
modelsbooleanNot ready while every model of an AI route’s chain fails. A probe calls each model once; /readyz answers from the last probe and refreshes one older than 30s in the background.

Reconnect

KeyTypeDescription
backoffDurationFirst wait (default 500ms), doubling.
max_backoffDurationCap (default 30s).
jitterstringDefault full. One of full, equal, none.
max_attemptsintegerGive up after this many failed connects in a row; 0 = forever.

Respond

KeyTypeDescription
from (required)stringDestination whose reply is returned.
timeoutDurationHow long the caller waits (default 30s); then 504.

SASL

KeyTypeDescription
mechanism (required)stringSASL mechanism. One of plain, scram-sha-256, scram-sha-512.
username (required)stringUser name.
password (required)stringPassword; use {{secrets.X}}.

SchemaCheck

KeyTypeDescription
schemaobjectThe JSON Schema, written inline.
on_invalidOnInvalidOn a route: where a body that does not match goes, instead of the dead-letter queue.
filestringA JSON Schema file (JSON or YAML), read when the relay starts or reloads. A relative path is relative to the working directory.

Sentinel

KeyTypeDescription
master_name (required)stringMonitored master.
addrs (required)string[]Sentinel addresses.
passwordstringSentinel password.

Server

KeyTypeDescription
adminAdminAdmin API: /healthz /readyz /metrics /reload /v1/feedback /v1/history /v1/tail.
shutdown_graceDurationTime in-flight messages get to finish on shutdown (default 20s).
workersintegerMessages processed at once (default 256).
readinessReadinessWhat /readyz checks.

Sign

KeyTypeDescription
secret (required)stringShared secret, usually {{secrets.NAME}}.
headerstringHeader that carries the signature (default X-Signature-256).
algostringHash (default sha256). One of sha256, sha512.
prefixstringText put before the digest, such as sha256=.
encodingstringDigest encoding (default hex). One of hex, base64.
timestamp_headerstringWhen set, this header carries the send time in Unix seconds, and the signature covers ., so a receiver can refuse an old request.

SystemOne

KeyTypeDescription
serversstring[]Known servers: typesafe (TYPESAFE_API_KEY), openrouter (OPENROUTER_API_KEY), workersai (CLOUDFLARE_API_TOKEN), ollama (no key).
customSystemOneServer[]Any other server that speaks the System One protocol.
workersai_account_idstringCloudflare account ID for workersai (else CLOUDFLARE_ACCOUNT_ID).
ollama_urlstringBase URL of the Ollama decision server (default http://localhost:11434).
typesafe_base_urlstringOverride TypeSafe’s base URL (else TYPESAFE_BASE_URL).
openrouter_base_urlstringOverride OpenRouter’s base URL.

SystemOneServer

KeyTypeDescription
provider (required)stringPlugin name and model prefix: models are /.
base_url (required)stringServer root.
pathstringDecision endpoint path (default /v1/systemone).
models_pathstringModel listing path.
api_keystringBearer key, usually {{secrets.NAME}}.
headersmap of stringExtra request headers.
imagesbooleanThe server reads images.

TLS

KeyTypeDescription
enabledbooleanUse TLS (implied by any other field and by https/wss).
cert_filestringCertificate (server cert, or client cert for mTLS).
key_filestringPrivate key of cert_file.
ca_filestringCA bundle that verifies the server.
client_ca_filestringlisten: CA bundle that verifies client certificates (mTLS).
server_namestringSNI and verification name.
insecure_skip_verifybooleanSkip server verification (development only).

WebhookAuth

KeyTypeDescription
provider (required)stringWho sends the webhook. One of github, stripe, slack, shopify, twilio.
secret (required)stringThe signing secret the sender gave you (for twilio, the auth token), usually {{secrets.NAME}}.
toleranceDurationHow old a signed timestamp may be (stripe and slack; default 5m).
urlstringtwilio only: the public URL Twilio calls, when a proxy in front of the relay changes the host or scheme.

Scalar types

Duration

A duration: 500ms, 30s, 5m, 1h, 7d.

Percent

A share: 50% or 0.5.

Size

A byte count: 512, 8KiB, 10MB.

TagList

Error tags: classes (connect, timeout), ranges (5xx, 4xx), exact codes (503, or a bare number) and protocol codes (ws:close_1011).