Extends
SpanBase
Accessors
agentName
Get Signature
get agentName(): string
Defined in: src/genai/turn.ts:103
Returns
string
model
Get Signature
get model(): string
Defined in: src/genai/turn.ts:107
Returns
string
Methods
addEvent()
addEvent(Defined in: src/genai/spanBase.ts:82 Add a named event to the span. Useful for marking non-span moments such as context compaction, tool-loop detection, or guardrail trips. Warns and no-ops aftername,attributes?,startTime?):this
end(). Mirrors OTel Span.addEvent.
Parameters
name
string
attributes?
Attributes
startTime?
TimeInput
Returns
this
Example
Inherited from
SpanBase.addEvent
end()
end(Defined in: src/genai/turn.ts:241 Read current field values (to reflect mutations made viaopts?):void
record()
since start) and close the span. Idempotent. Pass error to mark
it as failed; pass endTime to backdate the close.
Parameters
opts?
SpanEndOptions
Returns
void
record()
record(Defined in: src/genai/turn.ts:201 Bulk-set any subset of the mutable fields. Replaces (does not merge). Useful for assigning everything at once after a provider call returns.opts):this
Parameters
opts
agentDescription?
string
agentId?
string
agentName?
string
agentVersion?
string
messages?
Message[]
model?
string
systemInstructions?
string[]
Returns
this
setAttribute()
setAttribute(Defined in: src/genai/turn.ts:193key,value):this
Parameters
key
string
value
AttributeValue
Returns
this
setAttributes()
setAttributes(Defined in: src/genai/spanBase.ts:63 Set multiple attributes on the span at once. Warns and no-ops afterattributes):this
end(). Mirrors OTel Span.setAttributes (and the Python SDK’s
set_attributes).
Parameters
attributes
Attributes
Returns
this
Example
Inherited from
SpanBase.setAttributes
startLLM()
startLLM(Defined in: src/genai/turn.ts:161 Start a child LLM span under this Turn.opts):LLM
Parameters
opts
LLMInit
Returns
LLM
startSubagent()
startSubagent(Defined in: src/genai/turn.ts:179 Start a child SubAgent span under this Turn.opts):SubAgent
Parameters
opts
SubAgentInit
Returns
SubAgent
startTool()
startTool(Defined in: src/genai/turn.ts:170 Start a child Tool span under this Turn.opts):Tool
Parameters
opts
ToolInit
Returns
Tool