> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# BeeAI framework integration

> Send BeeAI Framework traces to Toqan Router using OpenTelemetry and OpenInference. Monitor agent workflows, tool calls, and LLM interactions.

> [card] [Observability](#observability)
>
> Instrument your code with OpenTelemetry to capture traces, logs, and metrics for every LLM call, agent step, and tool use.

## Observability

### Overview

BeeAI is IBM's open-source agent framework for building production-ready multi-agent systems. It uses the `openinference-instrumentation-beeai` library to export traces via OpenTelemetry.

### Prerequisites

* A Toqan Router account and API Key
* Python 3.10+
* An OpenAI API key (`OPENAI_API_KEY`) — the examples use OpenAI models

### Installation

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
pip install beeai-framework \
    opentelemetry-api \
    opentelemetry-sdk \
    "opentelemetry-exporter-otlp-proto-http" \
    openinference-instrumentation-beeai
```

### Configuring Toqan Router Observability

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from openinference.instrumentation.beeai import BeeAIInstrumentor

exporter = OTLPSpanExporter(
    endpoint="https://router.toqan.ai/eu/v2/otel/v1/traces",
    headers={"Authorization": f"Bearer {os.environ['TOQAN_API_KEY']}"},
)
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(BatchSpanProcessor(exporter))
BeeAIInstrumentor().instrument(tracer_provider=tracer_provider)
```

### Basic Example

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
import asyncio
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from openinference.instrumentation.beeai import BeeAIInstrumentor

exporter = OTLPSpanExporter(
    endpoint="https://router.toqan.ai/eu/v2/otel/v1/traces",
    headers={"Authorization": f"Bearer {os.environ['TOQAN_API_KEY']}"},
)
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(BatchSpanProcessor(exporter))
BeeAIInstrumentor().instrument(tracer_provider=tracer_provider)

from beeai_framework.agents.react import ReActAgent
from beeai_framework.adapters.openai import OpenAIChatModel
from beeai_framework.memory import UnconstrainedMemory

async def main():
    agent = ReActAgent(
        llm=OpenAIChatModel("gpt-5.4-mini"),
        memory=UnconstrainedMemory(),
        tools=[],
    )
    result = await agent.run("What is 2 + 2?")
    print(result.output.text)

asyncio.run(main())
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.