Repository navigation
Conversation
4fc6d41 to
0065f0a
Compare
pydantic-ai-skills 2.0 removed the SkillsToolset that AgentSkillsToolset wraps, so Common AI needs its own way to offer Agent Skills. AirflowSkills builds on pydantic-ai-harness's Skills capability and adds GitSkills sources, a read_skill_resource tool and, with scripts="worker", a run_skill_script tool that runs a script on the worker. Sources are resolved when a run starts and a cloned repository is removed when it ends, however it ends. The two tools share one toolset with a stable id, so with durable=True a retry replays a script's result instead of running the script again.
Dag authors moving off AgentSkillsToolset need to know how AirflowSkills behaves
differently: how a skill is loaded, what ${SKILL_DIR} means in a path, what the
script tool can reach, and which pydantic-ai-harness versions it works with.
AirflowSkills builds on the Skills capability from pydantic-ai-harness, so the skills extra now installs pydantic-ai-harness[skills]. The floor is 0.66.0 because each harness release pins pydantic-ai-slim exactly and the provider already requires pydantic-ai-slim>=2.66.0. pydantic-ai-skills stays in the extra, below 2, for AgentSkillsToolset.
Creating an AgentSkillsToolset now emits an AirflowProviderDeprecationWarning that names AirflowSkills. The docs and the example Dags move to AirflowSkills, and the Agent Skills page has a table that maps each AgentSkillsToolset option to its AirflowSkills counterpart. AgentSkillsToolset keeps working and is removed in a later release, when pydantic-ai-skills also leaves the skills extra. The skills XCom and the skills list in the AI Model tab still come only from AgentSkillsToolset, so a task that uses AirflowSkills shows no skills there yet. The migration section says so.
Pass max_retries to FunctionToolset instead of overriding get_tools, so the budget follows pydantic-ai's own handling, including under durable execution. Import yaml at the top of skill_files.py, since PyYAML is an Airflow core dependency.
Script argument names must start with a letter and use only letters, digits, "-" and "_", so a name such as "--rm" or "" can no longer turn into a different flag. read_skill_resource refuses a file larger than 1,000,000 bytes instead of returning it whole.
A script that left a background child holding its output pipe lost everything it had printed when the 30 second timeout hit. The model now gets that output followed by the timeout note.
The module summary no longer calls itself framework-agnostic now that it defines a pydantic-ai capability. combine and the harness import carry real types instead of Any. The for_run comment records why the clone is made there and that only Airflow's durable execution is supported. The GitSkills warning says to set branch to a tag, since a branch name moves.
Tell readers that a skill nested deeper than one level is not found and nothing says so, that AirflowSkills supports only Airflow's own durable execution, and that GitSkills should be set to a tag, not a branch name.
The dev group allowed 0.35, which has no skills extra, while the skills extra needs 0.66. Also list the module that holds AirflowSkills and its file tools under Key Paths in the provider's AGENTS.md.
The success and failure cleanup tests now hold the run's capability, so only the end of the run can have removed the clone. New tests cover output of exactly the cap, cancelling a running script, killing a process whose group is gone, a directory pattern over nested files, a missing local source, and a shebang that overrides the suffix.
The output returned with a timeout note now goes through the same decoding and cut-off as a normal result. The timeout test starts a shell script with a 2 second limit, so a slow interpreter start no longer loses the output it checks for.
Call Skills with include= or exclude= in two explicit branches instead of unpacking a dict, so the call matches the harness's typed overloads. Which skills are offered does not change.
The warning box at the top of the skills page still told readers to pin branch to a trusted ref, which contradicted the Trust model section. Rewrap an over-long line in the read_skill_resource description.
…w 3.1
The test asserts with `{...} in caplog`, which only the structlog-backed
caplog fixture supports. On Airflow 3.0 the fixture falls back to pytest's
LogCaptureFixture, so the Compat 3.0.6 job failed with a TypeError.
AirflowSkills runs showed no skills in the AI Model tab because only the deprecated AgentSkillsToolset published the XCom. Both now share one publisher, and load_capability counts as load_skill so the tab shows the skill as loaded.
The counting and source-description tests move with the code they cover. The new tests pin which calls count, that failed runs still publish and cancelled ones do not, and that a durable retry counts replayed skill calls.
The guide said AirflowSkills publishes no skills telemetry, which is no longer true. The section now sits outside the deprecated toolset's part, and the guide says why AgentSkillsToolset needs pydantic-ai-skills below 2.
before_model_request had no docstring, so the API docs inherited pydantic-ai's, whose cross-references fail the spelling check. The skills dict also needed a type for mypy.
0065f0a to
a68c606
Compare
| except ValueError: | ||
| return None | ||
| if parts and Path(parts[0]).name == "env": | ||
| parts = [part for part in parts[1:] if not part.startswith("-")] |
There was a problem hiding this comment.
This drops every token that starts with - after env, including the interpreter's own flags, not just env's options. With this script:
#!/usr/bin/env -S bash -e
false
printf 'CONTINUED AFTER FAILURE\n'running it directly exits 1 and prints nothing. _build_script_command builds ['/usr/bin/bash', '.../check.sh'] with no -e, so run_skill_script returns CONTINUED AFTER FAILURE. The script runs past a failure its author told it to stop at, and nothing says so. A flag that takes a value is worse: #!/usr/bin/env -S python3 -W ignore becomes python3 ignore script.py, so Python tries to run a file named ignore. A shebang without env (#!/bin/bash -e) keeps its flags, so only the env form is affected.
Could we skip only the leading env options (and NAME=value assignments), and keep everything after the interpreter?
if parts and Path(parts[0]).name == "env":
rest = parts[1:]
while rest and (rest[0].startswith("-") or "=" in rest[0]):
rest = rest[1:]
parts = restA regression test with env -S bash -e asserting the line after false never prints would cover it.
Why
pydantic-ai-skills2.0 removed theSkillsToolsetclass thatAgentSkillsToolsetwraps. Common AI needs a new integration so Dag authors can continue using Agent Skills.What
AirflowSkillsas anAgentOperatorcapability backed bypydantic-ai-harness. It loads skills from local directories or Git repositories, reads skill resources, and runs skill scripts on the worker. Airflow’s durable execution replays recorded script results on retry.AirflowSkillsandAgentSkillsToolsetto the XCom used by the AI Model tab.AgentSkillsToolsetand retain support for it withpydantic-ai-skills1.x. Migrate the example Dags and document how to switch toAirflowSkills.Was generative AI tooling used to co-author this PR?
Generated-by: [Claude] following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.