# Introduction

[![PyPI](https://img.shields.io/pypi/v/fiddler-langchain)](https://pypi.org/project/fiddler-langchain/)

## Overview

Complete API reference documentation for the `fiddler-langchain` package, which instruments [LangChain V1](https://docs.langchain.com/oss/python/langchain/overview) agents (the `langchain.agents.create_agent` API and middleware pattern) and exports OpenTelemetry traces to Fiddler.

```bash
pip install fiddler-langchain
```

```python
from fiddler_langchain import FiddlerLangChainInstrumentor
```

## Components

### Attributes

Span and session attribute helpers. `add_span_attributes` attaches component-scoped attributes to a specific model, retriever, or tool. `add_session_attributes` and `set_conversation_id` are re-exported from `fiddler-otel` and propagate through every span in the current trace context.

* [add\_session\_attributes](/api/fiddler-langchain-sdk/attributes/add-session-attributes.md)
* [add\_span\_attributes](/api/fiddler-langchain-sdk/attributes/add-span-attributes.md)
* [set\_conversation\_id](/api/fiddler-langchain-sdk/attributes/set-conversation-id.md)

### Tracing

Instrumentation entry points and LLM context helpers. `FiddlerLangChainInstrumentor` is the one-time setup that wires the Fiddler exporter into LangChain; `FiddlerAgentMiddleware` is a drop-in agent middleware that emits spans for LLM, tool, and chain steps; `set_llm_context` and `clear_llm_context` attach and remove retrieval context (e.g. retrieved documents) on the active model so it appears on its LLM spans.

* [clear\_llm\_context](/api/fiddler-langchain-sdk/tracing/clear-llm-context.md)
* [FiddlerAgentMiddleware](/api/fiddler-langchain-sdk/tracing/fiddler-agent-middleware.md)
* [FiddlerLangChainInstrumentor](/api/fiddler-langchain-sdk/tracing/fiddler-lang-chain-instrumentor.md)
* [set\_llm\_context](/api/fiddler-langchain-sdk/tracing/set-llm-context.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fiddler.ai/api/fiddler-langchain-sdk/langchain.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
