Notebooks
L
Langfuse
Integration Beeai

Integration Beeai

observabilityllmsgenaicookbookprompt-managementhacktoberfestlarge-language-modelsnextraLangfuselangfuse-docs

Trace BeeAI Agents in Langfuse

This notebook shows how to trace and observe BeeAI Framework applications with Langfuse using OpenTelemetry instrumentation.

What is BeeAI? BeeAI Framework is a comprehensive toolkit, developed by IBM Research, for building intelligent, autonomous agents and multi-agent systems. It provides everything you need to create agents that can reason, take actions, and collaborate to solve complex problems in both Python and TypeScript.

What is Langfuse? Langfuse is an open source platform for LLM observability and monitoring. It helps you trace and monitor your AI applications by capturing metadata, prompt details, token usage, latency, and more.

Step 1: Install Dependencies

Before you begin, install the necessary packages in your Python environment:

[ ]

Step 2: Configure Langfuse SDK

Next, set up your Langfuse API keys. You can get these keys by signing up for a free Langfuse Cloud account or by self-hosting Langfuse. These environment variables are essential for the Langfuse client to authenticate and send data to your Langfuse project.

You will also need to configure your LLM provider credentials. BeeAI Framework supports multiple providers including OpenAI, Ollama, watsonx.ai, and others.

[ ]

With the environment variables set, we can now initialize the Langfuse client. get_client() initializes the Langfuse client using the credentials provided in the environment variables.

[3]

Step 3: OpenTelemetry Instrumentation

Use the BeeAIInstrumentor library to wrap BeeAI Framework calls and send OpenTelemetry spans to Langfuse.

[4]

Step 4: Run an Example

[ ]

View Traces in Langfuse

After executing the application, navigate to your Langfuse Trace Table. You will find detailed traces of the application's execution, providing insights into the agent conversations, tool calls, LLM interactions, inputs, outputs, and performance metrics.

Langfuse Trace

View trace in Langfuse