Langflow (tracing)
Langflow (tracing)
Langflow is a visual framework by DataStax for building multi-agent and RAG applications. It provides a drag-and-drop interface for composing LLM pipelines with components for models, prompts, tools, and data sources. Langflow is built on LangChain, so Respan tracing uses respan-instrumentation-langchain to capture component runs, underlying LangChain calls, tools, retrievers, and LLM generations — and gateway routing through the OpenAI-compatible Respan endpoint.
Set up Respan
Create an account at platform.respan.ai and grab an API key.
Run npx @respan/cli setup to set up with your coding agent.
Use Respan Gateway
See Langflow gateway setup to route this integration through the Respan gateway.
Example projects
Setup
Set environment variables
RESPAN_API_KEY is used to export traces to Respan. Set OPENAI_API_KEY too when your Langflow components call provider-backed models.
Initialize and run
Pass LangChainInstrumentor() to Respan(instrumentations=[...]). Langflow is built on LangChain, so in Python component runs are traced automatically. Reuse one callback handler when you want independent component runs grouped into a single trace.
There are two ways to run Langflow with tracing: run custom-component code directly (as below), or run a flow you built in the Langflow UI. A UI flow must be exported first (Share → Export) to a flow.json before run_flow_from_json can load it — this quickstart ships no standalone flow file, so the runnable example uses component code directly.
View your trace
Open the Traces page to see your Langflow workflow with component-level operations, LLM calls, retriever spans, and tool calls.
Configuration
Attributes
In Respan()
Set defaults at initialization — these apply to all spans.
With propagate_attributes
Override per-request using a context scope.
Decorators (optional)
Decorators are not required. Langflow runs are traced through LangChain callbacks. Use @workflow and @task (Python) or withWorkflow and withTask (TypeScript) when you want to group one or more flow executions inside a named application workflow.
Examples
Custom component callback grouping
Use one callback handler for the component invocation so multiple LangChain calls in the same custom component share a trace.
Exported flows
Export the flow from the Langflow UI (Share → Export) to a flow.json first. Exported flows can then be run normally after Respan telemetry is initialized. For custom components inside the flow, pass add_respan_callback(...) when invoking LangChain runnables.