LLM application semantic conventions

Updated at:

The Alibaba Cloud GenAI Trace semantic specification is defined on top of LoongSuite GenAI Semantic Conventions and specifies Alibaba Cloud observability extensions, commercial collection requirements, and compatibility rules across common semantics, core spans, specialized and compatibility spans.

1. Specification overview

The Alibaba Cloud GenAI Trace semantic specification depends on LoongSuite GenAI Semantic Conventions 0.1.0 and, on that basis, defines Alibaba Cloud observability extensions, commercial collection requirements, and compatibility rules.

For fields that already exist in the direct baseline, this specification inherits the field names, data types, enumeration values, and base semantics from the pinned LoongSuite version. Throughout this specification, requirement level indicates the collection requirement that Alibaba Cloud agents, SDKs, and manual instrumentation must ultimately comply with.

1.1 Source

The "Source" column in attribute tables uses the following categories:

Source

Meaning

OpenTelemetry (OTel)

Fields inherited from OTel in the LoongSuite dependency baseline

Alibaba Cloud

All non-OTel fields, including Alibaba Cloud extensions in the LoongSuite dependency baseline and the Alibaba Cloud observability fields defined in this specification

"Source" indicates the origin of field semantics, not the field producer, and has only two values: OTel and Alibaba Cloud. LoongSuite is the dependency baseline of this specification and is not an independent source: fields that LoongSuite inherits from OTel are marked as OTel, and all other fields are marked as Alibaba Cloud. When Alibaba Cloud only strengthens a field's collection requirement, the source does not change. The field scope of this specification consists of the LoongSuite dependency version and the Alibaba Cloud observability semantics defined in this document; fields defined by neither must not be added.

1.2 Stability

Stability

Meaning

Development

The field may still undergo incompatible changes

Stable

The field semantics are stable

Deprecated

Not recommended for new instrumentation and retained only for existing data and old agent versions

1.3 Requirement level

Requirement level

Specification meaning

Required

Every implementation that complies with this specification must report the field and cannot disable it through configuration

Conditionally Required

Must be reported when the condition holds; the table must provide an executable and testable condition

Recommended

Should be reported by default but can be disabled for performance, security, privacy, or implementation limits

Opt-In

Not collected by default; collected only after the user explicitly enables it and is aware of the risk

"Conditionally Required" is a mandatory requirement, just like "Required", when the condition holds, and is not a lower priority. Fields used for page display, query, filtering, aggregation, topology, cost analysis, or evaluation must not be below "Conditionally Required" in the corresponding scenario.

"Needed by a product page" alone must not be used as a collection condition. A condition must describe a fact that instrumentation can determine, for example "the provider response returns cache token details", "the current tool call loads a Skill", or "the current operation has directly obtainable input or output content".

2. Common semantics

2.1 Resource Attributes

Key

Source

Stability

Requirement level

Type

Description

Example

service.name

OTel

Stable

Required

string

Name of the service that produces telemetry data

customer-service-agent

acs.arms.service.feature

Alibaba Cloud

Development

Required

string

Indicates that the application has GenAI application characteristics; the value is fixed to genai_app

genai_app

acs.cms.workspace

Alibaba Cloud

Development

Conditionally Required: the application already belongs to a CloudMonitor Workspace and the Workspace identifier is available

string

CloudMonitor Workspace

arms-test

acs.arms.service.id

Alibaba Cloud

Development

Conditionally Required: the application is already registered in ARMS/CMS and the service ID is available

string

CloudMonitor service ID

ggxw4lnjuz@b63ba5a1d60b517ae374f

ali.trace.source

Alibaba Cloud

Development

Conditionally Required: the trace is ingested from an identifiable source such as a gateway or load balancer

string

Access source of the application or trace

mse-gateway; alb

3. Core spans

3.1 Client Inference Span

Represents a client calling a generative AI model or service to perform one inference. One client call may correspond to multiple inferences inside the provider.

Item

Convention

Span type

span.gen_ai.inference.client

Span name

{gen_ai.operation.name}

OTel SpanKind

Usually CLIENT; an in-process model can be INTERNAL

gen_ai.operation.name

chat, generate_content, text_completion, or another documented value

gen_ai.span.kind

LLM

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.operation.name

OTel

Development

Required

string

Inference operation name

chat

gen_ai.provider.name

OTel

Development

Required

string

GenAI provider identified by instrumentation

openai; gcp.vertex_ai

gen_ai.conversation.id

OTel

Development

Conditionally Required: the conversation ID can be obtained directly or is provided by the application context

string

Conversation identifier

conv_123

gen_ai.output.type

OTel

Development

Conditionally Required: the request specifies an output type

string

Requested output modality

text; json; image

gen_ai.request.choice.count

OTel

Development

Conditionally Required: specified by the request and the value is not 1

int

Expected number of candidates

3

gen_ai.request.model

OTel

Development

Conditionally Required: the requested model is available

string

Requested model name

qwen-max

gen_ai.request.seed

OTel

Development

Conditionally Required: the request carries a seed

int

Random seed

100

gen_ai.request.stream

OTel

Development

Conditionally Required: the request is streaming; when unset, the request is non-streaming

boolean

Whether a streaming response is used

true

gen_ai.request.top_k

OTel

Development

Conditionally Required: the model supports top-k and the request sets it

int

Samples at each step only from the K tokens with the highest probability

40

server.port

OTel

Stable

Conditionally Required: server.address is set

int

Model service port

443

error.type

OTel

Stable

Conditionally Required: the operation ends with an error

string

Error type

timeout

gen_ai.usage.input_tokens

OTel

Development

Conditionally Required: the provider response returns the exact input token count, including a value of 0

int

Total input tokens

100

gen_ai.usage.output_tokens

OTel

Development

Conditionally Required: the provider response returns the exact output token count, including a value of 0

int

Total output tokens

180

gen_ai.usage.cache_read.input_tokens

OTel

Development

Conditionally Required: the provider response returns the number of cache read tokens, including a value of 0

int

Number of input tokens read from the provider cache

50

gen_ai.request.frequency_penalty

OTel

Development

Recommended

double

Frequency penalty parameter

0.1

gen_ai.request.max_tokens

OTel

Development

Conditionally Required: the request specifies the maximum number of output tokens

int

Maximum generated tokens

100

gen_ai.request.presence_penalty

OTel

Development

Recommended

double

Presence penalty parameter

0.1

gen_ai.request.reasoning.level

OTel

Development

Conditionally Required: the request specifies a reasoning level

string

Requested reasoning effort

medium

gen_ai.request.stop_sequences

OTel

Development

Recommended

string[]

Stop sequences

["stop"]

gen_ai.request.temperature

OTel

Development

Recommended

double

Temperature parameter

0.7

gen_ai.request.top_p

OTel

Development

Recommended

double

Top-p parameter

1.0

gen_ai.response.finish_reasons

OTel

Development

Conditionally Required: the model or agent response returns finish reasons

string[]

Finish reason of each candidate

["stop"]

gen_ai.response.id

OTel

Development

Recommended

string

Model response ID

resp_123

gen_ai.response.model

OTel

Development

Conditionally Required: the provider response returns the actual response model

string

Model that actually generated the response

qwen-max-2025-01

gen_ai.response.time_to_first_chunk

OTel

Development

Recommended: for streaming requests

double

Time from the start of logical inference to receiving the first response chunk, in seconds

0.5

gen_ai.usage.reasoning.output_tokens

OTel

Development

Recommended: returned by the provider and non-zero

int

Number of output tokens used by the reasoning process; included in the total output tokens

50

server.address

OTel

Stable

Recommended

string

Model service address

dashscope.aliyuncs.com

gen_ai.input.messages

OTel

Development

Conditionally Required: input messages exist

any

Input messages recorded in the actual sending order

[{"role":"user","parts":[{"type":"text","content":"Weather in Paris?"}]}]

gen_ai.iteration.per_token_batch_size

OTel

Development

Opt-In

int[]

Decoding iteration batch size corresponding to each output token

[32, 32, 28]

gen_ai.iteration.per_token_cumulative_count

OTel

Development

Opt-In

int[]

Cumulative number of tokens generated by the engine or scheduler corresponding to each output token

[4096, 4097, 4098]

gen_ai.iteration.per_token_waiting_requests

OTel

Development

Opt-In

int[]

Number of waiting requests in the scheduling queue when each output token is scheduled

[120, 98, 105]

gen_ai.output.messages

OTel

Development

Conditionally Required: the model produces output

any

Candidate output messages produced by the model

[{"role":"assistant","parts":[{"type":"text","content":"It is rainy in Paris."}],"finish_reason":"stop"}]

gen_ai.response.candidate.per_position_decoded_tokens

OTel

Development

Opt-In

any

Candidate decoded token strings at each generated token position, ordered by candidate rank, with the actual output token first

[["Hello","Hi"],["there","world"]]

gen_ai.response.candidate.per_position_logprobs

OTel

Development

Opt-In

any

Log probability of candidate tokens at each generated token position, aligned with candidate token IDs

[[-0.12,-1.03],[-0.05,-2.11]]

gen_ai.response.candidate.per_position_token_ids

OTel

Development

Opt-In

any

Candidate token IDs at each generated token position, aligned with candidate decoded tokens

[[15043,1723],[1052,995]]

gen_ai.response.per_token_new_tokens

OTel

Development

Opt-In

int[]

Number of newly generated tokens corresponding to each recorded output token position, mainly for multi-token prediction systems

[2, 3, 1]

gen_ai.response.per_token_time_to_generate

OTel

Development

Opt-In

double[]

Relative time from the start of the span to the generation of each output token, in seconds

[0.0031, 0.0059, 0.0088]

gen_ai.response.per_token_time_to_schedule

OTel

Development

Opt-In

double[]

Relative time from the start of the span to the scheduling of each output token, in seconds

[0.001, 0.004, 0.007]

gen_ai.system_instructions

OTel

Development

Conditionally Required: system instructions are independent of the message history

any

Independent system instructions

[{"type":"text","content":"You are a helpful assistant."}]

gen_ai.tool.definitions

OTel

Development

Conditionally Required: the request carries tool definitions

any

Tool definitions available for the model to call

[{"type":"function","name":"get_weather","parameters":{"type":"object","properties":{"location":{"type":"string"}},"required":["location"]}}]

gen_ai.usage.cache_creation.input_tokens

Alibaba Cloud

Development

Conditionally Required: the provider response returns the number of cache creation tokens, including a value of 0

int

Number of input tokens written to the model provider cache; already included in the total input tokens

25

gen_ai.response.time_to_first_token

Alibaba Cloud

Development

Conditionally Required: streaming response and instrumentation can directly measure the time from the start of model inference to the first output token

int

First-token latency of the large model itself, in nanoseconds; must not be replaced by the end-to-end user first-byte latency

1000000

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to LLM

LLM

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current inference is available

string

Application end-user identifier

u-lK8JddD

gen_ai.response.reasoning_time

Alibaba Cloud

Development

Conditionally Required: the provider returns an exact value, or instrumentation can directly measure the latency of the model reasoning/thinking phase

int

Latency of the model reasoning/thinking phase, in milliseconds

1248

gen_ai.latency.time_in_model_prefill

Alibaba Cloud

Development

Conditionally Required: the inference engine directly provides the exact prefill phase latency

int

Model prefill phase latency, in nanoseconds

1000000

gen_ai.latency.time_in_model_decode

Alibaba Cloud

Development

Conditionally Required: the inference engine directly provides the exact decode phase latency

int

Model decode phase latency, in nanoseconds

5000000

gen_ai.input.multimodal_metadata

Alibaba Cloud

Development

Conditionally Required: the input messages contain URI-type multimodal content

string (JSON array)

Input multimodal metadata; each item contains type, mime_type, uri, and modality, and only URI-type content is recorded

[{"type":"uri","mime_type":"image/png","uri":"oss://bucket/image.png","modality":"image"}]

gen_ai.output.multimodal_metadata

Alibaba Cloud

Development

Conditionally Required: the output messages contain URI-type multimodal content

string (JSON array)

Output multimodal metadata; each item contains type, mime_type, uri, and modality, and only URI-type content is recorded

[{"type":"uri","mime_type":"image/png","uri":"oss://bucket/output.png","modality":"image"}]

Important field notes

  • gen_ai.operation.name and gen_ai.span.kind: gen_ai.operation.name indicates the specific GenAI operation executed by the current span, and gen_ai.span.kind indicates the upper-layer type used by the console for display, query, aggregation, and topology. The two have a many-to-one relationship, and a unique gen_ai.operation.name cannot be derived from gen_ai.span.kind alone. Defined operation names must use the corresponding span type in the following table; when a custom operation name is added, its meaning and the corresponding gen_ai.span.kind must be documented at the same time, and existing mappings must not be changed. This rule applies to all spans defined in this document.

    gen_ai.operation.name

    gen_ai.span.kind

    Applicable span

    chat, generate_content, text_completion

    LLM

    Client Inference Span

    embeddings

    EMBEDDING

    Embeddings Span

    retrieval

    RETRIEVER

    Retrieval Span

    execute_tool

    TOOL

    Execute Tool Span

    create_agent, invoke_agent

    AGENT

    Create Agent Span, Client Invoke Agent Span, Internal Invoke Agent Span

    invoke_workflow

    WORKFLOW

    Internal Invoke Workflow Span

    rerank

    RERANKER

    Reranking Span

    react

    STEP

    ReAct Step Span

    workflow, task

    CHAIN

    Chain Span; use when the operation type can be clearly identified

    run_task

    TASK

    Task Span

    enter

    ENTRY

    Entry Span

  • gen_ai.request.model and gen_ai.response.model: the former indicates the model specified by the request, and the latter indicates the model that the server actually executed and returned a response for. The two may differ.

  • gen_ai.input.messages, gen_ai.output.messages, gen_ai.system_instructions, and gen_ai.tool.definitions must use OTel AnyValue and comply with the corresponding LoongSuite JSON Schema, and must not be downgraded to arbitrary JSON strings. They must be collected when the field applies, the content exists, and instrumentation can obtain it.

  • gen_ai.usage.cache_read.input_tokens and gen_ai.usage.cache_creation.input_tokens are both included in gen_ai.usage.input_tokens and must not be added to the total input tokens again. They must also be reported when the provider returns 0, to distinguish "value is 0" from "field is missing".

  • gen_ai.usage.reasoning.output_tokens indicates the output tokens used by the reasoning process and is already included in gen_ai.usage.output_tokens; it must not be counted again.

  • gen_ai.response.time_to_first_chunk is in seconds and indicates the time from the start of logical inference to receiving the first response chunk.

  • gen_ai.response.time_to_first_token is an integer in nanoseconds and indicates the time from the start of inference by the large model itself to the generation of the first output token. It must not be replaced by the first-byte latency, network first-packet latency, total agent latency, or client rendering latency.

  • gen_ai.response.reasoning_time is an integer in milliseconds. gen_ai.latency.time_in_model_prefill and gen_ai.latency.time_in_model_decode are integers in nanoseconds and can only use phase boundaries directly provided by the inference engine; they must not be split by estimating from the total latency.

  • gen_ai.input.multimodal_metadata and gen_ai.output.multimodal_metadata must be parseable JSON object array strings. Each item contains type, mime_type, uri, and modality, and only URI-type multimodal content is recorded. The field is omitted when the array is empty.

3.2 Embeddings Span

Represents a call to an embedding model or service to convert one or more inputs into vectors.

Item

Convention

Span type

span.gen_ai.embeddings.client

Span name

{gen_ai.operation.name}

OTel SpanKind

CLIENT

gen_ai.operation.name

embeddings

gen_ai.span.kind

EMBEDDING

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.operation.name

OTel

Development

Required

string

Fixed to embeddings

embeddings

gen_ai.provider.name

OTel

Development

Required

string

Embedding service provider

openai

gen_ai.request.model

OTel

Development

Conditionally Required: the requested model is available

string

Requested model

text-embedding-3-small

server.port

OTel

Stable

Conditionally Required: server.address is set

int

Service port

443

error.type

OTel

Stable

Conditionally Required: the operation ends with an error

string

Error type

timeout

gen_ai.request.encoding_formats

OTel

Development

Recommended

string[]

Requested embedding encoding format

["float"]

gen_ai.embeddings.dimension.count

OTel

Development

Recommended

int

Embedding vector dimension

1024

gen_ai.usage.input_tokens

OTel

Development

Conditionally Required: the provider response returns the exact input token count, including a value of 0

int

Total tokens of all inputs

10

gen_ai.response.model

OTel

Development

Conditionally Required: the provider response returns the actual response model

string

Actual response model

text-embedding-3-small

server.address

OTel

Stable

Recommended

string

Embedding service address

api.openai.com

gen_ai.conversation.id

OTel

Development

Conditionally Required: the operation belongs to an identifiable conversation and the conversation ID is available

string

Conversation identifier

conv_123

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to EMBEDDING

EMBEDDING

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current embedding operation is available

string

Application end-user identifier

u-lK8JddD

Important field notes

  • gen_ai.operation.name is fixed to embeddings, and gen_ai.span.kind is fixed to EMBEDDING.

  • gen_ai.request.model indicates the embedding model specified by the request, and gen_ai.response.model indicates the model that the server actually executed and returned. The two may differ.

  • gen_ai.usage.input_tokens indicates the total number of tokens of all inputs in this embedding operation. Report it only when the provider returns an exact value, including a value of 0.

  • gen_ai.embeddings.dimension.count indicates the dimension of a single embedding vector, not the number of vectors produced by this request.

  • gen_ai.request.encoding_formats indicates the encoding format of the requested embedding vectors, for example float, and is not used to express the MIME Type of the input content.

3.3 Retrieval Span

Represents a single retrieval pipeline executed by a GenAI framework or application. For remote requests to an independent vector database, search service, or database, the corresponding database or client semantic specification should be used preferentially; a Retrieval Span must not be used to express the same remote call twice.

Item

Convention

Span type

span.gen_ai.retrieval.client

Span name

retrieval

OTel SpanKind

CLIENT

gen_ai.operation.name

retrieval

gen_ai.span.kind

RETRIEVER

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.operation.name

OTel

Development

Required

string

Fixed to retrieval

retrieval

gen_ai.data_source.id

OTel

Development

Conditionally Required: the retrieval targets an identifiable data source

string

Unique data source identifier

kb_123

gen_ai.provider.name

OTel

Development

Conditionally Required: the operation involves an identifiable managed retrieval provider

string

Retrieval provider

aws.bedrock

gen_ai.conversation.id

OTel

Development

Conditionally Required: the retrieval belongs to an identifiable conversation and the conversation ID is available

string

Conversation identifier

conv_123

error.type

OTel

Stable

Conditionally Required: the retrieval fails

string

Error type

timeout

server.port

OTel

Stable

Conditionally Required: server.address is set

int

Retrieval service port

443

gen_ai.request.top_k

OTel

Development

Recommended

int

Maximum number of documents requested

5

server.address

OTel

Stable

Recommended

string

Retrieval service address

vector.example.com

gen_ai.retrieval.query.text

OTel

Development

Conditionally Required: the query text exists

string

Retrieval query text

refund policy

gen_ai.retrieval.documents

OTel

Development

Conditionally Required: the retrieval returns documents

any

Recalled documents and relevance information

[{"id":"doc_123","score":0.95}]

gen_ai.request.model

OTel

Development

Conditionally Required: the retrieval operation explicitly uses an embedding, sparse retrieval, or other model and the model name is available

string

Name of the model used for retrieval

text-embedding-v3

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to RETRIEVER

RETRIEVER

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current retrieval operation is available

string

Application end-user identifier

u-lK8JddD

Important field notes

  • gen_ai.operation.name is fixed to retrieval, and gen_ai.span.kind is fixed to RETRIEVER.

  • A Retrieval Span represents a single retrieval pipeline executed by a GenAI framework or application. For remote requests to an independent vector database, search service, or database, the corresponding database or client semantics should be used preferentially, and a parallel Retrieval Span must not be created for the same remote call.

  • gen_ai.data_source.id indicates a stable unique identifier of the data source being retrieved and should not be replaced by the request ID, a temporary connection ID, or a random value.

  • gen_ai.request.model only indicates the embedding, sparse retrieval, or other retrieval model explicitly used in this retrieval, not the LLM used to generate the answer subsequently.

  • gen_ai.request.top_k indicates the maximum number of documents that the request allows to return, not the number of documents actually recalled.

  • gen_ai.retrieval.query.text indicates the query text actually used for retrieval. It must be collected when the field applies, the query exists, and instrumentation can obtain it.

  • gen_ai.retrieval.documents indicates recalled documents and their relevance information and must use OTel AnyValue and comply with the LoongSuite JSON Schema. It should not be written as an unconstrained JSON string.

3.4 Execute Tool Span

Represents an application or agent executing a tool. Skill loading, reading resources, and running scripts are refined scenarios of Execute Tool and do not create separate parallel Skill Span types.

Item

Convention

Span type

span.gen_ai.execute_tool.internal

Span name

execute_tool {gen_ai.tool.name}; for Skill scenarios, append the Skill or resource name according to OTel rules

OTel SpanKind

INTERNAL; a remote protocol call can be expressed by the corresponding CLIENT Span

gen_ai.operation.name

execute_tool

gen_ai.span.kind

TOOL

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.operation.name

OTel

Development

Required

string

Fixed to execute_tool

execute_tool

gen_ai.tool.name

OTel

Development

Required

string

Tool name

get_weather

gen_ai.conversation.id

OTel

Development

Conditionally Required: the conversation ID is available

string

Conversation identifier

conv_123

gen_ai.tool.call.id

OTel

Development

Conditionally Required: the model or provider provides a Tool Call ID

string

Tool Call ID

call_123

error.type

OTel

Stable

Conditionally Required: tool execution fails

string

Error type

tool_error

gen_ai.tool.description

OTel

Development

Recommended: available

string

Tool description

Get current weather

gen_ai.tool.type

OTel

Development

Recommended: available

string

Tool type

function; extension; datastore

gen_ai.tool.call.arguments

OTel

Development

Conditionally Required: call arguments exist

any

Tool call arguments

{"location":"Paris","date":"2025-10-01"}

gen_ai.tool.call.result

OTel

Development

Conditionally Required: the tool returns a result successfully

any

Tool call result

{"temperature":18,"conditions":"rainy"}

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to TOOL

TOOL

gen_ai.skill.name

Alibaba Cloud

Development

Conditionally Required: the tool operation loads a Skill and the name is available

string

Agent Skill name

code-review

gen_ai.skill.id

Alibaba Cloud

Development

Conditionally Required: the tool operation loads a Skill and a stable ID is available

string

Skill stable identifier; must not be faked through a name hash

skill_29bbe8a7

gen_ai.skill.description

Alibaba Cloud

Development

Conditionally Required: the tool is associated with a Skill, the description is available, and the security policy allows collection

string

Skill description, which may contain sensitive information

Review source code

gen_ai.skill.version

Alibaba Cloud

Development

Conditionally Required: the tool operation loads a Skill and the version is available

string

Skill version

1.2.0

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current tool operation is available

string

Application end-user identifier

u-lK8JddD

Important field notes

  • gen_ai.operation.name is fixed to execute_tool, and gen_ai.span.kind is fixed to TOOL.

  • gen_ai.tool.name indicates the stable name of the tool, and gen_ai.tool.call.id indicates the instance identifier of a single Tool Call. The two must not be mixed up.

  • gen_ai.tool.call.arguments indicates the tool call arguments. It must be collected when the arguments exist, and must use OTel AnyValue and the corresponding LoongSuite JSON Schema; it should not be uniformly serialized into an arbitrary JSON string.

  • gen_ai.tool.call.result indicates the result returned after the tool executes successfully. Report it only when the tool succeeds and the result exists; failure information should be expressed through the span status and error.type.

  • gen_ai.tool.description and gen_ai.tool.type indicate the tool description and tool type, respectively. They are not part of the tool call arguments.

  • gen_ai.skill.name, gen_ai.skill.id, and gen_ai.skill.version are reported only when the current tool operation actually loads or uses a Skill. gen_ai.skill.id must be a stable identifier and must not be faked through a name hash, a random value, or a temporary object ID.

  • gen_ai.skill.description may contain sensitive information and is reported only when the description is available and the security policy allows collection.

  • Execute Tool Span represents the tool execution itself. Remote HTTP, RPC, or database calls that occur inside the tool can continue to be expressed by the corresponding protocol's CLIENT Span.

3.5 Create Agent Span

Represents creating or configuring an Agent resource through a remote Agent service.

Item

Convention

Span type

span.gen_ai.create_agent.client

Span name

create_agent {gen_ai.agent.name}; when the name is unknown, create_agent

OTel SpanKind

CLIENT

gen_ai.operation.name

create_agent

gen_ai.span.kind

AGENT

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.operation.name

OTel

Development

Required

string

Fixed to create_agent

create_agent

gen_ai.provider.name

OTel

Development

Required

string

Agent service provider

aws.bedrock

gen_ai.agent.id

OTel

Development

Conditionally Required: the service returns a stable Agent ID

string

ID of the created Agent

agent_123

gen_ai.agent.name

OTel

Development

Conditionally Required: the application provides a name

string

Agent name

customer-support

gen_ai.agent.description

OTel

Development

Conditionally Required: the application provides a description

string

Agent description

Customer support agent

gen_ai.agent.version

OTel

Development

Conditionally Required: the application provides a version

string

Agent version

1.2.0

gen_ai.request.model

OTel

Development

Conditionally Required: the creation request specifies a model

string

Model used by the Agent

qwen-max

server.port

OTel

Stable

Conditionally Required: server.address is set

int

Service port

443

error.type

OTel

Stable

Conditionally Required: the creation operation fails

string

Error type

validation_error

server.address

OTel

Stable

Recommended

string

Agent service address

bedrock.amazonaws.com

gen_ai.system_instructions

OTel

Development

Conditionally Required: the creation request contains independent system instructions

any

Agent system instructions

[{"type":"text","content":"You are a helpful assistant."}]

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to AGENT

AGENT

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the creation operation is triggered by an identifiable application end user and the user identifier is available

string

Application end-user identifier

u-lK8JddD

Important field notes

  • gen_ai.operation.name is fixed to create_agent, and gen_ai.span.kind is fixed to AGENT.

  • Create Agent Span represents creating or configuring an Agent resource through a remote Agent service, and the OTel SpanKind is CLIENT.

  • gen_ai.agent.id indicates the stable Agent ID returned by the server. When only an Agent name is available without a stable ID, a random value or a name hash must not be generated as a substitute.

  • gen_ai.agent.name, gen_ai.agent.description, and gen_ai.agent.version indicate the Agent name, description, and version configured in the creation request, respectively, not the user or session that calls the Agent.

  • gen_ai.request.model indicates the model configured for the Agent in the creation request, not the service version used by the Create Agent API itself.

  • gen_ai.system_instructions indicates the Agent system instructions independently configured in the creation request and must comply with the corresponding LoongSuite structured content Schema.

3.6 Client Invoke Agent Span

Represents a client calling an out-of-process or remote Agent service. Operations such as LLM and Tool inside the remote service should not be faked as child spans on the client.

Item

Convention

Span type

span.gen_ai.invoke_agent.client

Span name

invoke_agent {gen_ai.agent.name}; when the name is unknown, invoke_agent

OTel SpanKind

CLIENT

gen_ai.operation.name

invoke_agent

gen_ai.span.kind

AGENT

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.operation.name

OTel

Development

Required

string

Fixed to invoke_agent

invoke_agent

gen_ai.provider.name

OTel

Development

Required

string

Agent service provider

aws.bedrock

gen_ai.agent.id

OTel

Development

Conditionally Required: a stable Agent ID is available

string

Agent ID

agent_123

gen_ai.agent.name

OTel

Development

Conditionally Required: a low-cardinality name is available

string

Agent name

customer-support

gen_ai.agent.description

OTel

Development

Conditionally Required: the description is available

string

Agent description

Customer support agent

gen_ai.agent.version

OTel

Development

Conditionally Required: the version is available

string

Agent version

1.2.0

gen_ai.conversation.id

OTel

Development

Conditionally Required: the conversation ID is available

string

Conversation identifier

conv_123

gen_ai.data_source.id

OTel

Development

Conditionally Required: the call is bound to a single data source and the ID is available

string

Data source identifier

kb_123

gen_ai.output.type

OTel

Development

Conditionally Required: the request specifies an output type

string

Requested output modality

text; json; image

gen_ai.request.choice.count

OTel

Development

Conditionally Required: specified by the request and the value is not 1

int

Expected number of candidates

3

gen_ai.request.seed

OTel

Development

Conditionally Required: the request carries a seed

int

Random seed

100

gen_ai.request.max_tokens

OTel

Development

Conditionally Required: the request specifies the maximum number of output tokens

int

Maximum generated tokens

100

gen_ai.request.model

OTel

Development

Conditionally Required: the remote call explicitly specifies a model

string

Requested model

qwen-max

server.port

OTel

Stable

Conditionally Required: server.address is set

int

Service port

443

error.type

OTel

Stable

Conditionally Required: the operation ends with an error

string

Error type

timeout

gen_ai.response.finish_reasons

OTel

Development

Conditionally Required: the model or agent response returns finish reasons

string[]

Finish reasons returned by the Agent

["stop"]

gen_ai.request.frequency_penalty

OTel

Development

Recommended

double

Frequency penalty parameter

0.1

gen_ai.request.presence_penalty

OTel

Development

Recommended

double

Presence penalty parameter

0.1

gen_ai.request.stop_sequences

OTel

Development

Recommended

string[]

Stop sequences

["forest", "lived"]

gen_ai.request.temperature

OTel

Development

Recommended

double

Temperature parameter

0.0

gen_ai.request.top_p

OTel

Development

Recommended

double

Top-p parameter

1.0

server.address

OTel

Stable

Recommended

string

Remote Agent service address

agents.example.com

gen_ai.input.messages

OTel

Development

Conditionally Required: input messages exist

any

Agent input messages

[{"role":"user","parts":[{"type":"text","content":"Weather in Paris?"}]}]

gen_ai.output.messages

OTel

Development

Conditionally Required: the Agent produces output

any

Agent output messages

[{"role":"assistant","parts":[{"type":"text","content":"It is rainy in Paris."}],"finish_reason":"stop"}]

gen_ai.usage.input_tokens

OTel

Development

Conditionally Required: the remote Agent response directly returns the exact aggregate input token count, including a value of 0

int

Aggregate input tokens of the Agent call

100

gen_ai.usage.output_tokens

OTel

Development

Conditionally Required: the remote Agent response directly returns the exact aggregate output token count, including a value of 0

int

Aggregate output tokens of the Agent call

180

gen_ai.usage.cache_read.input_tokens

OTel

Development

Conditionally Required: the remote Agent response directly returns the exact aggregate cache read token count, including a value of 0

int

Aggregate cache read tokens; already included in the aggregate input tokens

50

gen_ai.system_instructions

OTel

Development

Conditionally Required: the call request contains independent system instructions

any

Agent system instructions

[{"type":"text","content":"You are a helpful assistant."}]

gen_ai.tool.definitions

OTel

Development

Conditionally Required: the call request carries tool definitions

any

Tool definitions available for the Agent to call

[{"type":"function","name":"get_weather","parameters":{"type":"object","properties":{"location":{"type":"string"}},"required":["location"]}}]

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to AGENT

AGENT

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current Agent call is available

string

Application end-user identifier

u-lK8JddD

gen_ai.usage.cache_creation.input_tokens

Alibaba Cloud

Development

Conditionally Required: the remote Agent response directly returns the exact aggregate cache creation token count, including a value of 0

int

Aggregate cache creation tokens; already included in the aggregate input tokens

25

gen_ai.response.time_to_first_token

Alibaba Cloud

Development

Conditionally Required: streaming Agent response and instrumentation can directly measure the time from the start of the Agent call to the first output token

int

First-token latency of the Agent, in nanoseconds; must not be replaced by the first-byte or client rendering latency

1000000

Important field notes

  • gen_ai.operation.name is fixed to invoke_agent, gen_ai.span.kind is fixed to AGENT, and the OTel SpanKind is CLIENT.

  • Client Invoke Agent Span represents calling an out-of-process or remote Agent service. Operations such as LLM, Tool, and Retrieval executed inside the remote Agent should not be faked by the client as child spans of this span.

  • gen_ai.agent.id, gen_ai.agent.name, and gen_ai.agent.version indicate the stable ID, low-cardinality name, and version of the called Agent, respectively.

  • gen_ai.input.messages and gen_ai.output.messages indicate the input messages sent to the remote Agent and the output messages returned by the remote Agent, respectively, and must comply with the LoongSuite Message Schema.

  • Usage fields on an Agent Span indicate the aggregate usage of the entire remote Agent call. Report them only when the remote Agent response directly returns exact aggregate values; they must not be inferred by the client.

  • Cache read and cache creation tokens are both included in the aggregate input tokens and must not be counted again; they must also be retained when the server returns 0.

  • gen_ai.response.time_to_first_token is an integer in nanoseconds and indicates the time from the start of the remote Agent call to the Agent producing the first output token. It must not be replaced by the first-byte or client rendering latency.

3.7 Internal Invoke Agent Span

Represents an application calling an Agent within the same process. A Workflow uses the separate LoongSuite Span type defined in section 3.8 and must not reuse this type while only changing the operation name.

Item

Convention

Span type

span.gen_ai.invoke_agent.internal

Span name

invoke_agent {gen_ai.agent.name}; when the name is unknown, invoke_agent

OTel SpanKind

INTERNAL

gen_ai.operation.name

invoke_agent

gen_ai.span.kind

AGENT

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.operation.name

OTel

Development

Required

string

Fixed to invoke_agent

invoke_agent

gen_ai.provider.name

OTel

Development

Required

string

Agent provider or framework provider

openai

gen_ai.agent.id

OTel

Development

Conditionally Required: a stable Agent ID is available

string

Agent ID

agent_123

gen_ai.agent.name

OTel

Development

Conditionally Required: a low-cardinality Agent name is available

string

Agent name

customer-support

gen_ai.agent.description

OTel

Development

Conditionally Required: the description is available

string

Agent description

Customer support agent

gen_ai.agent.version

OTel

Development

Conditionally Required: the version is available

string

Agent version

1.2.0

gen_ai.conversation.id

OTel

Development

Conditionally Required: the conversation ID is available

string

Conversation identifier

conv_123

gen_ai.data_source.id

OTel

Development

Conditionally Required: the Agent is bound to a single data source and the ID is available

string

Data source identifier

kb_123

gen_ai.output.type

OTel

Development

Conditionally Required: the request specifies an output type

string

Requested output modality

json

gen_ai.request.choice.count

OTel

Development

Conditionally Required: specified by the request and the value is not 1

int

Number of candidates

3

gen_ai.request.seed

OTel

Development

Conditionally Required: the request carries a seed

int

Random seed

100

gen_ai.request.max_tokens

OTel

Development

Conditionally Required: the request specifies the maximum number of output tokens

int

Maximum generated tokens

100

error.type

OTel

Stable

Conditionally Required: the operation ends with an error

string

Error type

tool_error

gen_ai.usage.input_tokens

OTel

Development

Conditionally Required: the framework directly returns an exact aggregate value

int

Aggregate input tokens of the Agent call

100

gen_ai.usage.output_tokens

OTel

Development

Conditionally Required: the framework directly returns an exact aggregate value

int

Aggregate output tokens of the Agent call

180

gen_ai.usage.cache_read.input_tokens

OTel

Development

Conditionally Required: the framework returns an exact cache read value

int

Aggregate cache read tokens

50

gen_ai.request.model

OTel

Development

Conditionally Required: the model used by the current operation can be clearly determined

string

Agent configuration model

qwen-max

gen_ai.response.finish_reasons

OTel

Development

Conditionally Required: the model or agent response returns finish reasons

string[]

Agent finish reasons

["stop"]

gen_ai.request.frequency_penalty

OTel

Development

Recommended

double

Frequency penalty parameter

0.1

gen_ai.request.presence_penalty

OTel

Development

Recommended

double

Presence penalty parameter

0.1

gen_ai.request.stop_sequences

OTel

Development

Recommended

string[]

Stop sequences

["forest", "lived"]

gen_ai.request.temperature

OTel

Development

Recommended

double

Temperature parameter

0.0

gen_ai.request.top_p

OTel

Development

Recommended

double

Top-p parameter

1.0

gen_ai.input.messages

OTel

Development

Conditionally Required: message input exists

any

Agent input messages

[{"role":"user","parts":[{"type":"text","content":"Weather in Paris?"}]}]

gen_ai.output.messages

OTel

Development

Conditionally Required: message output is produced

any

Agent output messages

[{"role":"assistant","parts":[{"type":"text","content":"It is rainy in Paris."}],"finish_reason":"stop"}]

gen_ai.system_instructions

OTel

Development

Conditionally Required: independent system instructions exist

any

Independent system instructions

[{"type":"text","content":"You are a helpful assistant."}]

gen_ai.tool.definitions

OTel

Development

Conditionally Required: the Agent is configured with or the request carries tool definitions

any

Tool definitions available for the Agent to call

[{"type":"function","name":"get_weather","parameters":{"type":"object","properties":{"location":{"type":"string"}},"required":["location"]}}]

gen_ai.usage.cache_creation.input_tokens

Alibaba Cloud

Development

Conditionally Required: the framework directly returns an exact aggregate cache creation value, including a value of 0

int

Aggregate cache creation tokens; already included in the aggregate input tokens

25

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to AGENT

AGENT

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current Agent call is available

string

Application end-user identifier

u-lK8JddD

gen_ai.response.time_to_first_token

Alibaba Cloud

Development

Conditionally Required: streaming Agent response and instrumentation can directly measure the time from the start of the Agent call to the first output token

int

First-token latency of the Agent, in nanoseconds; must not be replaced by the first-byte or client rendering latency

1000000

Important field notes

  • gen_ai.operation.name is fixed to invoke_agent, gen_ai.span.kind is fixed to AGENT, and the OTel SpanKind is INTERNAL.

  • Internal Invoke Agent Span only represents a single Agent call within the same process. A Workflow must use Internal Invoke Workflow Span and must not reuse this type by changing the operation name.

  • gen_ai.provider.name indicates the provider of the current Agent or the framework provider, not the Instrumentation implementation name.

  • gen_ai.request.model is reported only when the request model used by the current Agent can be clearly determined and must not be guessed backward from a child LLM Span.

  • gen_ai.input.messages and gen_ai.output.messages indicate the input and output messages at the boundary of the current Agent call, not any internal state or a concatenation of all child Span content.

  • Agent aggregate Usage can be reported only when the framework directly provides exact values or instrumentation can reliably deduplicate all child calls. Do not simply add up the parent Span and child Spans, to avoid double-counting tokens.

  • gen_ai.response.time_to_first_token indicates the time from the start of the current Agent call itself to the first output token, not the first-token latency of an internal LLM child Span.

3.8 Internal Invoke Workflow Span

Represents an application executing an identifiable Workflow composed of multiple Agents or other GenAI operations within the same process. Create this Span only when the framework can reliably distinguish a Workflow from a regular Agent call.

Item

Convention

Span type

span.gen_ai.invoke_workflow.internal

Span name

invoke_workflow {gen_ai.workflow.name}; when the name is unknown, invoke_workflow

OTel SpanKind

INTERNAL

gen_ai.operation.name

invoke_workflow

gen_ai.span.kind

WORKFLOW

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.operation.name

OTel

Development

Required

string

Fixed to invoke_workflow

invoke_workflow

gen_ai.workflow.name

OTel

Development

Conditionally Required: a low-cardinality Workflow name is available

string

Workflow name

customer-support-pipeline

gen_ai.conversation.id

OTel

Development

Conditionally Required: the conversation ID is available

string

Conversation identifier

conv_123

error.type

OTel

Stable

Conditionally Required: the operation ends with an error

string

Error type

workflow_error

gen_ai.input.messages

OTel

Development

Conditionally Required: message input exists

any

Workflow input messages

[{"role":"user","parts":[{"type":"text","content":"Weather in Paris?"}]}]

gen_ai.output.messages

OTel

Development

Conditionally Required: message output is produced

any

Workflow output messages

[{"role":"assistant","parts":[{"type":"text","content":"It is rainy in Paris."}],"finish_reason":"stop"}]

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to WORKFLOW

WORKFLOW

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current Workflow is available

string

Application end-user identifier

u-lK8JddD

Important field notes

  • gen_ai.operation.name is fixed to invoke_workflow, gen_ai.span.kind is fixed to WORKFLOW, and the OTel SpanKind is INTERNAL.

  • Create Internal Invoke Workflow Span only when the framework can reliably distinguish a Workflow from a regular Agent call.

  • gen_ai.workflow.name indicates a low-cardinality, stable Workflow name and should not use a name that contains user input, request IDs, or dynamic parameters.

  • gen_ai.input.messages and gen_ai.output.messages are used only to express message input and output that comply with the LoongSuite Message Schema, not to carry arbitrary Workflow State.

4. Specialized and compatibility spans

4.1 Reranking Span

Represents rescoring and reordering candidate documents based on a query. This Span is defined by the LoongSuite direct baseline and is an Alibaba Cloud open source extension.

Item

Convention

Span type

span.gen_ai.rerank.client

Span name

rerank {gen_ai.request.model}; when the model is unknown, rerank

OTel SpanKind

CLIENT

gen_ai.operation.name

rerank

gen_ai.span.kind

RERANKER

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.provider.name

OTel

Development

Conditionally Required: calling an identifiable remote Rerank provider

string

Rerank service provider

cohere

gen_ai.request.model

OTel

Development

Conditionally Required: the model name is available

string

Rerank model

rerank-v3.5

gen_ai.conversation.id

OTel

Development

Conditionally Required: the reranking belongs to an identifiable conversation and the conversation ID is available

string

Conversation identifier

conv_123

error.type

OTel

Stable

Conditionally Required: the reranking fails

string

Error type

timeout

gen_ai.request.top_k

OTel

Development

Conditionally Required: the request specifies the number to return

int

Number of documents retained after reranking

5

gen_ai.operation.name

Alibaba Cloud

Development

Required

string

Alibaba Cloud extension value, fixed to rerank

rerank

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to RERANKER

RERANKER

gen_ai.rerank.query.text

Alibaba Cloud

Development

Conditionally Required: the query exists

string

Query text used for reranking

refund policy

gen_ai.rerank.input_documents

Alibaba Cloud

Development

Conditionally Required: candidate documents exist

any

Candidate documents before reranking

[{"id":"doc_001","text":"Document about machine learning"}]

gen_ai.rerank.output_documents

Alibaba Cloud

Development

Conditionally Required: reranking produces a result

any

Documents and scores after reranking

[{"index":0,"relevance_score":0.95,"id":"doc_001","text":"Document about machine learning"}]

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current reranking operation is available

string

Application end-user identifier

u-lK8JddD

Important field notes

  • gen_ai.operation.name is fixed to rerank, and gen_ai.span.kind is fixed to RERANKER.

  • gen_ai.request.model indicates the model that actually performs the reranking, not the model that generates the query or the final answer.

  • gen_ai.request.top_k indicates the maximum number of documents that the request retains after reranking, not the number of input candidate documents.

  • gen_ai.rerank.query.text indicates the query text actually used for reranking.

  • gen_ai.rerank.input_documents indicates the candidate documents before reranking, and gen_ai.rerank.output_documents indicates the documents and relevance scores after reranking. Both must comply with the corresponding LoongSuite JSON Schema.

  • New instrumentation must not use the old field names such as reranker.query, reranker.model_name, reranker.top_k, reranker.input_document, and reranker.output_document.

4.2 ReAct Step Span

Represents one complete Reasoning-Acting iteration in the ReAct pattern, which can contain one or more LLM, Tool, or Retrieval child Spans.

Item

Convention

Span type

span.gen_ai.react_step.internal

Span name

react step

OTel SpanKind

INTERNAL

gen_ai.operation.name

react

gen_ai.span.kind

STEP

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.conversation.id

OTel

Development

Conditionally Required: the conversation ID is available

string

Conversation identifier

conv_123

error.type

OTel

Stable

Conditionally Required: this round ends with an error

string

Error type

tool_error

gen_ai.operation.name

Alibaba Cloud

Development

Required

string

Alibaba Cloud extension value, fixed to react

react

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to STEP

STEP

gen_ai.react.round

Alibaba Cloud

Development

Conditionally Required: the framework provides a round number

int

ReAct round, starting from 1 and incrementing

1

gen_ai.react.finish_reason

Alibaba Cloud

Development

Conditionally Required: the finish reason of this round is available

string

Finish reason of this round

tool_call; final_answer; error

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current ReAct Step is available

string

Application end-user identifier

u-lK8JddD

Important field notes

  • gen_ai.operation.name is fixed to react, and gen_ai.span.kind is fixed to STEP.

  • One ReAct Step Span represents one complete Reasoning-Acting iteration and can contain one or more LLM, Tool, or Retrieval child Spans.

  • gen_ai.react.round indicates the ReAct round, starting from 1 and incrementing. Report it only when the framework can provide a reliable round number; do not infer it from the number of Spans.

  • gen_ai.react.finish_reason indicates the reason the current round ended, for example tool_call, final_answer, or error, not the final finish reason of the entire Agent call.

4.3 Chain Span

Represents a chained execution that connects LLM, Retrieval, Embedding, Tool, or other invocation units. This type is defined by the current Alibaba Cloud ARMS documentation and is retained for compatibility with existing agents, SDKs, and existing data; it is placed after the other Span types.

Item

Convention

Span type

Alibaba Cloud compatible Chain Span

Span name

chain {chain_name}; when the name is unavailable, chain

OTel SpanKind

INTERNAL

gen_ai.operation.name

workflow or task when identifiable

gen_ai.span.kind

CHAIN

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.conversation.id

OTel

Development

Conditionally Required: the conversation ID can be obtained directly or is provided by the application context

string

Conversation identifier

conv_123

error.type

OTel

Stable

Conditionally Required: Chain execution ends with an error

string

Low-cardinality error type

timeout

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to CHAIN; Alibaba Cloud compatible enumeration value

CHAIN

gen_ai.operation.name

Alibaba Cloud

Development

Conditionally Required: the current Chain can be clearly identified as a Workflow or Task

string

Chain operation type

workflow; task

input.value

Alibaba Cloud

Development

Conditionally Required: Chain input exists

string

Chain input content; still carried as a string when the content is JSON

Who Are You!

output.value

Alibaba Cloud

Development

Conditionally Required: the Chain produces output

string

Chain output content; still carried as a string when the content is JSON

I am ChatBot

gen_ai.response.time_to_first_token

Alibaba Cloud

Development

Conditionally Required: the Chain streams output and the boundary from the start of the Chain to the first output token can be measured directly

int

First output token latency of the Chain, in nanoseconds

1000000

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current Chain is available

string

Application end-user identifier

u-lK8JddD

Important field notes

  • gen_ai.span.kind is fixed to CHAIN. This Span is used to be compatible with existing agents, SDKs, and existing data.

  • gen_ai.operation.name is reported only when the current Chain can be clearly identified as a Workflow or Task, with the corresponding value workflow or task.

  • input.value and output.value indicate the input and output of the Chain, respectively, and the type is fixed to string; even when the content itself is JSON, it is still carried as a string.

  • input.value and output.value are compatibility fields and are not equivalent to gen_ai.input.messages and gen_ai.output.messages; they must not be renamed directly when compliance with the Message Schema cannot be confirmed.

  • gen_ai.response.time_to_first_token indicates the time from the start of Chain execution to the Chain producing the first output token, in integer nanoseconds, not the latency of an internal LLM child Span.

4.4 Task Span

Represents a custom task or method call within an application. This type is defined by the current Alibaba Cloud ARMS documentation and is retained for compatibility with existing agents, SDKs, and existing data.

The current ARMS documentation uses an undefined gen_ai.task.name in the Span Name. This specification does not add that Attribute: when the task name is low-cardinality and available, use run_task {task_name}; otherwise use run_task.

Item

Convention

Span type

Alibaba Cloud compatible Task Span

Span name

run_task {task_name}; when the name is unavailable, run_task

OTel SpanKind

INTERNAL

gen_ai.operation.name

run_task

gen_ai.span.kind

TASK

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.conversation.id

OTel

Development

Conditionally Required: the Task belongs to an identifiable conversation and the conversation ID is available

string

Conversation identifier

conv_123

error.type

OTel

Stable

Conditionally Required: Task execution ends with an error

string

Low-cardinality error type

task_error

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to TASK; Alibaba Cloud compatible enumeration value

TASK

gen_ai.operation.name

Alibaba Cloud

Development

Required

string

Fixed to run_task

run_task

input.value

Alibaba Cloud

Development

Conditionally Required: Task input exists

string

Task input parameters; custom JSON is still carried as a string

input.mime_type

Alibaba Cloud

Development

Conditionally Required: input.value is collected and the input MIME Type is available

string

Input content MIME Type

application/json

output.mime_type

Alibaba Cloud

Development

Conditionally Required: the Task produces output and the output MIME Type is available

string

Output content MIME Type

application/json

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the current Task is available

string

Application end-user identifier

u-lK8JddD

Important field notes

  • gen_ai.operation.name is fixed to run_task, and gen_ai.span.kind is fixed to TASK. This Span is used to be compatible with existing agents, SDKs, and existing data.

  • Task Span does not define a gen_ai.task.name attribute. The task name is used only to construct the Span Name: when the name is available, use run_task {task_name}; otherwise use run_task.

  • input.value indicates the Task input parameters, and the type is fixed to string; custom JSON is also carried as a string.

  • input.mime_type is reported only when input.value is collected and the input MIME Type is available; it cannot be used independently of input.value.

  • output.mime_type currently defines the output MIME Type, but no corresponding output.value is defined. How to finally handle this field needs to be confirmed, and no explanation beyond the current documentation is added for now.

4.5 Entry Span

Represents an entry call to an AI application system. This type is jointly retained by the LoongSuite registry and the current Alibaba Cloud ARMS documentation. When an HTTP, RPC, or Messaging entry Span already exists at the underlying layer, the applicable GenAI Attributes should be added to that entry Span, and a parallel Span should not be created for the same entry call.

Item

Convention

Span type

Alibaba Cloud compatible Entry Span

Span name

enter_ai_application_system

OTel SpanKind

Follows the actual entry protocol, usually SERVER or CONSUMER

gen_ai.operation.name

enter

gen_ai.span.kind

ENTRY

Key

Source

Stability

Requirement level

Type

Description

Example

gen_ai.conversation.id

OTel

Development

Conditionally Required: the conversation ID can be obtained directly or is provided by the application context

string

Conversation identifier

conv_123

error.type

OTel

Stable

Conditionally Required: the entry request ends with an error

string

Low-cardinality error type

timeout

gen_ai.input.messages

OTel

Development

Conditionally Required: entry input messages exist

any

Messages received at the AI application entry

[{"role":"user","parts":[{"type":"text","content":"Weather in Paris?"}]}]

gen_ai.output.messages

OTel

Development

Conditionally Required: the entry produces output messages

any

Messages returned by the AI application entry

[{"role":"assistant","parts":[{"type":"text","content":"It is rainy in Paris."}],"finish_reason":"stop"}]

gen_ai.span.kind

Alibaba Cloud

Development

Required

string

Fixed to ENTRY

ENTRY

gen_ai.operation.name

Alibaba Cloud

Development

Recommended

string

AI application entry operation name

enter

gen_ai.response.time_to_first_token

Alibaba Cloud

Development

Conditionally Required: the entry streams a response and the boundary from receiving the request to the first output token can be measured directly

int

End-to-end first output token latency of the AI application, in nanoseconds

1000000

gen_ai.session.id

Alibaba Cloud

Development

Conditionally Required: the session, thread, or conversation context ID is available

string

Session identifier preferred by the Alibaba Cloud console

conv_123

gen_ai.user.id

Alibaba Cloud

Development

Conditionally Required: the application end-user identifier associated with the entry request is available

string

Application end-user identifier

u-lK8JddD

Important field notes

  • gen_ai.span.kind is fixed to ENTRY. The OTel SpanKind should follow the actual entry protocol, usually SERVER or CONSUMER.

  • When an HTTP, RPC, or Messaging entry Span already exists at the underlying layer, the applicable GenAI Attributes should be added to the existing entry Span, and a parallel Entry Span must not be created for the same entry call.

  • gen_ai.input.messages and gen_ai.output.messages indicate the messages received and returned at the AI application entry, respectively, and must comply with the LoongSuite Message Schema; they do not indicate an unparsed HTTP Body or arbitrary protocol payload.

  • gen_ai.response.time_to_first_token indicates the end-to-end latency from the AI application entry receiving the request to producing the first output token, in integer nanoseconds. This field has a different measurement start point from the field of the same name on LLM Spans and Agent Spans.

  • gen_ai.session.id and gen_ai.user.id indicate the business session and the application end user, respectively, and must not be replaced by a Trace ID, request ID, connection ID, or random value.