Observing agents built with Langflow

Langflow is an open-source visual framework for building, experimenting, and deploying applications powered by large language models (LLMs). It provides a drag-and-drop interface to design complex workflows, integrate external tools and APIs, and run experiments without heavy coding overhead.

Instana provides observability for Langflow applications, enabling real-time monitoring of workflow execution, LLM interactions, and performance metrics.

Prerequisites

Before you begin, ensure you have:

  • Python 3.10 or later installed

  • Langflow installed, see Langflow installation guide.

  • An LLM API key (Anthropic, OpenAI, or any LLM provider supported by Langflow)

  • Instana configured for your application, see Getting started.

Instrumenting Langflow applications

Langflow applications are instrumented through environment variables. Follow these steps to enable Instana observability:

1. Configure environment variables

In the root folder of your Langflow application, create or edit the .env file with the appropriate configuration for your deployment mode.

For agent mode (sending data through Instana agent):

TRACELOOP_API_KEY=tl_dummy_1234567890abcdef1234567890abcdef
OTEL_RESOURCE_ATTRIBUTES="INSTANA_PLUGIN=genai"
TRACELOOP_BASE_URL=<instana-agent-host>:4317
TRACELOOP_HEADERS="x-instana-key= "
OTEL_EXPORTER_OTLP_INSECURE=true

Replace <instana-agent-host> with the hostname or IP address of your Instana agent. If Langflow is running inside a container, use host.docker.internal.

Note:

The TRACELOOP_API_KEY is required by the Traceloop SDK but not used when sending data to Instana. You can use the dummy key shown above.

For agentless mode (sending data directly to Instana backend):

TRACELOOP_API_KEY=tl_dummy_1234567890abcdef1234567890abcdef
OTEL_RESOURCE_ATTRIBUTES="INSTANA_PLUGIN=genai"
TRACELOOP_BASE_URL=<instana-otlp-endpoint>:4317
TRACELOOP_HEADERS="x-instana-key=<your_instana_key>,x-instana-host=<instana-host>"
OTEL_EXPORTER_OTLP_INSECURE=false

Replace:

  • <instana-otlp-endpoint> with your Instana backend endpoint

  • <your_instana_key> with your actual Instana key

  • <instana-host> with your Instana host

Note:

The endpoint URL varies by region. For regional endpoints, see Sending OpenTelemetry data to the Instana backend.

2. Start Langflow with environment variables

Start your Langflow application using the environment variables from the .env file:

uv run langflow run --env-file .env

Alternatively, if you installed Langflow globally:

langflow run --env-file .env

3. Create and run a flow

To generate telemetry data:

  1. Open Langflow in your browser (typically at http://localhost:7860)

  2. Select the Simple Agent starter project or create your own flow

  3. Configure the agent component with your LLM API key

  4. Click Playground to test your flow

  5. Ask the agent several questions to generate test traffic:

    • "What is the capital of India?"

    • "Perform addition 2 + 2" (uses the calculator component)

    • "What's the weather like today?"

4. View data in Instana

After running flows in Langflow, data will appear in the Instana Gen AI observability dashboard showing workflow execution, LLM interactions, and tool invocations.

Troubleshooting

For common issues like traces not appearing or data not being displayed, see Troubleshooting.

Langflow-specific connection errors

Issue: Langflow shows connection errors when trying to send telemetry.

Solution:

For agent mode:

  • Verify the Instana agent is running

  • Check that <instana-agent-host> is correct

  • If using Docker, ensure host.docker.internal is accessible

For agentless mode:

  • Verify the backend endpoint URL is correct

  • Check that your Instana key is valid

  • Ensure port 4317 is accessible

Invalid Traceloop API key warnings

Issue: Warnings about invalid Traceloop API key appear in logs.

Solution: This is expected when using the dummy API key. The warnings can be safely ignored as long as data is flowing to Instana. The dummy key is sufficient for Instana integration.