BeeAI Tracing (JS)
Auto-instrument and observe BeeAI agents

This module provides automatic instrumentation for BeeAI framework. It integrates seamlessly with the @opentelemetry/sdk-trace-node package to collect and export telemetry data.
Install
npm install --save beeai-framework \
@arizeai/openinference-instrumentation-beeai \
@arizeai/phoenix-otelSetup
To instrument your application, import and enable BeeAIInstrumentation. Create the instrumentation.ts file:
import { register, registerInstrumentations } from "@arizeai/phoenix-otel";
import * as beeaiFramework from "beeai-framework";
import { BeeAIInstrumentation } from "@arizeai/openinference-instrumentation-beeai";
const provider = register({
projectName: "beeai-project",
});
const beeAIInstrumentation = new BeeAIInstrumentation();
beeAIInstrumentation.manuallyInstrument(beeaiFramework);
registerInstrumentations({
instrumentations: [beeAIInstrumentation],
});
console.log("👀 OpenInference initialized");Run BeeAI
Sample agent built using BeeAI with automatic tracing:
import "./instrumentation.ts";
import { ToolCallingAgent } from "beeai-framework/agents/toolCalling/agent";
import { TokenMemory } from "beeai-framework/memory/tokenMemory";
import { DuckDuckGoSearchTool } from "beeai-framework/tools/search/duckDuckGoSearch";
import { OpenMeteoTool } from "beeai-framework/tools/weather/openMeteo";
import { OpenAIChatModel } from "beeai-framework/adapters/openai/backend/chat";
const llm = new OpenAIChatModel(
"gpt-4o",
{},
{ apiKey: process.env.OPENAI_API_KEY }
);
const agent = new ToolCallingAgent({
llm,
memory: new TokenMemory(),
tools: [
new DuckDuckGoSearchTool(),
new OpenMeteoTool(), // weather tool
],
});
async function main() {
const response = await agent.run({ prompt: "What's the current weather in Berlin?" });
console.log(`Agent 🤖 : `, response.result.text);
}
main();Observe
Phoenix provides visibility into your BeeAI agent operations by automatically tracing all interactions.
Resources
Last updated
Was this helpful?