pankajkoti opened a new pull request, #73275:
URL: https://github.com/apache/airflow/pull/73275
Give an agent run and the Airflow task instance that produced it a shared
identifier, so a task's output can be joined to its GenAI trace without
reconstructing it from timestamps.
`AgentOperator` (and `@task.agent`) now:
- pass the task-instance id (unique per attempt, since Airflow regenerates it
on each retry) as the pydantic-ai `run_id`, so it surfaces on
`AgentRunResult.run_id`, the run's messages, and `gen_ai.agent.call.id` on
the agent-run span
- stamp the Airflow identity on every emitted GenAI span (`airflow.dag_id`,
`airflow.task_id`, `airflow.dag_run.run_id`,
`airflow.task_instance.try_number`,
`airflow.task_instance.map_index`, `airflow.task_instance.id`), so a span
is
filterable by those directly rather than by walking up to the parent task
span
- expose the `run_id` and token `usage` on XCom for a downstream task
Bumps the `pydantic-ai-slim` floor to `>=2.16.0`, the release that added the
`run_id=` parameter (pydantic-ai#6615).
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 4.8)
Generated-by: Claude Code (Opus 4.8) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]