Python · Instrumentation
openinference-instrumentation-beeai
OpenInference BeeAI Instrumentation
- Module
openinference.instrumentation.beeai- Version
- 0.1.36
- Python
- >=3.11,<3.15
- Instruments
beeai-framework >= 0.1.51
Install
pip install openinference-instrumentation-beeaiUsage
Instrument once, at startup, before the library is used. The BeeAIInstrumentor reference below lists the options.
from opentelemetry.sdk.trace import TracerProvider
from openinference.instrumentation import TraceConfig
from openinference.instrumentation.beeai import BeeAIInstrumentor
tracer_provider = TracerProvider()
# ...add a span processor that exports to Phoenix or any OTLP backend.
BeeAIInstrumentor().instrument(
tracer_provider=tracer_provider,
config=TraceConfig(hide_inputs=True), # optional
)openinference.instrumentation.beeai
BeeAIInstrumentor
classSource ↗class BeeAIInstrumentor(*args: Any = (), **kwargs: Any = {})instrument
methoddef instrument(
*,
tracer_provider: Optional[TracerProvider] = None,
config: Optional[TraceConfig] = None,
skip_dep_check: bool = False,
) -> NoneStart tracing beeai-framework: patch it so its calls make OpenInference spans. Calling it again does nothing. Inherited from OpenTelemetry’s BaseInstrumentor.
Parameters
| Name | Description |
|---|---|
tracer_provider | The tracer provider the spans are made with. Defaults to the global one, |
config | What the spans record: hide inputs, outputs or messages, or limit image sizes. Defaults to |
skip_dep_check | Instrument even if the installed version of |
uninstrument
methoddef uninstrument() -> NoneStop tracing: undo the patches instrument() made. Inherited from OpenTelemetry’s BaseInstrumentor.
instrumentation_dependencies
methodSource ↗def instrumentation_dependencies() -> Collection[str]openinference.instrumentation.beeai.processors.base
Processor
classSource ↗class Processor(event: RunContextStartEvent, meta: EventMeta)Attributes
| Name | Type and value |
|---|---|
kind | OpenInferenceSpanKindValues = OpenInferenceSpanKindValues.UNKNOWN |
run_id | meta.trace.run_id |
span | SpanWrapper(name=self.get_span_name(target_cls), kind=type(self).kind) |
openinference.instrumentation.beeai.processors.tool
ToolProcessor
classSource ↗class ToolProcessor(event: RunContextStartEvent, meta: EventMeta)Attributes
| Name | Type and value |
|---|---|
kind | OpenInferenceSpanKindValues = OpenInferenceSpanKindValues.TOOL |
openinference.instrumentation.beeai.processors.locator
ProcessorLocator
classSource ↗class ProcessorLocatorAttributes
| Name | Type and value |
|---|---|
entries | dict[type, type] = {} |
openinference.instrumentation.beeai.processors.embedding
EmbeddingModelProcessor
classSource ↗class EmbeddingModelProcessor(
event: RunContextStartEvent,
meta: EventMeta,
)Attributes
| Name | Type and value |
|---|---|
kind | OpenInferenceSpanKindValues = OpenInferenceSpanKindValues.EMBEDDING |
get_span_name
methodSource ↗def get_span_name(target_cls: type) -> strupdate
methodSource ↗async def update(event: Any, meta: EventMeta) -> Noneopeninference.instrumentation.beeai.processors.chat
get_tool_parameters
functionSource ↗def get_tool_parameters(tool: AnyTool) -> Dict[str, Any]get_tools
functionSource ↗def get_tools(
tools: list[AnyTool],
) -> Generator[Tuple[str, str], None, None]ChatModelProcessor
classSource ↗class ChatModelProcessor(event: RunContextStartEvent, meta: EventMeta)Attributes
| Name | Type and value |
|---|---|
kind | OpenInferenceSpanKindValues = OpenInferenceSpanKindValues.LLM |
openinference.instrumentation.beeai.processors.workflow
WorkflowProcessor
classSource ↗class WorkflowProcessor(event: RunContextStartEvent, meta: EventMeta)Attributes
| Name | Type and value |
|---|---|
kind | OpenInferenceSpanKindValues = OpenInferenceSpanKindValues.CHAIN |
openinference.instrumentation.beeai.processors.requirement
RequirementProcessor
classSource ↗class RequirementProcessor(event: RunContextStartEvent, meta: EventMeta)Attributes
| Name | Type and value |
|---|---|
kind | OpenInferenceSpanKindValues = OpenInferenceSpanKindValues.UNKNOWN |
openinference.instrumentation.beeai.processors.agents.base
AgentProcessor
classSource ↗class AgentProcessor(event: RunContextStartEvent, meta: EventMeta)Attributes
| Name | Type and value |
|---|---|
kind | OpenInferenceSpanKindValues = OpenInferenceSpanKindValues.AGENT |
openinference.instrumentation.beeai.processors.agents.tool_calling
ToolCallingAgentProcessor
classSource ↗class ToolCallingAgentProcessor(AgentProcessor)openinference.instrumentation.beeai.processors.agents.react
ReActAgentProcessor
classSource ↗class ReActAgentProcessor(event: RunContextStartEvent, meta: EventMeta)openinference.instrumentation.beeai.processors.agents.requirement_agent
RequirementAgentProcessor
classSource ↗class RequirementAgentProcessor(
event: RunContextStartEvent,
meta: EventMeta,
)