Skip to content

Support excluding files from common.ai Agent Skills discovery#69924

Merged
kaxil merged 1 commit into
apache:mainfrom
astronomer:common-ai-skills-exclude-resources
Jul 15, 2026
Merged

Support excluding files from common.ai Agent Skills discovery#69924
kaxil merged 1 commit into
apache:mainfrom
astronomer:common-ai-skills-exclude-resources

Conversation

@kaxil

@kaxil kaxil commented Jul 15, 2026

Copy link
Copy Markdown
Member

AgentSkillsToolset gains an optional exclude_resources parameter — a list of glob patterns forwarded to pydantic-ai-skills' SkillsToolset that keeps matched files out of a skill's discovered resources. It mirrors the existing exclude_tools escape hatch and is resolved per-run on the worker (so nothing is baked into the serialized DAG).

Why now

pydantic-ai-skills 1.2.0 broadened resource discovery from a fixed seven-extension allowlist (.md/.json/.yaml/.yml/.csv/.xml/.txt) to every readable text file in a skill bundle, so .sql, .toml, .jinja, and similar assets are exposed with no extra config (DougTrajano/pydantic-ai-skills#54, #55).

That broader discovery also means more files reach the model, so exclude_resources is the trim knob for secrets or scratch files that happen to live in a skill directory. The two ship together: broaden discovery, and give users a way to narrow it back.

Usage

from airflow.providers.common.ai.toolsets.skills import AgentSkillsToolset

toolset = AgentSkillsToolset(
    sources=["./skills"],
    exclude_resources=["*.env", "secrets/*"],  # added on top of the built-in defaults
)

Patterns extend the built-in defaults (__pycache__, *.pyc, *.pyo, .DS_Store, .git) and match either the full skill-relative path or any single path component.

Scope of the guarantee

exclude_resources hides files from resource discovery only — the resource list and the read_skill_resource tool. It does not stop a skill's run_skill_script from reading an excluded file off disk (a skill script runs as a subprocess with the worker's filesystem permissions). When files are genuinely sensitive, pair it with exclude_tools={"run_skill_script"}. This is called out in both the docstring and the toolset guide.

Packaging notes

  • The [skills] extra floor moves to pydantic-ai-skills>=1.2.0 (the version that adds the parameter).
  • 1.2.0 was published inside the repo's exclude-newer = "4 days" window, so a temporary per-package exclude-newer-package cutoff (2026-07-16T00:00:00Z) is added in both [tool.uv.exclude-newer-package] and [tool.uv.pip.exclude-newer-package] so it resolves. The comment marks it for removal once the rolling window advances past 2026-07-15.
  • Regenerating uv.lock for the floor bump also picked up pre-existing drift on main unrelated to this change: the openai provider had already dropped its [datalib] extra in pyproject.toml but the lock was never refreshed, and common-dataquality is re-sorted. uv lock always fully syncs, so this churn is unavoidable when touching the lock.

`AgentSkillsToolset` now accepts an optional `exclude_resources` list of glob
patterns, forwarded to `pydantic-ai-skills`' `SkillsToolset`, to keep matched
files out of a skill's discovered resources. It mirrors the existing
`exclude_tools` escape hatch and is resolved per-run on the worker.

pydantic-ai-skills 1.2.0 broadened resource discovery from a fixed
seven-extension allowlist to every readable text file in a skill bundle, so
`.sql`/`.toml`/`.jinja` assets are exposed with no extra config. That also
widens what reaches the model, so `exclude_resources` is the trim knob for
secrets or scratch files (e.g. `["*.env", "secrets/*"]`). It removes files from
resource discovery only, not from `run_skill_script` filesystem access, so pair
it with `exclude_tools={"run_skill_script"}` when files are genuinely sensitive.

The `[skills]` floor moves to `pydantic-ai-skills>=1.2.0` (the version that adds
the parameter). 1.2.0 was published inside the repo's 4-day exclude-newer
window, so a temporary per-package `exclude-newer-package` override lets it
resolve; remove it once the window advances past 2026-07-15.

@gopidesupavan gopidesupavan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :)

@kaxil
kaxil merged commit 663a792 into apache:main Jul 15, 2026
301 of 302 checks passed
@kaxil
kaxil deleted the common-ai-skills-exclude-resources branch July 15, 2026 17:10
joshuabvarghese pushed a commit to joshuabvarghese/airflow that referenced this pull request Jul 16, 2026
…he#69924)

`AgentSkillsToolset` now accepts an optional `exclude_resources` list of glob
patterns, forwarded to `pydantic-ai-skills`' `SkillsToolset`, to keep matched
files out of a skill's discovered resources. It mirrors the existing
`exclude_tools` escape hatch and is resolved per-run on the worker.

pydantic-ai-skills 1.2.0 broadened resource discovery from a fixed
seven-extension allowlist to every readable text file in a skill bundle, so
`.sql`/`.toml`/`.jinja` assets are exposed with no extra config. That also
widens what reaches the model, so `exclude_resources` is the trim knob for
secrets or scratch files (e.g. `["*.env", "secrets/*"]`). It removes files from
resource discovery only, not from `run_skill_script` filesystem access, so pair
it with `exclude_tools={"run_skill_script"}` when files are genuinely sensitive.

The `[skills]` floor moves to `pydantic-ai-skills>=1.2.0` (the version that adds
the parameter). 1.2.0 was published inside the repo's 4-day exclude-newer
window, so a temporary per-package `exclude-newer-package` override lets it
resolve; remove it once the window advances past 2026-07-15.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants