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.

📘

--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_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.
--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.
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
Python equivalent: start the same agent process
import subprocess

agent = subprocess.Popen([
    "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[].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.
--dead-letter-logpathnoneDead-letter NDJSON to inspect.
--metrics-urlURLnonePrometheus exposition URL.
--results-jsonlpathnoneStress matrix benchmark JSONL.
--rulespathnoneActive rules YAML for validation and visualizer.
--candidate-rulespathnoneCandidate rules YAML for diff/validation.
--rules-history-dirpathnoneDirectory of previous YAML versions.

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.OutputDetailDECISIONS, 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

EngineConfig

AttributeValuesDefaultMeaning
batch_sizeinteger10000Preferred internal batch size.
parallel_thresholdinteger1000Row threshold before parallel execution is considered.
eval_thread_countinteger00 means automatic worker count.
output_detailOutputDetail.DECISIONS, OutputDetail.BITMASKSbuild defaultDecision-only output or detailed bitmasks.
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 when tracing is enabled by the native build.

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_messages(messages)sequence of JSON strings/bytesConvenience path for smaller integrations.
evaluate_batch(batch)pyarrow.RecordBatchEvaluates typed Arrow data.
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)partition id, Arrow batchPartition-aware Arrow evaluation.
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.

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.

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.
read_ndjson_bytes(path)local path or s3://...Reads exact NDJSON bytes.
read_record_batches(path, format="auto", batch_size=65536)local/S3 pathReads Arrow IPC, Parquet, CSV, or NDJSON into Arrow batches.
ArrowIpcDecoder.decode_batch(frames)sequence of framesDecodes binary Arrow IPC to one Arrow batch.
AvroDecoder(schema_json).decode_batch(frames)sequence of Avro recordsDecodes Avro directly to Arrow when Avro support is built.
ProtobufDecoder(descriptor_set_bytes, message_type).decode_batch(frames)sequence of protobuf recordsDecodes Protobuf directly to Arrow when Protobuf support is built.
unwrap_debezium(messages, op_field="__op")JSON CDC messagesConverts Debezium envelopes to NDJSON bytes.
KafkaConsumer(brokers, group_id, topics, conf={})Kafka connection settingsPolls Kafka batches or records.
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.

StreamRunConfig fields:

AttributeTypeMeaning
brokersstringKafka bootstrap servers.
group_idstringConsumer group.
input_topicslist of stringsTopics to consume.
output_topicstringTopic for compact decisions.
consumer_conf, producer_confdict string to stringExtra librdkafka settings.
batch_sizeintegerMax records per engine evaluation.
poll_timeout_msintegerPoll wait.
flush_timeout_msintegerProducer flush wait.
max_messages, max_batchesintegerLocal run limits; leave at zero for unbounded.
commit_offsetsboolCommit offsets after a batch is processed.

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.