Skip to content

Configuration

The SDK reads its settings from the environment only. The CTXFLOW_* variables are read by ctxflow_otel.Config.from_env(); the OTEL_* variables by the OpenTelemetry SDK itself.

Variable Default Values Meaning
CTXFLOW_DETERMINISTIC_IDS off 1, true, on, yes to enable Deterministic chunk ids in the ingestion extras (C2).
CTXFLOW_SOURCE_VERSION unset any label Default ctxflow.source_version of ingested documents, when neither the metadata nor source_version() sets one.
CTXFLOW_SOURCE_ROOT unset a directory Ingestion extras: ctxflow.source_id of a file is its path relative to this root (extension kept, never an absolute path).
CTXFLOW_CORE_ENDPOINT, CTXFLOW_API_KEY unset a URL, an API key Not read by init(). They are the settings of the collector, and ctxflow-otel check reads them to test a collector’s key (Verify your setup).

CTXFLOW_CUSTODY and CTXFLOW_HMAC_KEY of pre-release builds are ignored: the SDK logs one warning if they are set. Text and ids leave as the app wrote them; see What is sent.

CTXFLOW_USAGE, CTXFLOW_USAGE_THRESHOLD and CTXFLOW_USAGE_RETRIEVAL_TOOLS configured a usage score that ctxflow no longer computes. They have no effect, whatever the value, and the SDK logs one warning if one is set. Remove them.

Variable Notes
OTEL_SERVICE_NAME Name of the agent (or of the ingestion pipeline: the index and source get this name). Set it.
OTEL_EXPORTER_OTLP_ENDPOINT Base URL; the SDK adds /v1/traces. https://app.ctxflow.sh, or your collector (http://collector:4318).
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT Full traces URL, winning over the base one: https://app.ctxflow.sh/v1/traces (used as given).
OTEL_EXPORTER_OTLP_HEADERS / OTEL_EXPORTER_OTLP_TRACES_HEADERS Authorization=Bearer%20<key> when sending directly to ctxflow. Not needed with a collector. The signal-specific variable wins.
OTEL_EXPORTER_OTLP_PROTOCOL / OTEL_EXPORTER_OTLP_TRACES_PROTOCOL Defaults to http/protobuf. The SDK exports OTLP over HTTP only: grpc does not switch it (the OpenTelemetry SDK logs a conflict and keeps HTTP).
OTEL_TRACES_EXPORTER Defaults to otlp_proto_http.
OTEL_METRICS_EXPORTER, OTEL_LOGS_EXPORTER Default to none. If you enable them, they go as they are.
OTEL_PROPAGATORS Default tracecontext,baggage. Keep baggage: conversation identity travels in it (a warning is logged otherwise).
OTEL_SDK_DISABLED true disables everything.
OTEL_PYTHON_DISTRO, OTEL_PYTHON_CONFIGURATOR Set to ctxflow by ctxflow-instrument. Another value disables the ctxflow pipeline.
OTEL_CONFIG_FILE Not supported.
OTEL_PYTHON_DISABLED_INSTRUMENTATIONS Comma-separated instrumentors ctxflow-instrument must not load, for example llama_index. Also silences the warning for an instrumentor that did not run (Python SDK).
OPENINFERENCE_HIDE_INPUTS, OPENINFERENCE_HIDE_OUTPUTS, other OPENINFERENCE_HIDE_* Read by the OpenInference instrumentation, not by ctxflow: they hide content on its spans. Hiding prompts and answers leaves the turn detail without text. Under ctxflow-instrument this is how you hide more of the LlamaIndex spans (LlamaIndex).
OTEL_BSP_SCHEDULE_DELAY, OTEL_EXPORTER_OTLP_TIMEOUT Lower them for short-lived processes such as stdio MCP servers (see MCP servers and clients).

The project page of the app gives the snippet for sending straight to ctxflow with the signal-specific variables:

Terminal window
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://app.ctxflow.sh/v1/traces
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer%20<key>"
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf

The SDK honours them:

  • OTEL_EXPORTER_OTLP_TRACES_ENDPOINT is used as given: the SDK does not append /v1/traces to it, as the OpenTelemetry specification says. Only OTEL_EXPORTER_OTLP_ENDPOINT gets /v1/traces appended. A traces endpoint without the path sends to /: add the path.
  • OTEL_EXPORTER_OTLP_TRACES_HEADERS wins over OTEL_EXPORTER_OTLP_HEADERS.
  • The protocol is OTLP/HTTP with protobuf. Both snippets, with the base variables or with the _TRACES_ ones, are equivalent; ctxflow-otel check prints the URL it will use (Verify your setup).

Example: direct to ctxflow, text by default

Section titled “Example: direct to ctxflow, text by default”
Terminal window
export OTEL_SERVICE_NAME=support-agent
export OTEL_EXPORTER_OTLP_ENDPOINT=https://app.ctxflow.sh
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer%20ctx_xxxxxxxx_..."

ctxflow_otel.init(config) and attach(provider, config) accept a ctxflow_otel.Config instead of reading CTXFLOW_*:

import ctxflow_otel
provider = ctxflow_otel.init(ctxflow_otel.Config(deterministic_ids=True))

The OTEL_* variables are still read from the environment.