Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.inference.net/llms.txt

Use this file to discover all available pages before exploring further.

Both Catalyst tracing SDKs export the OpenInference attribute keys and span kinds they emit. Use them when you author manual spans, when you need to filter on a specific attribute from the CLI, or when you want to understand what each span in the trace tree should carry. The wire-format values are byte-identical to the upstream OpenInference semantic conventions, so OpenInference-aware viewers render Catalyst spans without configuration.
import { Attr, SpanKindValues } from "@inference/tracing";

Span Kinds

SpanKindValues is the canonical set of values for the openinference.span.kind attribute. Pick the kind that best describes the work the span wraps.
KindConstantUse ForRequired AttributesCommon Optional Attributes
AGENTSpanKindValues.AGENTThe outer span around an agent runSPAN_KIND, AGENT_IDAGENT_NAME, AGENT_ROLE, SESSION_ID, SYSTEM, INPUT_VALUE, OUTPUT_VALUE, MODEL_NAME, token counts
LLMSpanKindValues.LLMOne LLM call (chat, completion, embedding-as-LLM)SPAN_KIND, MODEL_NAMESYSTEM, LLM_SYSTEM, LLM_PROVIDER, INVOCATION_PARAMETERS, STREAMING, FINISH_REASON, message attributes, token counts
TOOLSpanKindValues.TOOLA tool invocation by an agentSPAN_KIND, TOOL_NAMETOOL_CALL_ID, INPUT_VALUE, OUTPUT_VALUE, INPUT_MIME_TYPE, OUTPUT_MIME_TYPE
CHAINSpanKindValues.CHAINA chain step that is not itself an LLM call (router, postprocessor, planner)SPAN_KINDINPUT_VALUE, OUTPUT_VALUE, free-form attributes
RETRIEVERSpanKindValues.RETRIEVERA vector-search or document-lookup callSPAN_KINDINPUT_VALUE (the query), OUTPUT_VALUE (the results)
EMBEDDINGSpanKindValues.EMBEDDINGAn embedding-model call your code makes directlySPAN_KIND, MODEL_NAMEINPUT_VALUE, token counts
The patched provider SDKs emit LLM-kind spans automatically with all required and most optional attributes filled in. You only need to author LLM spans manually if you are wrapping an SDK Catalyst does not patch.

Attribute Constants

All attributes are exported on the Attr object. The constant name is the left-hand column; the wire-format key in the right-hand column is what actually goes on the span.

Span Identity

ConstantWire keyOn
Attr.SPAN_KINDopeninference.span.kindEvery span
Attr.SESSION_IDsession.idAny span — used for conversation grouping

Agent Identity

Set on AGENT spans, copied onto child LLM/TOOL spans by the per-SDK patchers and by agentSpan() / agent_span() when the child is created in the active context.
ConstantWire keyPurpose
Attr.AGENT_IDagent.idStable identifier for grouping in the Agents dashboard
Attr.AGENT_NAMEagent.nameHuman-readable label
Attr.AGENT_ROLEagent.roleRole in a multi-agent workflow (e.g. triage, refunds)

Inputs And Outputs

ConstantWire keyNotes
Attr.INPUT_VALUEinput.valueStringified input. JSON-encode structured values.
Attr.OUTPUT_VALUEoutput.valueStringified output.
Attr.INPUT_MIME_TYPEinput.mime_typeTypically "application/json" or "text/plain".
Attr.OUTPUT_MIME_TYPEoutput.mime_typeSame.

Model And Provider

Set on LLM and EMBEDDING spans. Also useful on AGENT spans to declare the provider the agent runs on.
ConstantWire keyNotes
Attr.MODEL_NAMEllm.model_namePrefer the model the API echoed back.
Attr.SYSTEMgen_ai.systemProvider identifier on AGENT spans ("openai", "anthropic").
Attr.LLM_SYSTEMllm.systemProvider identifier on LLM spans.
Attr.LLM_PROVIDERllm.providerAlternate provider identifier on LLM spans.
Attr.INVOCATION_PARAMETERSllm.invocation_parametersJSON of the request parameters (temperature, max_tokens, etc.).
Attr.STREAMINGllm.streamingBoolean — did the call stream.
Attr.FINISH_REASONllm.finish_reasonProvider finish reason.

Token Usage

ConstantWire key
Attr.TOKEN_COUNT_PROMPTllm.token_count.prompt
Attr.TOKEN_COUNT_COMPLETIONllm.token_count.completion
Attr.TOKEN_COUNT_TOTALllm.token_count.total
Attr.TOKEN_COUNT_PROMPT_CACHE_WRITEllm.token_count.prompt_details.cache_write
Attr.TOKEN_COUNT_PROMPT_CACHE_READllm.token_count.prompt_details.cache_read
Attr.TOKEN_COUNT_COMPLETION_REASONINGllm.token_count.completion_details.reasoning
The per-SDK patchers fill these in automatically when the provider returns usage. For manual spans, use the helpers on the span handle:
  • TypeScript: span.recordTokens({ prompt, completion, total }) — pass the counts directly.
  • Python: span.record_tokens(prompt=..., completion=..., total=...) for manual counts, or span.record_usage(response.usage) to let the SDK normalize an OpenAI- or Anthropic-shaped usage object (including cache fields).

Tools

Set on TOOL spans. Also set on LLM spans by the provider patchers when the LLM emits a tool_use block, so the dashboard can show the tool the model asked for.
ConstantWire key
Attr.TOOL_NAMEtool.name
Attr.TOOL_CALL_IDtool_call.id
Attr.AGENT_TOOL_CALL_COUNTagent.tool_call_count
Attr.AGENT_LLM_CALL_COUNTagent.llm_call_count

Messages

LLM spans emit per-message attributes for each input and output message. The keys are indexed and machine-generated. Use the OpenInferenceAttribute helper to compose them rather than hand-rolling the strings.
TypeScript
import { OpenInferenceAttribute } from "@inference/tracing";

const prefix = OpenInferenceAttribute.inputMessagePrefix(0);
span.setAttribute(OpenInferenceAttribute.role(prefix), "user");
span.setAttribute(OpenInferenceAttribute.content(prefix), "Hello");
The wire keys take the form llm.input_messages.0.message.role, llm.input_messages.0.message.content, llm.output_messages.0.message.role, and so on. For tool-call messages, the helper also generates ...tool_calls.0.tool_call.function.name, ...tool_calls.0.tool_call.function.arguments, and ...tool_calls.0.tool_call.id. You rarely need to author these by hand — the per-SDK patchers emit them. This block is here so the keys are searchable when you are debugging captured output.

Using Attributes From The CLI

The same attribute keys are filterable from inf trace and inf span:
# Find all TOOL spans for one tool name
inf span list --kind TOOL --metadata "tool.name=lookup_order"

# Find traces from one conversation
inf trace list --metadata "session.id=conversation-ticket-123"

# Find expensive LLM spans, sorted by cost
inf span list --kind LLM --filter "cost_total>0.05" --sort cost_total --order desc
See inf span and inf trace for the full filter syntax.

Next Steps

Handle API reference

The typed methods on agentSpan / manual_span handles that write these attributes for you.

Manual spans

Author TOOL, CHAIN, and RETRIEVER spans inside your agent loop.

Agent identity

Pick stable agent.id and session.id values for the Agents dashboard.

CLI span reference

Filter, search, and inspect spans by attribute from the terminal.