Configure the Python agent for AI applications

Configure the Python agent from the Splunk Distribution of the OpenTelemetry Python to meet your AI application instrumentation and evaluation needs.

You can configure the Python agent from the Splunk Distribution of the OpenTelemetry Python to meet your AI application instrumentation and evaluation needs. For more information about the Python agent, see About the Splunk Distribution of OpenTelemetry Python.

Configuration methods

You can change the agent settings by setting environment variables. For example:
CODE
export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=DELTA

Instrumentation configuration settings

The following settings control instrumentation for AI applications.
Configuration setting Description Required?
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE

Determines if the OTLP metric exporter reports cumulative totals, deltas, or low-memory-friendly temporality for emitted metrics.

Accepted values:
  • DELTA

  • CUMULATIVE

  • LOWMEMORY

Yes
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED

Enriches the Python logger to include trace/span correlation fields. Defaults to true.

Accepted values: true, false

No
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT

Determines if input/output/system messages are included in spans/logs. Defaults to false.

Accepted values: true, false

No
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT_MODE

Designates the telemetry to include messages on. Options include spans as attributes, events as bodies, or both.

If OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT is enabled, and this variable is omitted, the value defaults to SPAN_AND_EVENT.

Accepted values:

  • NO_CONTENT

  • SPAN_AND_EVENT

  • SPAN_ONLY

  • EVENT_ONLY

No
OTEL_INSTRUMENTATION_GENAI_EMITTERS

Controls what telemetry data is generated and emitted during GenAI operations (LLM calls, agent invocations, etc.). Defaults to span.

Accepted values:

  • span

  • span_metric

  • span_metric_event

  • span_metric_event,splunk

    Note: To use the span_metric_event,splunk value, you must first install the required package by running pip install splunk-otel-genai-emitters-splunk.

No
OTEL_INSTRUMENTATION_GENAI_DEBUG

Enables opt-in debug logging for GenAI telemetry operations. Helps troubleshoot instrumentation issues by logging internal events without dumping full message content.

Accepted values: true, false

No

Evaluation configuration settings

The following settings control evaluations for AI applications.
Configuration setting Description Required?
OTEL_INSTRUMENTATION_GENAI_EVALS_EVALUATORS

Determines the metric types that are run by the evaluator for AgentInvocation and LLMInvocation. If this variable isn't set, every registered evaluator is enabled with its default metric set.

Examples of accepted values:

  • Deepeval: The default value. Runs the default DeepEval bundle, which measures all of the metrics for every metric type (bias, toxicity, relevance, hallucination, and sentiment).

  • Deepeval(LLMInvocation(bias,toxicity),AgentInvocation(hallucination)): Runs DeepEval evaluations only for bias and toxicity for LLM invocations, and only for hallucination for agent invocations.

  • Deepeval(LLMInvocation(bias(threshold=0.75)),AgentInvocation(bias(threshold=0.5))): Overrides the bias threshold. Sets a bias level of over 0.75 as positive for LLM invocations. Sets a bias level of over 0.5 as positive for agent invocations. Does not run the remaining metrics.

  • none: Deactivates the evaluator.

No
OTEL_INSTRUMENTATION_GENAI_EVALS_RESULTS_AGGREGATION

Condenses evaluations into a single event. Defaults to false.

Accepted values: true, false

No
OTEL_INSTRUMENTATION_GENAI_EVALUATION_SAMPLE_RATE

Determines the sample rate of traces for evaluations. Sampling decisions are made probabilistically based on rate, where rate is the probability (between 0.0 and 1.0) that a span will be sampled for evaluation.

If this setting isn't configured, it defaults to 1 and all spans will be sampled for evaluation.

Accepted values: Values between 0.0 and 1.0.

No
OTEL_INSTRUMENTATION_GENAI_EVALS_SEPARATE_PROCESS

Determines whether the instrumentation framework runs evaluations in a separate process. Use true to run evaluations in a child process with the OpenTelemetry SDK deactivated and prevent evaluator LLM calls from polluting application telemetry.

Defaults to false, meaning that the instrumentation frameworks run evaluations in the same process as your application. LLM calls from evaluators such as DeepEval are instrumented alongside application telemetry.

  • Required for OpenAI instrumentation when evaluations are enabled

  • Optional for all other instrumentation frameworks

OTEL_INSTRUMENTATION_GENAI_EMITTERS_EVALUATION

Customizes which emitters handle evaluation results.

Accepted values: replace-category:SplunkEvaluationResults

No
OTEL_GENAI_EVAL_DEBUG_SKIPS

Specifies if logs are created when measurements are skipped.

Accepted values: true, false

No
OTEL_GENAI_EVAL_DEBUG_EACH

Specifies if a log is created for each evaluation result.

Accepted values: true, false

No
DEEPEVAL_FILE_SYSTEM

Determines if DeepEval can write temporary artifacts to the filesystem.

Use READ_ONLY in locked down environments. Defaults to READ_WRITE.

Accepted values: true, false

No

DeepEval custom LLM provider settings

The default LLM provider for DeepEval evaluations is OpenAI. The following settings can be used to configure a custom LLM provider for DeepEval evaluations. These settings do not affect OpenAI behavior.
Configuration setting Description Required?
DEEPEVAL_LLM_BASE_URL

The custom LLM endpoint URL. Required if you want to use a custom LLM provider for DeepEval evaluations instead of OpenAI.

This setting creates a LiteLLMModel configured for the custom endpoint. It supports both static API keys and OAuth2 token-based authentication.

No
DEEPEVAL_LLM_MODEL The LLM model name. Defaults to gpt-4o-mini. No
DEEPEVAL_LLM_PROVIDER The LLM provider identifier for the model prefix. Defaults to openai. No
DEEPEVAL_LLM_API_KEY The static API key. Only used for providers that do not require OAuth2 token-based authentication. Use this setting or DEEPEVAL_LLM_TOKEN_URL (which enables OAuth2), not both. No
DEEPEVAL_LLM_EXTRA_HEADERS

A JSON-formatted string containing key-value pairs that will be added as HTTP headers to all LLM API requests. Use this setting if your API gateway requires custom headers for authentication or tracking.

Example value: '{"system-code": "APP-123", "x-tenant-id": "tenant-abc"}'.

LiteLLM does not natively support setting extra_headers with environment variables and requires programmatically passing this parameter. This setting is provided for DeepEval users who need to configure custom headers without code changes. For more details on headers in LiteLLM, see Optional Fields in the LiteLLM documentation.

No
DEEPEVAL_LLM_CLIENT_APP_NAME The application key and name. No
DEEPEVAL_LLM_TOKEN_URL

The OAuth2 token endpoint. Used for providers that require OAuth2 token-based authentication. This setting enables OAuth2 mode for DeepEval.

Example value: https://identity.example.com/oauth2/default/v1/token

No
DEEPEVAL_LLM_CLIENT_ID

The OAuth2 client ID.

Used for providers that require OAuth2 token-based authentication. Requires DEEPEVAL_LLM_TOKEN_URL to be set.

No
DEEPEVAL_LLM_CLIENT_SECRET

The OAuth2 client secret. Used for providers that require OAuth2 token-based authentication. Requires DEEPEVAL_LLM_TOKEN_URL to be set.

No