API and CLI Values Reference

One place for allowed CLI arguments, Python API values, EngineConfig fields, IO options, and agent instance keys.

This page is the compact reference for values you can pass to BlazeRules from the command line or Python.

Interfaces / parity

BlazeRules exposes the same engine through four boundaries. The Python SDK and the blazerules CLI share identical data-plane capabilities — the same rules, operators, and input formats — and differ only in where records come from.

InterfaceInput boundaryUse it for
Python SDKIn-memory objects (NDJSON bytes, Arrow RecordBatch)Embedding the engine in a Python service or notebook.
blazerules CLIFiles, s3:// objects, stdin, and KafkaBatch evaluation, validation, backtesting, and native Kafka streaming from the shell.
blazerules_agentHTTP, tailed file, or stdinLong-running local ingest with batching and de-dupe.
blazerules_dashboardRead-only local UIInspecting rules, decision logs, dead-letter logs, and health.

blazerules_agent and blazerules_dashboard are separate binaries — they are not subcommands of blazerules (blazerules agent / blazerules dashboard intentionally error and point you to the standalone binaries).

📘

--input chooses the input type

blazerules_agent --input accepts stdin, file_tail, or http. --source is only a free-form metadata label written into wrapped log records and output; it is not an input selector.

blazerules CLI

Use blazerules for full native batch evaluation, validation, backtesting, and Kafka streaming.

CommandPurpose
blazerules infoPrint version, SIMD backend, CPU features, and enabled IO/model features.
blazerules --versionPrint the version string (e.g. 0.5.4) and exit. Also on blazerules_agent and blazerules_dashboard.
blazerules validateLoad and validate a rule file.
blazerules evalEvaluate a file, S3 object, or stdin batch.
blazerules backtestCompare two rulesets over Parquet inputs.
blazerules stream kafkaRun a native Kafka microbatch consume/evaluate/produce loop.

blazerules validate

ArgumentValuesDefaultMeaning
--rulespath or s3://bucket/keyrequiredRule YAML to load and validate.
--modelname=path, repeatablenoneRegister ONNX model so model_score rules validate.
--samplepath to NDJSONnoneOptionally push a sample NDJSON batch through the engine; output JSON then includes sample_records and sample_skipped.
--configpathnoneUnified single-run config; explicit flags override it.

blazerules eval

ArgumentValuesDefaultMeaning
--rulespath or s3://bucket/keyrequiredRule YAML.
--input / --formatndjson, jsonl, json, json-array, debezium, arrow-ipc, arrow, parquet, csv, avro, protobuf, protobuf-delimited, autoautoInput format. jsonl is an alias of ndjson; arrow is an alias of arrow-ipc; json-array evaluates a top-level JSON array directly instead of converting it to NDJSON first. avro auto-detects an Object Container File (multi-record, self-describing schema) via magic bytes, falling back to one bare Avro value otherwise. protobuf decodes exactly one bare message; protobuf-delimited reads a file of N varint-length-prefixed messages instead — not auto-detected, since Protobuf has no magic bytes to tell the two apart.
--pathpath or s3://bucket/key, repeatablerequired unless --stdinInput object(s).
--stdinflagfalseRead NDJSON/JSON bytes from stdin.
--batch-sizeinteger10000Batch size for batch/file formats.
--threadsintegerautoWorker thread count for evaluation. 0/unset means automatic.
--mmapflagfalsendjson/jsonl local files only: mmap the whole file zero-copy instead of streaming bounded chunks. Faster for large files with --threads > 2, since the default streaming chunk size is memory-bounded rather than width-unbounded; trades away that memory bound.
--schemapath or s3://bucket/keyrequired for a bare (non-OCF) Avro fileAvro schema JSON. Not needed for an Object Container File — it carries its own schema.
--descriptorpath or s3://bucket/keyrequired for protobuf/protobuf-delimitedSerialized protobuf descriptor set.
--messagefully-qualified typerequired for protobuf/protobuf-delimitedMessage type inside the descriptor set.
--op-fieldfield name__opDebezium operation field.
--modelname=path, repeatablenoneRegister ONNX model (local path or s3://) for model_score rules.
--outputnone, summary, decisions-jsonl, grouped-decisions, rule-counts, bitmasks, arrow-ipcsummary (or decisions-jsonl when --output-path is set)Output shape.
--output-detailcounts, codes, decisions, bitmasksdecisionsResult materialization level (see Decisions & Scoring).
--output-pathpathstdoutOutput file.
--decision-logpathemptyEngine decision log path.
--dead-letter-logpathemptyEngine DLQ path.
--ingest-error-modeskip_and_count, skip_to_dead_letter, hard_failskip_and_countBad-record policy.
--type-mismatch-modenull_on_type_error, coerce, hard_fail_typenull_on_type_errorType-drift policy.
--simd-backendauto, scalar, neon, avx2, avx512autoSIMD backend override.
--aws-profileprofile nameenvironmentAWS profile for s3:// resources.
--aws-regionregionenvironmentAWS region.
--aws-endpoint-urlURLenvironmentCustom S3 endpoint.
--configpathnoneUnified single-run config; explicit flags override values from it.
blazerules eval --rules rules.yaml --input ndjson --path events.ndjson --output grouped-decisions
blazerules eval --rules rules.yaml --input arrow-ipc --path events.arrow --output summary
blazerules eval --rules rules.yaml --input protobuf --path event.pb --descriptor schema.desc --message payments.Transaction
blazerules eval --rules rules.yaml --input avro --path events.avro --output summary
blazerules eval --rules rules.yaml --input protobuf-delimited --path events.pb --descriptor schema.desc --message payments.Transaction

blazerules stream kafka

ArgumentValuesDefaultMeaning
--rulespath or s3://bucket/keyrequiredRule YAML.
--brokersbroker listrequiredKafka bootstrap servers.
--group-idstringblazerulesConsumer group.
--input-topictopic or comma listrequiredInput topic(s). Alias: --input-topics.
--output-topictopicemptyDecision output topic. Empty disables produce.
--output-moderows, grouped, nonerowsShape of records written to --output-topic: one row per decision, per-decision-label counts, or no output.
--dlq-topictopicemptyRoute records that fail to decode to a dead-letter topic and keep consuming instead of aborting.
--formatjson, ndjson, debezium, arrow-ipc, avro, protobufjsonKafka message payload format.
--arrow-validationfull, structural, trustedstructuralValidation level applied to Arrow IPC Kafka payloads before decoding.
--op-fieldfield name__opDebezium operation field.
--schemapath or s3://bucket/keyrequired for AvroAvro schema JSON.
--descriptorpath or s3://bucket/keyrequired for ProtobufSerialized protobuf descriptor set.
--messagefully-qualified typerequired for ProtobufMessage type inside descriptor set.
--modelname=path, repeatablenoneRegister ONNX model for model_score rules.
--batch-sizeinteger2048Kafka microbatch size.
--workersinteger1Concurrent evaluation worker threads, each with its own RuleEngine shard. Pure CPU work; no Kafka calls happen on these threads.
--queue-depthinteger64Depth of every bounded queue in the pipeline: each worker's input queue and the shared delivery queue.
--poll-timeout-msinteger1000Poll timeout.
--flush-timeout-msinteger5000Producer flush timeout.
--flush-interval-msinteger250How often the delivery thread batches and flushes produced messages to Kafka. Offsets commit only after a successful flush.
--max-messagesinteger00 means unlimited.
--max-batchesinteger00 means unlimited.
--commit-offsetsbooltrueCommit after successful evaluation/output.
--partition-affinebooltrueRoute every message for a (topic,partition) to the same worker, preserving per-partition order. Forced true whenever --commit-offsets is enabled; optional (round-robin dispatch) only when --commit-offsets=false.
--consumer-confk=v, repeatablenoneArbitrary librdkafka consumer settings, e.g. security.protocol=SASL_SSL.
--producer-confk=v, repeatablenoneArbitrary librdkafka producer settings, e.g. sasl.mechanism=PLAIN.
--configpathnoneUnified single-run config; explicit flags override it.

The output JSON reports batches, messages, matched, emitted, eval_ms, delivery_errors, and dlq_routed (records routed to --dlq-topic).

blazerules stream kafka \
  --rules rules.yaml \
  --brokers localhost:9092 \
  --input-topic transactions \
  --output-topic decisions \
  --format avro \
  --schema transaction.avsc

blazerules_agent CLI

Use --config agent.yaml for multiple instances, or pass single-instance flags directly.

ArgumentValuesDefaultMeaning
--configpath or s3://bucket/keynoneLoad one or more instances: from YAML.
--namestringdefaultInstance label.
--rulespath or s3://bucket/keyrequiredRule YAML for this instance.
--inputstdin, file_tail, httpstdinInput adapter.
--pathpathnoneFile path for file_tail.
--hostIP or hostname127.0.0.1HTTP bind host.
--portinteger9480HTTP bind port.
--batch-sizeinteger2048Records buffered before a size flush.
--flush-msinteger1000Milliseconds before flushing a partial batch.
--eval-shardsinteger1Pool of cloned engines for parallel evaluation of stateless rulesets; auto-downgrades to 1 if dedupe is on or the ruleset uses windows / an unbound schema.
--http-threadsintegermax(4, cores)httplib's own accept/read thread pool size; governs concurrent connection handling, not evaluation or write concurrency.
--http-queue-depthinteger256Depth of httplib's own request queue feeding --http-threads; a full queue closes the connection immediately with no HTTP response.
--eval-queue-depthinteger64Depth of the bounded queue feeding eval-worker threads; a full queue returns HTTP 429.
--sink-queue-depthinteger64Depth of the bounded queue feeding sink-worker threads; a full queue returns HTTP 503.
--sink-workersinteger1Threads that dequeue evaluated batches and write them to the decision log; parallelizes Arrow encoding, not just the final write.
--max-request-mbinteger256Hard cap on one HTTP request body, in MiB; larger requests get HTTP 413.
--ack-modedurable, evaluateddurabledurable acks after the sink worker writes the decision; evaluated acks right after evaluation, before the write.
--outputstdout, ndjsonstdoutDecision output sink.
--output-pathpathnoneNDJSON decision path when --output ndjson.
--servicestring--nameMetadata label.
--sourcestringlogMetadata label, not an input selector.
--dedupe-keyfield name, repeatablenoneEnables local de-dupe using one or more fields.
--dedupe-ttl-secondsinteger86400How long duplicate keys stay suppressed.
--aws-regionregionenvironmentAWS region for s3:// rules/models/output (else AWS_REGION).
--aws-endpoint-urlURLenvironmentCustom S3 endpoint (else AWS_ENDPOINT_URL).
--versionflagPrint the version string and exit.
blazerules_agent \
  --rules rules.yaml \
  --input http \
  --host 127.0.0.1 \
  --port 9480 \
  --batch-size 4096 \
  --flush-ms 50 \
  --output ndjson \
  --output-path decisions.ndjson \
  --service payments-api \
  --source http-json \
  --dedupe-key event_id

Agent instances: YAML

The same settings can be placed in YAML. A top-level instances: list starts one thread per instance.

YAML keyValuesDefaultMeaning
instances[].namestringdefaultInstance label.
instances[].rulespath or s3://bucket/keyrequiredRule YAML.
instances[].batch_sizeinteger2048Size flush threshold.
instances[].flush_msinteger1000Time flush threshold.
instances[].eval_shardsinteger1Parallel clone-engine pool for stateless rulesets (auto-downgrades with dedupe, windows, or an unbound schema).
instances[].http_threadsintegermax(4, cores)httplib's own accept/read thread pool size.
instances[].http_queue_depthinteger256Depth of httplib's own request queue; a full queue closes the connection immediately.
instances[].eval_queue_depthinteger64Depth of the bounded queue feeding eval-worker threads; a full queue returns HTTP 429.
instances[].sink_queue_depthinteger64Depth of the bounded queue feeding sink-worker threads; a full queue returns HTTP 503.
instances[].sink_workersinteger1Threads that write evaluated batches to the decision log.
instances[].max_request_mbinteger256Hard cap on one HTTP request body, in MiB; larger requests get HTTP 413.
instances[].ack_modedurable, evaluateddurableAcknowledge after the sink write (durable) or right after evaluation (evaluated).
instances[].servicestringinstance nameService metadata label.
instances[].sourcestringlogSource metadata label.
instances[].input.typestdin, file_tail, httpstdinInput adapter.
instances[].input.pathpathnoneRequired for file_tail.
instances[].input.hosthost127.0.0.1HTTP bind host.
instances[].input.portinteger9480HTTP bind port.
instances[].output.typestdout, ndjsonstdoutDecision sink.
instances[].output.pathpathnoneRequired for ndjson.
instances[].dedupe.enabledtrue, falsefalseEnable local duplicate suppression.
instances[].dedupe.key_fieldslist of field namesnoneDuplicate key fields.
instances[].dedupe.ttl_secondsinteger86400Duplicate suppression TTL.

blazerules_dashboard CLI

ArgumentValuesDefaultMeaning
--hostIP or hostname127.0.0.1HTTP bind host.
--portinteger9470Dashboard port.
--poll-msinteger1000Poll interval for watched files and metrics.
--tail-linesinteger5000Bounded recent-line buffer per log file.
--decision-logpathnoneCompact decision NDJSON to inspect.
--decision-log-dirpath or s3://bucket/prefix/noneDirectory of per-instance decision logs (NDJSON/Arrow), merged into one view; use instead of --decision-log for a multi-instance agent.
--dead-letter-logpathnoneDead-letter NDJSON to inspect.
--metrics-urlURLnonePrometheus exposition URL.
--results-jsonlpathnoneStress matrix benchmark JSONL.
--rulespathnoneActive rules YAML for validation and visualizer.
--rules-dirpath or s3://bucket/prefix/noneDirectory of ruleset YAMLs; the Ruleset selector lists each *.yaml/*.yml stem and the visualizer scopes to the one matching the selected instance.
--candidate-rulespathnoneCandidate rules YAML for diff/validation.
--rules-history-dirpathnoneDirectory of previous YAML versions.
--aws-regionregionenvironmentAWS region for s3:// sources (else AWS_REGION).
--aws-endpoint-urlURLenvironmentCustom S3 endpoint (else AWS_ENDPOINT_URL).
--versionflagPrint the version string and exit.

Python module constants and enums

NameValues
blazerules.ColumnTypeFLOAT32, FLOAT64, INT32, INT64, CATEGORICAL, ENTITY_KEY, TIMESTAMP_MS, BOOLEAN, STRING
blazerules.ActionTypeAPPROVE, FLAG, REVIEW, BLOCK, SCORE
blazerules.RuleFileFormatYAML, JSON
blazerules.OutputDetailCOUNTS, CODES, DECISIONS, BITMASKS
blazerules.IngestErrorModeSKIP_AND_COUNT, SKIP_TO_DEAD_LETTER, HARD_FAIL
blazerules.TypeMismatchModeNULL_ON_TYPE_ERROR, COERCE, HARD_FAIL_TYPE
blazerules.SimdBackendSCALAR, NEON, SSE2, AVX2, AVX512
blazerules.TraceModeTRACE_NONE, TRACE_SAMPLED, TRACE_ALL

EngineConfig

AttributeValuesDefaultMeaning
batch_sizeinteger10000Preferred internal batch size.
parallel_thresholdinteger1000Row threshold before parallel execution is considered.
eval_thread_countinteger00 means automatic worker count.
output_detailOutputDetail.COUNTS, OutputDetail.CODES, OutputDetail.DECISIONS, OutputDetail.BITMASKSOutputDetail.BITMASKSHow much result data to materialize. Use COUNTS for aggregate-only runs, CODES for compact routing, DECISIONS for normal per-row decisions, and BITMASKS for per-rule masks.
ingest_error_modeSKIP_AND_COUNT, SKIP_TO_DEAD_LETTER, HARD_FAILSKIP_AND_COUNTBad-record policy.
type_mismatch_modeNULL_ON_TYPE_ERROR, COERCE, HARD_FAIL_TYPENULL_ON_TYPE_ERRORType drift policy after schema binding.
max_error_samplesinteger16Max bad-record samples kept in BatchResult.
decision_log_pathstring pathemptyEmpty disables engine-level decision logging.
dead_letter_pathstring pathemptyDead-letter output path for skipped records.
max_window_entitiesinteger10000000Window state capacity hint.
arena_size_bytesinteger8388608Per-worker arena size.
max_dict_size_per_columninteger100000Dictionary cap for non-entity categoricals.
enable_selection_vectorsbooltrueUse survivor-index execution for selective predicates.
selection_vector_thresholdfloat0.20Survivor fraction below which index execution becomes useful.
enable_adaptive_predicate_orderingbooltrueOrder cheap/high-rejection predicates first.
enable_no_validity_fast_pathbooltrueSkip validity bitmap work for known non-null columns.
enable_prefetchboolfalseEnable explicit prefetch in long scans.
enable_thread_affinityboolfalseBest-effort worker affinity.
result_buffer_reusebooltrueReuse output buffers across evaluations.
simd_backend_overrideauto, scalar, neon, sse2, avx2, avx512autoRuntime SIMD backend override.
enable_avx512boolfalseMake AVX-512 eligible during auto selection.
hot_reload_poll_secondsinteger5Default hot-reload polling interval.
hot_reload_validate_conflictsbooltrueAnalyze conflicts before hot-reload activation.
hot_reload_keep_previous_on_failurebooltrueKeep old rules active when reload fails.
trace_sample_ratefloat0.05Trace sampling rate used when trace_mode is TraceMode.TRACE_SAMPLED.
trace_modeTraceMode.TRACE_NONE, .TRACE_SAMPLED, .TRACE_ALLTraceMode.TRACE_NONEEnables/disables tracing; trace_sample_rate only has an effect under TRACE_SAMPLED.
eviction_sweep_interval_minutesfloat5How often window/dedupe state eviction sweeps run, in minutes.

RuleEngine methods

MethodMain argumentsReturns / effect
RuleEngine()optional EngineConfig; optional explicit schemaCreates an engine. Omit schema to infer from the first batch.
load_rules(path)local path or s3://...Loads, validates, compiles, and activates rules.
load_rules_from_string(text, format=YAML)YAML/JSON textCompiles rules from memory.
reload_rules_now(path)local path or s3://...Compile-and-swap immediately if valid.
enable_hot_reload(path, poll_interval_seconds=5)path and polling secondsStarts background reload checks.
stop_hot_reload()noneStops the hot-reload thread.
hot_reload_status()noneReturns HotReloadStatus.
evaluate_ndjson(payload)bytes-like NDJSONEvaluates one JSON batch.
evaluate_ndjson_padded(payload, logical_size)padded bytes-like NDJSONEvaluates already padded NDJSON without copying the padding.
evaluate_json_array(payload)bytes-like top-level JSON arrayEvaluates one JSON array batch without converting it to NDJSON.
evaluate_json_array_padded(payload, logical_size)padded bytes-like top-level JSON arrayEvaluates an already padded JSON array batch.
evaluate_messages(messages)sequence of JSON strings/bytesConvenience path for smaller integrations.
evaluate_batch(batch, validate=True)pyarrow.RecordBatch, optional validation skipEvaluates typed Arrow data. Import through Arrow's C Data Interface is zero-copy either way; validate=True (default) additionally runs a full ValidateFull() scan on the imported batch, which callers who've already validated the same data upstream can skip with validate=False.
evaluate_ndjson_file(path)local path or s3://...Reads/evaluates NDJSON file.
create_shards(shard_count)integerReturns partition-affine engine shards.
evaluate_partition_messages(partition_id, messages)partition id, JSON messagesRoutes to partition-local state.
evaluate_partition_ndjson_padded(partition_id, payload, logical_size)partition id, payloadPartition-aware NDJSON evaluation.
evaluate_partition_batch(partition_id, batch, validate=True)partition id, Arrow batch, optional validation skipPartition-aware Arrow evaluation; same validate behavior as evaluate_batch.
register_model(name, path)model name, ONNX path or s3://...Registers a model used by model_score.
reset_window_state()noneClears in-memory window state.
backtest(parquet_path, rules_a, rules_b, label_column=None)path(s), two rule setsRuns offline comparison.
analyze_conflicts(rules_path)rules pathReturns ConflictReport.
enable_metrics() / reset_metrics() / metrics_snapshot()noneIn-process metrics.
stats()noneReturns EngineStats (batches_evaluated, records_evaluated, records_skipped).

BatchResult

Attribute or methodMeaning
n_records, n_matchedBatch size and matched-row count.
decisions, decision_codes, decision_label_mapPer-row decision labels or compact integer codes.
scores, risk_bands, winning_rule_idsPer-row scoring outputs.
match_countsRule ID to fire count.
matched_indicesNumPy array of all matched row indices.
indices_for_decision(label)NumPy indices for one decision label.
indices_for_not_decision(label)NumPy indices for all other labels.
grouped_decision_indices()Dict of decision label to NumPy index array.
grouped_winning_rule_indices()Dict of winning rule id to NumPy index array.
indices_for_rule(rule_id)NumPy indices for a rule; requires rule bitmasks.
result[rule_id]Boolean NumPy mask; requires OutputDetail.BITMASKS.
decision_codes_buffer(), matched_indices_buffer(), rule_bitmask_buffer(rule_id)Zero-copy memoryview buffers for high-throughput routing.
messages_processed, messages_skipped, error_counts, error_samples, last_ingest_errorIngest diagnostics.
timingDict of internal timing fields in milliseconds.

EngineStats

Returned by RuleEngine.stats() — cumulative counters since the engine was created, not per-batch.

AttributeMeaning
batches_evaluatedNumber of evaluate_*/evaluate_partition_* calls handled so far.
records_evaluatedTotal records that reached rule evaluation.
records_skippedTotal records dropped by ingest error handling before evaluation.

blazerules_io

NameValues / argumentsMeaning
has_kafka, has_avro, has_protobufboolRuntime capability flags for optional IO features.
FileFormatAUTO, ARROW_IPC, PARQUET, CSV, NDJSONFile reader format selector.
ArrowIpcValidationLevelFULL, STRUCTURAL, TRUSTEDArrow IPC batch validation strictness, used by FileReadOptions.arrow_validation.
read_ndjson_bytes(path)local path or s3://...Reads exact NDJSON bytes. s3:// paths stream natively off Arrow's S3 filesystem by default, falling back to an AWS-CLI download if nothing has been read yet; takes no options, so it always runs with FileReadOptions defaults.
read_record_batches(path, format="auto", batch_size=65536)local/S3 pathReads Arrow IPC, Parquet, CSV, or NDJSON into a list of Arrow batches. Thin wrapper over for_each_record_batch that materializes every batch and does not accept a FileReadOptions, so it also always runs with defaults.
FileReadOptionssee belowOptions for for_each_record_batch: native S3 mode, column projection, validation level.
for_each_record_batch(path, format, callback, options=FileReadOptions())local/S3 path, callback(batch) -> bool | NoneStreams Arrow IPC/Parquet/CSV/NDJSON one Arrow batch at a time instead of materializing the file; return False from callback to stop early. The only Python entry point that accepts FileReadOptions.
ArrowIpcDecoder.decode_batch(frames)sequence of framesDecodes binary Arrow IPC to one Arrow batch.
AvroDecoder(schema_json).decode_batch(frames)sequence of Avro recordsDecodes one Avro record per bare frame to Arrow when Avro support is built.
looks_like_avro_ocf(data)bytesTrue if data starts with the Avro Object Container File magic bytes ("Obj\x01") — safe to auto-detect, unlike Protobuf framing.
decode_avro_ocf_file_each(path, callback, batch_size=10000)local path, callback(batch) -> bool | None, batch sizeReads a real multi-record Avro OCF file (the format Spark/Hadoop/Kafka Connect produce) using its own embedded schema — no AvroDecoder/schema needed — invoking callback once per batch of up to batch_size records; return False to stop early. Returns total records processed. Same capability as CLI --input avro on an OCF file.
ProtobufDecoder(descriptor_set_bytes, message_type).decode_batch(frames)sequence of protobuf recordsDecodes one protobuf record per bare frame to Arrow when Protobuf support is built.
ProtobufDecoder.decode_delimited_file_each(path, callback, batch_size=10000)local path, callback(batch) -> bool | None, batch sizeReads a file of N varint-length-delimited Protobuf messages, invoking callback once per batch. Same capability as CLI --input protobuf-delimited.
ProtobufDecoder.decode_delimited_file_parallel(path, callback, batch_size=10000, worker_count=1)as above, plus worker thread countSame as decode_delimited_file_each, but parses batch_size-sized chunks concurrently across worker_count threads — callback delivery order is unaffected, only the CPU-heavy parse step runs in parallel.
unwrap_debezium(messages, op_field="__op")JSON CDC messagesConverts Debezium envelopes to NDJSON bytes.
KafkaConsumer(brokers, group_id, topics, conf={})Kafka connection settingsPolls JSON batches or raw records with metadata.
KafkaProducer(brokers, conf={})Kafka connection settingsProduces decision events.
StreamRunConfigsee belowC++-owned Kafka consume/evaluate/produce loop config.
run_stream(engine, config)RuleEngine, StreamRunConfigRuns the native Kafka microbatch loop for JSON/NDJSON, Debezium, Arrow IPC, Avro, or Protobuf payloads.

StreamRunConfig fields:

AttributeTypeMeaning
brokersstringKafka bootstrap servers.
group_idstringConsumer group.
input_topicslist of stringsTopics to consume.
output_topicstringTopic for compact decisions.
output_moderows, grouped, noneShape of records written to output_topic: one row per decision, per-decision-label counts, or no output.
dlq_topicstringDead-letter topic for records that fail to decode; empty disables DLQ routing.
consumer_conf, producer_confdict string to stringExtra librdkafka settings (SASL/SSL, etc.).
batch_sizeintegerMax records per engine evaluation.
worker_countintegerConcurrent evaluation worker threads, each with its own RuleEngine shard.
queue_depthintegerDepth of every bounded queue in the pipeline: each worker's input queue and the shared delivery queue.
poll_timeout_msintegerPoll wait.
flush_timeout_msintegerProducer flush wait.
flush_interval_msintegerHow often the delivery thread batches and flushes to Kafka; offsets commit only after a successful flush.
max_messages, max_batchesintegerLocal run limits; leave at zero for unbounded.
commit_offsetsboolCommit offsets after a batch is processed.
partition_affineboolRoute every message for a (topic, partition) to the same worker, preserving order; forced true whenever commit_offsets is true.
payload_formatjson, ndjson, debezium, arrow-ipc, avro, protobufKafka message payload format.
arrow_validationArrowIpcValidationLevel.FULL, .STRUCTURAL, .TRUSTEDValidation level applied to Arrow IPC Kafka payloads before decoding.
avro_schema_jsonstringRequired when payload_format == "avro".
protobuf_descriptor_setbytes/stringRequired when payload_format == "protobuf".
protobuf_message_typestringRequired when payload_format == "protobuf".
debezium_op_fieldstringOperation field injected for Debezium unwrap.

FileReadOptions fields:

AttributeTypeDefaultMeaning
batch_sizeinteger65536Rows requested per Arrow batch from Parquet/CSV/Arrow-IPC readers.
ndjson_chunk_bytesinteger8388608NDJSON chunk size in bytes; used by the C++ for_each_ndjson_chunk visitor, which is not currently exposed to Python.
included_fieldslist of strings[] (all fields)Column projection by field name, pushed into Parquet row-group reads and CSV's column parser. Ignored by Arrow IPC (see included_field_indices) and by NDJSON.
included_field_indiceslist of integers[] (all fields)Column projection by index, for Arrow IPC only. Ignored by Parquet, CSV, and NDJSON.
use_threadsbooltrueUse Arrow's internal multithreading for the read.
native_s3booltrueStream s3:// reads directly through Arrow's S3FileSystem instead of downloading the object via the AWS CLI first.
allow_s3_cli_fallbackbooltrueIf a native S3 read fails before any batch has reached the caller, retry the same object through the AWS-CLI-download path. Has no effect once delivery has started — no risk of a duplicate delivery.
arrow_validationArrowIpcValidationLevelFULLBatch validation strictness. Only the Arrow IPC reader path applies this today; Parquet, CSV, and NDJSON reads always run at the least-strict (TRUSTED) level regardless of this setting.
📘

native_s3 needs an S3-enabled build

Native streaming is compiled in via the BLAZERULES_IO_S3 CMake option (default ON). Unlike has_kafka/has_avro/has_protobuf, there's no runtime capability flag for it — on a build without it, native_s3=True silently falls through to the AWS-CLI path when allow_s3_cli_fallback is True (the default), or raises when it is False.

🚧

arrow_validation is Arrow-IPC-only today

Setting arrow_validation to STRUCTURAL or TRUSTED only changes behavior for Arrow IPC files. Parquet, CSV, and NDJSON reads currently always validate at the least-strict level no matter what arrow_validation is set to.

AWS and S3 helpers

Python functionMeaning
set_aws_profile(profile, clear_env_credentials=True)Use an AWS CLI profile and optionally ignore stale key env vars.
clear_aws_profile() / current_aws_profile()Clear or inspect profile selection.
set_aws_region(region)Set region for s3:// reads.
clear_aws_region() / current_aws_region()Clear or inspect region selection.
set_aws_endpoint_url(endpoint_url)Set S3-compatible endpoint for MinIO, R2, or LocalStack.
clear_aws_endpoint_url() / current_aws_endpoint_url()Clear or inspect endpoint.
set_aws_credentials(access_key_id, secret_access_key, session_token="", region="")Set process credentials for short-lived local scripts.
clear_aws_credentials()Remove process AWS key variables.

Equivalent environment variables:

export BLAZERULES_AWS_PROFILE=personal
export BLAZERULES_AWS_REGION=us-east-1
export BLAZERULES_AWS_ENDPOINT_URL=http://127.0.0.1:9000

Rule values

The rule operator list is maintained in Operator Reference. The production shape of a full rule file is in Production YAML Guide.


Did this page help you?