Skip to content

feat(tools): Persist skill-script outputs as artifacts - #6675

Closed
a2105z wants to merge 1 commit into
google:mainfrom
a2105z:feat/skill-script-auto-artifacts
Closed

a2105z wants to merge 1 commit into
google:mainfrom
a2105z:feat/skill-script-auto-artifacts

Conversation

@a2105z

@a2105z a2105z commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Skill scripts materialize into a tempdir that is deleted after execution, so generated files (PDFs, exports, images) were lost.
  • The skill wrapper now walks the tempdir after the script runs, emits new files (excluding packaged skill resources / __pycache__) via a stdout marker, and RunSkillScriptTool saves them with tool_context.save_artifact.
  • Tool results include saved_artifacts when persistence succeeds.

Fixes #5579

Test plan

  • Unit tests for marker extraction, save path, shell envelope + marker, missing artifact service
  • Integration tests with UnsafeLocalCodeExecutor + InMemoryArtifactService (save + no re-save of skill resources)
  • Full test_skill_toolset.py (135 passed) + path traversal tests
  • Pre-commit on touched files

@a2105z

a2105z commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Hi @klateefa @GWeale @DeanChensj — ready for review when you have a moment.

This implements #5579: skill scripts that write files (reports/PDFs/exports) now have those outputs auto-saved as session artifacts, with saved_artifacts returned on the tool result. Packaged skill resources are excluded; __pycache__ / oversized files are skipped.

@a2105z

a2105z commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@xuanyang15 -> ready for review.

@xuanyang15

Copy link
Copy Markdown
Collaborator

@a2105z Thanks for creating this PR! It is in review now.

Skill scripts wrote files into a TemporaryDirectory that was deleted after
execution, so generated PDFs/exports were lost. Capture new files from the
script workspace, save them via tool_context.save_artifact, and return
saved_artifacts in the tool result.

Fixes google#5579
@a2105z

a2105z commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main to clear the CI failures.

What happened: the branch was behind main, so:

  • Pre-commit failed on stale constraints-3.*.txt headers (update-constraints), not on the skill-artifact change itself
  • Mypy compared an outdated merge commit to a fresh main baseline, so pre-existing errors elsewhere looked “new”

Unit tests were already green. No code changes in this push — rebase only. CI should be clean now.

@a2105z
a2105z force-pushed the feat/skill-script-auto-artifacts branch from e819c71 to 140e5fa Compare August 17, 2026 19:45
@a2105z

a2105z commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

@xuanyang15 — rebased onto latest main to clear the stale pre-commit/mypy failures from the outdated merge base. Continuous Integration is waiting on workflow approval again after the push; when you have a moment, could you approve/re-run it? Thanks!

@a2105z

a2105z commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Hi @xuanyang15 — quick question on CI for this PR.

After the rebase, mypy and unit tests on 3.11–3.14 are green. The remaining reds look like they match current main, not this change (we only touch skill_toolset.py + its tests):

  • Pre-commit: end-of-file-fixer on docs/guides/agents/remote_a2a_agent/task.md (missing trailing newline) — same failure on main
  • Unit Tests (Python 3.10): test_import_loading allowlist (async_timeout, backports, exceptiongroup) — same failure on main
  • Copybara / Do Not Merge: expected

Could you advise what you’d like us to do here? Happy to leave as-is and wait on the main fixes, or land a small drive-by in this PR if that’s preferred. Thanks!

@xuanyang15

Copy link
Copy Markdown
Collaborator

Hi @a2105z, no worries, we need to add some modification on top of your PR anyway internally, we will make sure all the CI checks pass for submission.

@a2105z

a2105z commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Hi @xuanyang15 — thanks again for picking this up internally. Just a light follow-up: still happy to help with anything you need on our side so it can land. Appreciate it!

copybara-service Bot pushed a commit that referenced this pull request Oct 2, 2026
Merge #6675

Fixes #5579

PiperOrigin-RevId: 992441920
@adk-bot

adk-bot commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Thank you @a2105z for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit beaef0d.

Closing this PR as the changes are now in the main branch.

@adk-bot adk-bot added the merged [Status] This PR is merged label Oct 2, 2026
@adk-bot adk-bot closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged [Status] This PR is merged tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Support automatic artifact storage for files generated by skill toolset scripts

3 participants