apps/opik-documentation/documentation/fern/docs-v2/integrations/langflow.mdx
Langflow is an open-source, low-code platform for building AI applications using a visual flow-based interface. It enables developers and non-developers alike to create complex LLM applications through drag-and-drop components, making it easier to prototype, test, and deploy AI workflows.
Opik integrates seamlessly with Langflow to provide comprehensive tracing and monitoring of your flow executions. The integration automatically captures all LLM calls, component interactions, and data flows within your Langflow applications.
Once you've configured the integration, you can view your Langflow traces in the Opik dashboard. Each flow execution creates a detailed trace showing the complete execution path through your flow components.
Before integrating Opik with Langflow, ensure you have:
Install both Langflow and Opik in the same environment:
pip install langflow opik
For more Langflow installation options and details, see the Langflow documentation.
Configure Opik to connect to your Opik instance. Run the following command in the same terminal/environment where you'll run Langflow:
<Tabs> <Tab value="Opik Cloud" title="Opik Cloud"> ```bash opik configure ``` You'll be prompted to enter your Opik API key. You can create an API key in your [Opik account settings](https://www.comet.com/settings/api-keys?utm_source=opik&utm_medium=docs&utm_campaign=opik_integration).
</Tab>
<Tab value="Enterprise deployment" title="Enterprise deployment">
Set the following environment variables before running `opik configure`:
```bash
export OPIK_URL_OVERRIDE="https://<comet-deployment-url>/opik/api"
opik configure
```
You'll be prompted to enter your Opik API key. Replace `<comet-deployment-url>` with your enterprise deployment URL.
</Tab>
<Tab value="Self-hosted instance" title="Self-hosted instance">
```bash
opik configure --use_local
```
This will configure Opik to use your local instance at `http://localhost:5173`.
</Tab>
The configuration will be saved to ~/.opik.config and used automatically by Langflow's Opik integration.
Once Opik is configured, start Langflow in the same terminal or environment:
langflow run
Langflow will automatically detect the Opik configuration and start sending traces to your Opik instance.
http://localhost:7860)When you run a flow in Langflow, Opik automatically captures:
Each trace includes:
By default, Langflow traces are logged to the "Default Project" in Opik. You can specify a custom project name by setting the OPIK_PROJECT_NAME environment variable before starting Langflow:
export OPIK_PROJECT_NAME="my-langflow-project"
langflow run
Langflow automatically tracks sessions using thread IDs. Each conversation or flow execution thread is tracked as a separate session in Opik, making it easy to analyze multi-turn conversations and related executions.
To disable the Opik integration, you can:
~/.opik.config fileunset OPIK_API_KEY
unset OPIK_URL_OVERRIDE
unset OPIK_WORKSPACE
Then restart Langflow.
If your traces aren't appearing in Opik:
Verify Opik configuration:
cat ~/.opik.config
Ensure the API key and URL are correct.
Check Langflow logs: Look for any Opik-related errors in the Langflow console output.
Test Opik connection: Run a simple Python script to verify your Opik configuration:
import opik
client = opik.Opik()
client.auth_check()
print("Opik connection successful!")
Verify Opik SDK installation: Ensure the Opik SDK is installed in the same environment as Langflow:
pip list | grep opik
If Langflow isn't detecting your Opik configuration:
opik configure in the same terminal/environment where you start Langflow~/.opik.config file exists and contains valid configurationexport OPIK_API_KEY="your-api-key"
export OPIK_WORKSPACE="default"
langflow run
If you're seeing authentication errors:
If you encounter any issues or have suggestions for improving the Langflow integration, please let us know by creating an issue in the Opik GitHub repository.