Semantic Conventions¶
agentlightning.semconv
¶
Semantic conventions for Agent-lightning spans.
Conventions in this file are added on demand. We generally DO NOT add new semantic conventions unless it's absolutely needed for certain algorithms or scenarios.
AGL_ANNOTATION = 'agentlightning.annotation'
module-attribute
¶
Agent-lightning's standard span name for annotations.
Annotations are minimal span units for rewards, tags, and metadatas. They are used to "annotate" a specific event or a part of rollout.
AGL_EXCEPTION = 'agentlightning.exception'
module-attribute
¶
Agent-lightning's standard span name for exceptions.
Used by the exception emitter to record exception details.
AGL_MESSAGE = 'agentlightning.message'
module-attribute
¶
Agent-lightning's standard span name for messages and logs.
AGL_OBJECT = 'agentlightning.object'
module-attribute
¶
Agent-lightning's standard span name for customized objects.
AGL_OPERATION = 'agentlightning.operation'
module-attribute
¶
Agent-lightning's standard span name for functions. Wrap function or code-blocks as operations.
AGL_REWARD = 'agentlightning.reward'
module-attribute
¶
Agent-lightning's standard span name for reward operations.
AGL_VIRTUAL = 'agentlightning.virtual'
module-attribute
¶
Agent-lightning's standard span name for virtual operations.
Mostly used in adapter when needing to represent the root or intermediate operations.
LightningResourceAttributes
¶
Bases: Enum
Resource attribute names used in Agent-lightning spans.
ATTEMPT_ID = 'agentlightning.attempt_id'
class-attribute
instance-attribute
¶
Resource name for attempt ID in Agent-lightning spans.
ROLLOUT_ID = 'agentlightning.rollout_id'
class-attribute
instance-attribute
¶
Resource name for rollout ID in Agent-lightning spans.
SPAN_SEQUENCE_ID = 'agentlightning.span_sequence_id'
class-attribute
instance-attribute
¶
Resource name for span sequence ID in Agent-lightning spans.
TRACER_NAME = 'agentlightning.tracer.name'
class-attribute
instance-attribute
¶
Which tracer is used to create this span.
LightningSpanAttributes
¶
Bases: Enum
Attribute names that commonly appear in Agent-lightning spans.
Exception types can't be found here because they are defined in OpenTelemetry's official semantic conventions.
LINK = 'agentlightning.link'
class-attribute
instance-attribute
¶
Attribute name for linking the current span to another span or other objects like requests/responses.
MESSAGE_BODY = 'agentlightning.message.body'
class-attribute
instance-attribute
¶
Attribute name for message text in message spans.
OBJECT_JSON = 'agentlightning.object.json'
class-attribute
instance-attribute
¶
Attribute name for object serialized value (JSON) in object spans.
OBJECT_LITERAL = 'agentlightning.object.literal'
class-attribute
instance-attribute
¶
Attribute name for object literal value in object spans (for str, int, bool, ...).
OBJECT_TYPE = 'agentlightning.object.type'
class-attribute
instance-attribute
¶
Attribute name for object type (full qualified name) in object spans.
I think builtin types like str, int, bool, list, dict are self-explanatory and should also be qualified to use here.
OPERATION_INPUT = 'agentlightning.operation.input'
class-attribute
instance-attribute
¶
Attribute name for operation input in operation spans.
OPERATION_NAME = 'agentlightning.operation.name'
class-attribute
instance-attribute
¶
Attribute name for operation name in operation spans, normally the function name.
OPERATION_OUTPUT = 'agentlightning.operation.output'
class-attribute
instance-attribute
¶
Attribute name for operation output in operation spans.
REWARD = 'agentlightning.reward'
class-attribute
instance-attribute
¶
Attribute prefix for rewards-related data in reward spans.
It should be used as a prefix. For example, "agentlightning.reward.0.value" can be used to track a specific metric. See RewardAttributes.
TAG = 'agentlightning.tag'
class-attribute
instance-attribute
¶
Attribute name for tagging spans with customized strings.
LinkAttributes
¶
Bases: Enum
Standard link types used in Agent-lightning spans.
The link is more powerful than OpenTelemetry link in that it supports linking to a queryset of spans. It can even link to span object that hasn't been emitted yet.
KEY_MATCH = 'key_match'
class-attribute
instance-attribute
¶
Linking to spans with matching attribute keys.
trace_id and span_id are reserved and will be used to link to specific spans directly.
For example, it can be gen_ai.response.id if intended to be link to a chat completion response span.
Or it can be span_id to link to a specific span by its ID.
VALUE_MATCH = 'value_match'
class-attribute
instance-attribute
¶
Linking to spans with corresponding attribute values on those keys.
LinkPydanticModel
¶
RewardAttributes
¶
Bases: Enum
Multi-dimensional reward attributes will look like:
The first reward in the reward list will automatically be the primary reward. If the reward list has greater than 1, it shall be a multi-dimensional case.