Skip to main content

respan-instrumentation-langchain

Python instrumentation for LangChain-compatible callback flows. It emits Respan/Traceloop spans through respan-tracing, so LangChain chains, chat models, tools, retrievers, LangGraph runs, and Langflow components that execute LangChain/LangGraph callbacks are exported into the normal Respan trace pipeline.

Configuration

1. Install

pip install respan-instrumentation-langchain

2. Set Environment Variables

Variable Required Description
RESPAN_API_KEY Yes Your Respan API key.
RESPAN_BASE_URL No Defaults to https://api.respan.ai.

Quickstart

3. Run Script

from respan import Respan
from respan_instrumentation_langchain import LangChainInstrumentor

respan = Respan(instrumentations=[LangChainInstrumentor()])

chain.invoke({"question": "hello"})
respan.flush()

For explicit per-run callbacks:

from respan_instrumentation_langchain import add_respan_callback

chain.invoke(
    {"question": "hello"},
    config=add_respan_callback({"tags": ["demo"]}),
)

The same config helper works with LangGraph:

graph.invoke(
    {"messages": [{"role": "user", "content": "hi"}]},
    config=add_respan_callback({"configurable": {"thread_id": "thread-1"}}),
)

Langflow custom components can use get_callback_handler() or add_respan_callback() when invoking LangChain or LangGraph objects.

4. View Dashboard

After running the script, traces appear on your Respan dashboard.

Further Reading

Metadata

Release files for respan-instrumentation-langchain 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for respan-instrumentation-langchain 0.1.2
File Size Uploaded
respan_instrumentation_langchain-0.1.2.tar.gz 13.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for respan-instrumentation-langchain 0.1.2
File Interpreter ABI Platform
respan_instrumentation_langchain-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.5 kB

Release files / respan_instrumentation_langchain-0.1.2.tar.gz

Download URL respan_instrumentation_langchain-0.1.2.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0298399f13ff0cbea2dc8c6570c21d13a8ec94c795b3b0f60f9063f6631a7bcb
BLAKE2b-256 checksum
How to use checksums
7592fb511ce4f62127c2f6ef86b65e898b6e1a7224369b8dee311a268c510dd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / respan_instrumentation_langchain-0.1.2-py3-none-any.whl

Download URL respan_instrumentation_langchain-0.1.2-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2679323e50b78bc7ed0cf275c679361d23fdfb9ea201a4f1631acf21deda4aaa
BLAKE2b-256 checksum
How to use checksums
7609ad9e3545694659c1818f0204fb14fad50362a2d739ff83514a468055e1eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page