airflow.providers.common.ai.tools.tracing¶
Make the OpenTelemetry spans of an agent framework other than Pydantic AI part of the task.
Note
Experimental; see airflow.providers.common.ai.tools.
Functions¶
Make the OpenTelemetry spans of a Strands or Google ADK agent part of the Airflow task. |
Module Contents¶
- airflow.providers.common.ai.tools.tracing.agent_framework_tracing()[source]¶
Make the OpenTelemetry spans of a Strands or Google ADK agent part of the Airflow task.
Build and run the agent inside the block:
with agent_framework_tracing(): agent = Agent(model=model, plugins=[AirflowTools(warehouse)]) answer = agent(question)
Inside it:
Prompts, completions, and tool arguments and results are left out of the framework’s spans unless
[common.ai] otel_export_enabledandcapture_contentare both on, as forAgentOperator. A switch the deployment already set in the environment wins. Strands reads its switch once, when it creates its tracer, and ADK when aTelemetryConfigis built, so create both inside the block.Every span started under the worker’s OpenTelemetry tracer provider carries the task’s Dag ID, run ID, task ID, map index, try number and task instance ID, the attributes
AgentOperator’s spans carry.When no tracer provider made a span for the task, the Dag run’s trace context is not made the parent of the framework’s spans. That context is marked as not sampled, and a parent-based sampler, the OpenTelemetry default, would otherwise drop every span a tracer provider the framework installs starts. When core tracing or auto-instrumentation made the task’s span, the Dag run’s sampling decision holds.
Where the spans go is up to the tracer provider: core tracing’s exporter when
[traces] otel_onis set, or the provider the framework’s own telemetry setup installs.