sentry-conventions

Gen_ai Attributes

Stable Attributes

gen_ai.agent.name

The name of the agent being used.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example ResearchAssistant

gen_ai.assistant.message

The assistant message passed to the model.

Property Value
Type string
Has PII true
Exists in OpenTelemetry No
Example get_weather tool call

gen_ai.choice

The model’s response message.

Property Value
Type string
Has PII true
Exists in OpenTelemetry No
Example The weather in Paris is rainy and overcast, with temperatures around 57°F

gen_ai.operation.name

The name of the operation being performed.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example chat

gen_ai.prompt

The input messages sent to the model

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example [{"role": "user", "message": "hello"}]

gen_ai.request.available_tools

The available tools for the model. It has to be a stringified version of an array of objects.

Property Value
Type string
Has PII false
Exists in OpenTelemetry No
Example [{"name": "get_weather", "description": "Get the weather for a given location"}, {"name": "get_news", "description": "Get the news for a given topic"}]

gen_ai.request.frequency_penalty

Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.

Property Value
Type double
Has PII false
Exists in OpenTelemetry Yes
Example 0.5
Aliases ai.frequency_penalty

gen_ai.request.max_tokens

The maximum number of tokens to generate in the response.

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 2048

gen_ai.request.messages

The messages passed to the model. The “content” can be a string or an array of objects. It has to be a stringified version of an array of objects.

Property Value
Type string
Has PII true
Exists in OpenTelemetry No
Example [{"role": "system", "content": "Generate a random number."}, {"role": "user", "content": [{"text": "Generate a random number between 0 and 10.", "type": "text"}]}]

gen_ai.request.model

The model identifier being used for the request.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example gpt-4-turbo-preview

gen_ai.request.presence_penalty

Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.

Property Value
Type double
Has PII false
Exists in OpenTelemetry Yes
Example 0.5
Aliases ai.presence_penalty

gen_ai.request.seed

The seed, ideally models given the same seed and same other parameters will produce the exact same output.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example 1234567890
Aliases ai.seed

gen_ai.request.temperature

For an AI model call, the temperature parameter. Temperature essentially means how random the output will be.

Property Value
Type double
Has PII false
Exists in OpenTelemetry Yes
Example 0.1
Aliases ai.temperature

gen_ai.request.top_k

Limits the model to only consider the K most likely next tokens, where K is an integer (e.g., top_k=20 means only the 20 highest probability tokens are considered).

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 35
Aliases ai.top_k

gen_ai.request.top_p

Limits the model to only consider tokens whose cumulative probability mass adds up to p, where p is a float between 0 and 1 (e.g., top_p=0.7 means only tokens that sum up to 70% of the probability mass are considered).

Property Value
Type double
Has PII false
Exists in OpenTelemetry Yes
Example 0.7
Aliases ai.top_p

gen_ai.response.finish_reasons

The reason why the model stopped generating.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example COMPLETE
Aliases ai.finish_reason

gen_ai.response.id

Unique identifier for the completion.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example gen_123abc
Aliases ai.generation_id

gen_ai.response.model

The vendor-specific ID of the model used.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example gpt-4
Aliases ai.model_id

gen_ai.response.text

The model’s response text messages. It has to be a stringified version of an array of response text messages.

Property Value
Type string
Has PII true
Exists in OpenTelemetry No
Example ["The weather in Paris is rainy and overcast, with temperatures around 57°F", "The weather in London is sunny and warm, with temperatures around 65°F"]

gen_ai.response.tool_calls

The tool calls in the model’s response. It has to be a stringified version of an array of objects.

Property Value
Type string
Has PII true
Exists in OpenTelemetry No
Example [{"name": "get_weather", "arguments": {"location": "Paris"}}]

gen_ai.system

The provider of the model.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example openai
Aliases ai.model.provider

gen_ai.system.message

The system instructions passed to the model.

Property Value
Type string
Has PII true
Exists in OpenTelemetry No
Example You are a helpful assistant

gen_ai.tool.description

The description of the tool being used.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example Searches the web for current information about a topic

gen_ai.tool.input

The input of the tool being used. It has to be a stringified version of the input to the tool.

Property Value
Type string
Has PII true
Exists in OpenTelemetry No
Example {"location": "Paris"}

gen_ai.tool.message

The response from a tool or function call passed to the model.

Property Value
Type string
Has PII true
Exists in OpenTelemetry No
Example rainy, 57°F

gen_ai.tool.name

Name of the tool utilized by the agent.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example Flights
Aliases ai.function_call

gen_ai.tool.output

The output of the tool being used. It has to be a stringified version of the output of the tool.

Property Value
Type string
Has PII true
Exists in OpenTelemetry No
Example rainy, 57°F

gen_ai.tool.type

The type of tool being used.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example function

gen_ai.usage.input_tokens

The number of tokens used in the GenAI input (prompt).

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 10
Aliases ai.prompt_tokens.used, gen_ai.usage.prompt_tokens

gen_ai.usage.input_tokens.cached

The number of cached tokens in the input.

Property Value
Type integer
Has PII false
Exists in OpenTelemetry No
Example 50

gen_ai.usage.output_tokens

The number of tokens used in the GenAI response (completion).

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 10
Aliases ai.completion_tokens.used, gen_ai.usage.completion_tokens

gen_ai.usage.output_tokens.reasoning

The number of tokens used for reasoning in the output.

Property Value
Type integer
Has PII false
Exists in OpenTelemetry No
Example 75

gen_ai.usage.total_cost

The total cost for the tokens used.

Property Value
Type double
Has PII false
Exists in OpenTelemetry No
Example 12.34

gen_ai.usage.total_tokens

The total number of tokens used to process the prompt. (input tokens plus output todkens)

Property Value
Type integer
Has PII false
Exists in OpenTelemetry No
Example 20
Aliases ai.total_tokens.used

gen_ai.user.message

The user message passed to the model.

Property Value
Type string
Has PII true
Exists in OpenTelemetry No
Example What's the weather in Paris?

Deprecated Attributes

These attributes are deprecated and will be removed in a future version. Please use the recommended replacements.

gen_ai.usage.completion_tokens

The number of tokens used in the GenAI response (completion).

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 10
Deprecated Yes, use gen_ai.usage.output_tokens instead
Aliases ai.completion_tokens.used, gen_ai.usage.output_tokens

gen_ai.usage.prompt_tokens

The number of tokens used in the GenAI input (prompt).

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 20
Deprecated Yes, use gen_ai.usage.input_tokens instead
Aliases ai.prompt_tokens.used, gen_ai.usage.input_tokens