BeeAI Framework
Trace BeeAI Framework agents with cetra from Python: agent runs, model calls and tools.
Install
Section titled “Install”pip install "cetra-sdk[beeai]" beeai-frameworkSet up
Section titled “Set up”import asyncioimport os
import cetrafrom beeai_framework.adapters.openai import OpenAIChatModelfrom beeai_framework.agents.requirement import RequirementAgentfrom beeai_framework.tools import tool
cetra.init(instrument=["beeai"])
@tooldef get_weather(city: str) -> str: """Look up the weather for a city.""" return f"sunny in {city}"
async def main() -> None: llm = OpenAIChatModel("gpt-4o-mini", api_key=os.environ["OPENAI_API_KEY"]) agent = RequirementAgent( llm=llm, tools=[get_weather], instructions="You are a weather assistant.", name="weather-agent", ) await agent.run("What is the weather in Paris?")
asyncio.run(main())
cetra.flush()What you get
Section titled “What you get”- The run is an
agentspan named after the agent, with the final answer as a secondagentspan and atoolspan. - Each model call is an
llmspan with the messages, the tool definitions and the token counts. - Each tool call is a
toolspan with the tool’s input and output.
Limits
Section titled “Limits”- Do not also enable
openai: each model call would be recorded twice and counted twice. - Cost is the one BeeAI reports (through LiteLLM), not cetra’s price table. A model LiteLLM cannot price reports a cost of 0.
- TypeScript is not supported: OpenInference’s BeeAI instrumentation only covers 2025 versions of the TypeScript framework.
- beeai-framework needs Python 3.13 or earlier: it does not support Python 3.14 yet. The
beeaiextra itself needs Python 3.14 or earlier: the OpenInference BeeAI instrumentation does not support Python 3.15 yet. - The fixture was captured with beeai-framework 0.1.85 and openinference-instrumentation-beeai 0.1.36.
- If a field is missing, look at the span’s Attributes tab and compare it with Span attributes.
- Traces: read the trace as a tree and a timeline.
- Cost and tokens: how cost is computed from the token counts.
- Online rules: score these traces automatically.