kaxil opened a new pull request, #73901:
URL: https://github.com/apache/airflow/pull/73901
A Strands or ADK agent running in a plain Python task was invisible in
Airflow's metrics and its traces: nothing counted its tool calls, its spans
carried prompts and tool results by default, and they were not tied to the task.
- **`common_ai.tool_calls`** is incremented for every call to a
connection-backed toolset this provider ships, tagged with the toolset class,
the framework making the call (`pydantic_ai`, `strands`, `adk`, `langchain` or
`none`) and the outcome (`executed`, `failed` or `replayed`). Tags stay
low-cardinality: never arguments, connection IDs, table names or paths.
- **`agent_framework_tracing()`** wraps the code that builds and runs the
agent. Inside the block, three things hold:
- The framework leaves prompts, completions and tool inputs and outputs
out of its spans unless `[common.ai] otel_export_enabled` and `capture_content`
are both on, the same default as `AgentOperator`.
- Every span carries the task's Dag ID, run ID, task ID, map index and try
number.
- When no tracer provider made a span for the task, the Dag run's
unsampled trace context is not made the framework spans' parent.
**The frameworks read their content switches only from the environment**, so
the helper sets them for the duration of the block. Blocks can overlap when a
task runs agents in threads, so the switches stay set until the last one
closes. A task runs in its own process, so nothing outside the task sees them.
**The helper detaches the parent only when the current span is the Dag run's
propagated context itself.** That happens only when no tracer provider made a
task span. When core tracing or auto-instrumentation made one, the Dag run was
sampled out on purpose, and the helper leaves that decision alone. This is the
same rule as the task SDK fix that changes the task span itself; the helper
covers Airflow versions without that fix. The metric and the helper are
experimental and listed on the stability page.
---
* Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information. Note: commit author/co-author name and email in commits
become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License
Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment:
`{pr_number}.significant.rst`, in
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
You can add this file in a follow-up commit after the PR is created so you
know the PR number.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]