API Reference
OTel Ingestion

Insight OTel Ingestion Semantic Conventions

Insight accepts OpenTelemetry (OTLP) trace data and converts it into traces and observations. This page documents every span attribute the ingestion endpoint recognizes, how attributes are resolved across frameworks, and how observation types, usage, and costs are extracted.

How It Works

When you send OTLP spans to Insight, the ingestion processor:

  1. Extracts resource attributes (set once per exporter, e.g. service.name, deployment.environment)
  2. Extracts span attributes (set per span)
  3. Resolves each concept (input, output, model name, etc.) by checking multiple attribute keys in priority order -- the first non-empty value wins
  4. Maps the span to an observation type (GENERATION, TOOL, AGENT, etc.) using a priority-ordered mapper registry
  5. Extracts usage details (token counts) and cost details from framework-specific attributes
  6. Produces a trace event (from the root span or spans with trace-level attributes) and an observation event (from every span)

Attribute Priority

For each concept, the processor checks attribute keys in a defined order. For example, to resolve the model name it checks insight.observation.model.name first, then langfuse.observation.model.name, then gen_ai.response.model, and so on. The first non-empty value found is used.

Span attributes are checked before resource attributes. If a value is not found on the span, certain attributes (environment, session ID, run ID, tags) fall back to resource attributes.


Supported Frameworks

Insight recognizes attributes from the following SDKs and frameworks out of the box. You do not need to do any special configuration -- just send OTLP spans and the processor will detect the format automatically.

Framework / SDKAttribute NamespaceNotes
Mantis Insight SDKinsight.*Primary namespace, highest priority
Langfuse SDKlangfuse.*Compatibility with upstream Langfuse
OpenInferenceopeninference.*, input.value, output.value, llm.*Used by Arize, Agno, BeeAI, and others
OTel GenAI Semconvgen_ai.*Standard OpenTelemetry semantic conventions for generative AI
Vercel AI SDKai.*, operation.nameVercel's AI SDK telemetry
Pydantic AIgen_ai.*, tool_arguments, tool_responseVia Logfire or direct OTel export
MLFlowmlflow.spanInputs, mlflow.spanOutputsMLFlow tracing
TraceLooptraceloop.entity.*OpenLLMetry / TraceLoop SDK
Google ADKgcp.vertex.agent.*Google Agent Developer Kit
LiveKitlk.*LiveKit Agents framework
Logfireprompt, all_messages_events, logfire.msgPydantic Logfire
SmolAgentsinput.value, output.valueHuggingFace SmolAgents
Pipecatinput, outputPipecat framework
AgentOpsworkflow.*, agent.*, final_outputAgentOps SDK
CrewAIcrewai.*, task_input, task_outputCrewAI framework
Semantic Kernelgen_ai.content.prompt, gen_ai.content.completionVia span events (legacy)

Attribute Reference

The tables below list every attribute key that Insight recognizes, grouped by category. Within each group, keys are listed in priority order -- earlier entries take precedence.

Trace-Level Attributes

These attributes are extracted from the root span (or any span that sets them) and applied to the trace.

Trace Name

PriorityAttribute KeySource
1insight.trace.nameInsight SDK
2langfuse.trace.nameLangfuse SDK

Falls back to the OTel span name if neither is set.

Trace Input

PriorityAttribute KeySource
1insight.trace.inputInsight SDK
2langfuse.trace.inputLangfuse SDK

Trace Output

PriorityAttribute KeySource
1insight.trace.outputInsight SDK
2langfuse.trace.outputLangfuse SDK

Trace System Prompt

PriorityAttribute KeySource
1insight.trace.system_promptInsight SDK

Stored in trace metadata under the system_prompt key.

Trace Metadata

PriorityAttribute KeySource
1insight.trace.metadataInsight SDK
2langfuse.trace.metadataLangfuse SDK

Accepts a JSON string. Nested metadata keys are also supported via the langfuse.trace.metadata.* prefix pattern (e.g. langfuse.trace.metadata.myKey).

Trace Public

PriorityAttribute KeySource
1insight.trace.publicInsight SDK
2langfuse.trace.publicLangfuse SDK
3langfuse.publicLangfuse SDK (legacy)

Boolean. Accepts true, "true", or truthy values.

Trace Tags

PriorityAttribute KeySource
1insight.trace.tagsInsight SDK
2langfuse.trace.tagsLangfuse SDK
3langfuse.tagsLangfuse SDK (legacy)
4langfuse.observation.metadata.langfuse_tagsLangfuse SDK (metadata)
5langfuse.trace.metadata.langfuse_tagsLangfuse SDK (metadata)
6ai.telemetry.metadata.tagsVercel AI SDK
7tag.tagsGeneric

Accepts a JSON array string (e.g. '["prod", "v2"]') or an array value. Also checked on resource attributes as a fallback.


User and Session

User ID

PriorityAttribute KeySource
1insight.user.idInsight SDK
2langfuse.user.idLangfuse SDK
3user.idGeneric OTel
4langfuse.observation.metadata.langfuse_user_idLangfuse SDK (metadata)
5langfuse.trace.metadata.langfuse_user_idLangfuse SDK (metadata)
6ai.telemetry.metadata.userIdVercel AI SDK

Session ID

PriorityAttribute KeySource
1insight.session.idInsight SDK
2langfuse.session.idLangfuse SDK
3session.idGeneric OTel
4gen_ai.conversation.idOTel GenAI Semconv
5langfuse.observation.metadata.langfuse_session_idLangfuse SDK (metadata)
6langfuse.trace.metadata.langfuse_session_idLangfuse SDK (metadata)
7ai.telemetry.metadata.sessionIdVercel AI SDK

Also checked on resource attributes as a fallback.

Run ID

PriorityAttribute KeySource
1insight.run.idInsight SDK
2run.idGeneric
3mantis.run.idMantis SDK
4experiment.idGeneric

Also checked on resource attributes as a fallback. Automatically set when traces are created within a mantisdk.run context.


Environment and Version

Environment

PriorityAttribute KeySource
1insight.environmentInsight SDK
2langfuse.environmentLangfuse SDK
3deployment.environment.nameOTel Resource Semconv
4deployment.environmentOTel Resource Semconv (legacy)

Checked on both span and resource attributes. Defaults to "default" if not set.

Version

PriorityAttribute KeySource
1insight.versionInsight SDK
2langfuse.versionLangfuse SDK
3service.versionOTel Resource Semconv

Release

PriorityAttribute KeySource
1insight.releaseInsight SDK
2langfuse.releaseLangfuse SDK

Observation-Level Attributes

These attributes are extracted from every span and applied to the observation.

Observation Type

PriorityAttribute KeySource
1insight.observation.typeInsight SDK
2langfuse.observation.typeLangfuse SDK
3openinference.span.kindOpenInference
4gen_ai.operation.nameOTel GenAI Semconv

See Observation Type Mapping below for the full mapping rules.

Observation Input

PriorityAttribute KeySource
1insight.observation.inputInsight SDK
2langfuse.observation.inputLangfuse SDK
3input.valueOpenInference / SmolAgents
4inputPydantic AI / Pipecat
5traceloop.entity.inputTraceLoop
6mlflow.spanInputsMLFlow
7gen_ai.input.messagesOTel GenAI Semconv
8gen_ai.tool.call.argumentsOTel GenAI (tools)
9ai.prompt.messagesVercel AI SDK
10ai.promptVercel AI SDK
11ai.toolCall.argsVercel AI SDK
12gcp.vertex.agent.llm_requestGoogle ADK
13gcp.vertex.agent.tool_call_argsGoogle ADK (tools)
14lk.input_textLiveKit
15promptLogfire
16tool_argumentsPydantic AI (tools)
17workflow.inputAgentOps
18agent.inputAgentOps
19crewai.task.inputCrewAI
20crewai.agent.inputCrewAI
21task_inputCrewAI (alt)

Additional input sources via span events and prefix-based patterns are documented in Span Events and Prefix-Based Input/Output.

Observation Output

PriorityAttribute KeySource
1insight.observation.outputInsight SDK
2langfuse.observation.outputLangfuse SDK
3output.valueOpenInference / SmolAgents
4outputPydantic AI / Pipecat
5traceloop.entity.outputTraceLoop
6mlflow.spanOutputsMLFlow
7gen_ai.output.messagesOTel GenAI Semconv
8gen_ai.tool.call.resultOTel GenAI (tools)
9ai.response.textVercel AI SDK
10ai.result.textVercel AI SDK (legacy, < 4.0)
11ai.toolCall.resultVercel AI SDK
12ai.response.objectVercel AI SDK
13ai.result.objectVercel AI SDK (legacy, < 4.0)
14ai.response.toolCallsVercel AI SDK
15ai.result.toolCallsVercel AI SDK (legacy, < 4.0)
16gcp.vertex.agent.llm_responseGoogle ADK
17gcp.vertex.agent.tool_responseGoogle ADK (tools)
18lk.function_tool.outputLiveKit
19lk.response.textLiveKit
20all_messages_eventsLogfire
21tool_responsePydantic AI (tools)
22workflow.outputAgentOps
23final_outputAgentOps
24agent.outputAgentOps
25crewai.task.outputCrewAI
26crewai.agent.outputCrewAI
27task_outputCrewAI (alt)
28resultGeneric fallback

Vercel AI SDK special case: When both ai.response.text and ai.response.toolCalls are present, the output is combined into a structured object with role, content, and tool_calls fields.

Observation Metadata

PriorityAttribute KeySource
1insight.observation.metadataInsight SDK
2langfuse.observation.metadataLangfuse SDK
3langfuse.metadataLangfuse SDK (shorthand)
4ai.telemetry.metadataVercel AI SDK

Accepts a JSON string. Nested keys via the langfuse.observation.metadata.* prefix are also supported.

Observation Level

PriorityAttribute KeySource
1insight.observation.levelInsight SDK
2langfuse.observation.levelLangfuse SDK

Valid values: DEBUG, DEFAULT, WARNING, ERROR.

If not set, defaults to ERROR when the OTel span status code is 2 (ERROR), otherwise DEFAULT.

Observation Status Message

PriorityAttribute KeySource
1insight.observation.status_messageInsight SDK
2langfuse.observation.status_messageLangfuse SDK

Falls back to the OTel span status.message field.


Model and Generation

Model Name

PriorityAttribute KeySource
1insight.observation.model.nameInsight SDK
2langfuse.observation.model.nameLangfuse SDK
3gen_ai.response.modelOTel GenAI Semconv
4ai.model.idVercel AI SDK
5gen_ai.request.modelOTel GenAI Semconv
6llm.response.modelOpenInference
7llm.model_nameOpenInference (legacy)
8modelGeneric

Model Parameters

PriorityAttribute KeySource
1insight.observation.model.parametersInsight SDK (JSON string)
2langfuse.observation.model.parametersLangfuse SDK (JSON string)
3llm.invocation_parametersOpenInference (JSON string)
4model_configGeneric (JSON string)

Additionally, any attributes matching the gen_ai.request.* prefix (excluding gen_ai.request.model) are collected as model parameters.

Vercel AI SDK special case: When the instrumentation scope is ai, the following attributes are extracted into model parameters:

AttributeParameter Key
ai.settings.maxStepsmaxSteps
ai.prompt.toolChoicetoolChoice
gen_ai.request.max_tokensmaxTokens
gen_ai.response.finish_reasons or gen_ai.finishReasonfinishReason
gen_ai.system or ai.model.providersystem
ai.settings.maxRetriesmaxRetries
ai.settings.modemode
gen_ai.request.temperaturetemperature

Completion Start Time

PriorityAttribute KeySource
1langfuse.observation.completion_start_timeLangfuse SDK

For Vercel AI SDK, computed from ai.response.msToFirstChunk or ai.stream.msToFirstChunk added to the span start time.


Prompt Management

Prompt Name

PriorityAttribute KeySource
1langfuse.observation.prompt.nameLangfuse SDK
2langfuse.prompt.nameLangfuse SDK (shorthand)

Also extracted from Vercel AI SDK's ai.telemetry.metadata.langfusePrompt JSON field.

Prompt Version

PriorityAttribute KeySource
1langfuse.observation.prompt.versionLangfuse SDK
2langfuse.prompt.versionLangfuse SDK (shorthand)

Also extracted from Vercel AI SDK's ai.telemetry.metadata.langfusePrompt JSON field.


Observation Type Mapping

Every span is mapped to an observation type using a priority-ordered registry. Mappers are evaluated from lowest priority number (highest precedence) to highest. The first mapper that both matches and returns a type wins.

Valid Observation Types

SPAN, GENERATION, EVENT, EMBEDDING, AGENT, TOOL, CHAIN, RETRIEVER, GUARDRAIL, EVALUATOR

If no mapper matches, the span defaults to type SPAN.

Mapper Priority Order

Priority 0 -- Python SDK v3.3.0 and Earlier Override

Handles a known bug in older Langfuse Python SDK versions where generation-like spans were incorrectly labeled as span. If the scope name is langfuse-sdk, the SDK language is python, and version is 3.3.0 or earlier, the presence of generation attributes (model, usage, cost, etc.) overrides the type to GENERATION.

Priority 1 -- Direct Type Attribute

Reads langfuse.observation.type or insight.observation.type and maps directly:

Attribute ValueObservation Type
spanSPAN
generationGENERATION
eventEVENT
embeddingEMBEDDING
agentAGENT
toolTOOL
chainCHAIN
retrieverRETRIEVER
guardrailGUARDRAIL
evaluatorEVALUATOR

Priority 2 -- OpenInference

Reads openinference.span.kind:

Attribute ValueObservation Type
CHAINCHAIN
RETRIEVERRETRIEVER
LLMGENERATION
EMBEDDINGEMBEDDING
AGENTAGENT
TOOLTOOL
GUARDRAILGUARDRAIL
EVALUATOREVALUATOR

Priority 3 -- OTel GenAI Operation

Reads gen_ai.operation.name:

Attribute ValueObservation Type
chatGENERATION
completionGENERATION
text_completionGENERATION
generate_contentGENERATION
generateGENERATION
embeddingsEMBEDDING
invoke_agentAGENT
create_agentAGENT
execute_toolTOOL

Priority 4 -- Vercel AI SDK (Generation / Embedding)

Matches when model information is present (ai.model.id, gen_ai.request.model, etc.) and the operation name matches one of:

Operation Name PrefixObservation Type
ai.generateText.doGenerateGENERATION
ai.streamText.doStreamGENERATION
ai.generateObject.doGenerateGENERATION
ai.streamObject.doStreamGENERATION
ai.embedMany.doEmbedEMBEDDING
ai.embed.doEmbedEMBEDDING

Checked via both operation.name (prefix match) and ai.operationId (exact match).

Priority 5 -- Vercel AI SDK (Tool Calls)

Matches any ai.* operation that is not a generation or embedding:

Operation Name PrefixObservation Type
ai.toolCallTOOL

Priority 6 -- GenAI Tool Call Detection

Matches when gen_ai.tool.name or gen_ai.tool.call.id is present. Used by Pydantic AI and other frameworks that set GenAI tool attributes without setting gen_ai.operation.name.

Result: TOOL

Priority 7 -- Model-Based Fallback

If any model-related attribute is present (langfuse.observation.model.name, gen_ai.request.model, gen_ai.response.model, llm.model_name, or model), the span is classified as a GENERATION.


Usage and Cost Extraction

Token Usage

Token usage is extracted differently depending on the instrumentation source. The processor normalizes all formats into a standard usageDetails object with keys like input, output, total, input_cached_tokens, output_reasoning_tokens, etc.

Langfuse / Insight SDK

AttributeDescription
langfuse.observation.usage_detailsJSON string with full usage details

Vercel AI SDK (scope name: ai)

AttributeMaps To
gen_ai.usage.prompt_tokens or gen_ai.usage.input_tokensinput
gen_ai.usage.completion_tokens or gen_ai.usage.output_tokensoutput
ai.usage.tokenstotal
ai.usage.cachedInputTokensinput_cached_tokens
ai.usage.reasoningTokensoutput_reasoning_tokens

Provider metadata fallback: If the extended usage attributes are not present, the processor reads ai.response.providerMetadata (a JSON string) and extracts provider-specific details:

  • OpenAI: cachedPromptTokens, acceptedPredictionTokens, rejectedPredictionTokens, reasoningTokens
  • Anthropic: cacheCreationInputTokens, cacheReadInputTokens
  • Bedrock: usage.cacheReadInputTokens, usage.cacheWriteInputTokens, usage.cacheCreationInputTokens

Cached token counts are subtracted from the total input count to avoid double-counting.

Pydantic AI (scope name: pydantic-ai)

AttributeMaps To
gen_ai.usage.input_tokensinput
gen_ai.usage.output_tokensoutput
gen_ai.usage.cache_read_tokens or gen_ai.usage.details.cache_read_input_tokensinput_cache_read
gen_ai.usage.cache_write_tokens or gen_ai.usage.details.cache_creation_input_tokensinput_cache_creation

Generic (all other frameworks)

Any attributes matching gen_ai.usage.* or llm.token_count.* are collected. Standard key mappings:

Raw Key SuffixNormalized Key
prompt_tokensinput
completion_tokensoutput
total_tokenstotal
input_tokensinput
output_tokensoutput
promptinput
completionoutput

All other suffixes are kept as-is (e.g. gen_ai.usage.reasoning_tokens becomes reasoning_tokens).

Cost

AttributeDescription
langfuse.observation.cost_detailsJSON string with cost breakdown (Langfuse SDK only)
gen_ai.usage.costTotal cost as a number, stored as { total: value }

Span Events

In addition to span attributes, the processor extracts input and output from OTel span events (the events array on a span). This is used by frameworks that follow the OTel GenAI event-based conventions.

GenAI Message Events

These events are collected as the input to the observation:

Event NameRole
gen_ai.system.messagesystem
gen_ai.user.messageuser
gen_ai.assistant.messageassistant
gen_ai.tool.messagetool

Each event's attributes are included in the message object.

GenAI Choice Events

Event NameUsage
gen_ai.choiceExtracted as the output

If a single choice event exists, it is returned as the output directly. Multiple choice events are returned as an array.

Legacy Semantic Kernel Events

Event NameUsage
gen_ai.content.promptInput
gen_ai.content.completionOutput

Logfire Events Array

Logfire sends a stringified events attribute containing GenAI events. The processor parses this and extracts gen_ai.choice events as output and all other events as input.


Prefix-Based Input/Output

Some frameworks use flattened attribute keys with numeric indices to represent structured messages. The processor reassembles these into nested objects:

GenAI Prompt/Completion Prefix

Attributes starting with gen_ai.prompt.* are reassembled into an input object. Attributes starting with gen_ai.completion.* are reassembled into an output object. Used by TraceLoop and similar frameworks.

Example: gen_ai.prompt.0.content + gen_ai.prompt.0.role becomes [{ content: "...", role: "..." }]

OpenInference LLM Messages Prefix

Attributes starting with llm.input_messages.* are reassembled into input. Attributes starting with llm.output_messages.* are reassembled into output. Used by Agno, BeeAI, and OpenInference instrumentors.


Observation Name Extraction

The observation name is determined by this priority:

  1. gen_ai.tool.name -- for tool-type observations
  2. logfire.msg -- for Pydantic AI / Logfire spans
  3. ai.toolCall.name -- for Vercel AI SDK tool calls
  4. ai.telemetry.functionId + ai.operationId -- for Vercel AI SDK operations (formatted as functionId:operationId)
  5. The OTel span name -- default fallback

Resource Attributes

Resource attributes are set once per exporter instance and apply to all spans in the batch. The following attributes are checked on resource attributes as a fallback when not found on span attributes:

  • environment (deployment.environment.name, deployment.environment)
  • session.id
  • run.id
  • tags
  • version (service.version)
  • release

Resource attributes are also stored in the observation and trace metadata under the resourceAttributes key for debugging purposes.


Quick Reference

Insight SDK Attributes (Primary Namespace)

These are the recommended attributes when instrumenting with the Mantis Insight SDK:

insight.trace.name
insight.trace.input
insight.trace.output
insight.trace.system_prompt
insight.trace.metadata
insight.trace.tags
insight.trace.public
insight.user.id
insight.session.id
insight.run.id
insight.environment
insight.release
insight.version
insight.observation.type
insight.observation.input
insight.observation.output
insight.observation.metadata
insight.observation.level
insight.observation.status_message
insight.observation.model.name
insight.observation.model.parameters

Using with MantisDK

If you are using the MantisDK Python SDK, these attributes are available as constants:

import mantisdk.tracing as tracing
 
with tracing.trace("my-workflow", input=query) as span:
    span.set_attribute(tracing.semconv.USER_ID, "user-123")
    span.set_attribute(tracing.semconv.SESSION_ID, "session-456")
    span.set_attribute(tracing.semconv.TRACE_OUTPUT, result)

See the MantisDK Semantic Conventions page for the full SDK constant reference.