> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fiddler.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# add_span_attributes

> Add custom span-level attributes to a specific LangChain component's metadata.

Add custom span-level attributes to a specific LangChain component's metadata.

Attributes are stored under the Fiddler metadata key on the component and
read by [`FiddlerAgentMiddleware`](/sdk-api/langchain/fiddler-agent-middleware)
when creating spans. Unlike `add_session_attributes()`, these are
scoped to individual components and only applied to spans created for
that component (e.g. a particular model, retriever, or tool).

## Parameters

<ParamField path="node" type="BaseLanguageModel | BaseRetriever | BaseTool" required={true}>
  The LangChain component to annotate (modified in place).
  Accepts `BaseLanguageModel`,
  `BaseRetriever`, or
  `BaseTool` instances.
</ParamField>

<ParamField path="**kwargs" type="Any" required={false}>
  Arbitrary key-value attributes. Keys matching known
  `FiddlerSpanAttributes` values are set
  directly; all others are prefixed with `fiddler.span.user.`.
</ParamField>

## Returns

<ResponseField>
  None Example: default from langchain\_openai import ChatOpenAI from fiddler\_langchain import add\_span\_attributes llm = ChatOpenAI(model="gpt-4o") add\_span\_attributes(llm, model\_tier="premium", use\_case="summarization")
</ResponseField>
