You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: Support automatic artifact storage for files generated by skill toolset scripts #5579
When skill toolset scripts generate files (e.g., PDF creation, image generation, data
exports), these files are created in temporary directories and lost after execution.
There's currently no built-in mechanism to persist skill-generated files as artifacts.
Current Behavior
Skill scripts can generate files in temporary directories during execution
These files are not automatically saved as artifacts
SaveFilesAsArtifactsPlugin only handles user-uploaded files (inline_data)
Files are discarded after script execution completes
Expected Behavior
One or more of:
Automatic artifact storage for skill-generated files (if returned in response)
Plugin support for intercepting tool responses with file data
Documentation on best practices for persisting skill-generated files
Skill API extension for explicit artifact saving
Use Cases
PDF generation skills that need to save generated PDFs
Image processing skills that output images
Data processing skills that generate reports or exports
Any skill that creates files meant to be accessed later
Example Scenario
# PDF skill script generates a file# Expected: File automatically becomes available as artifact# Actual: File is lost after script execution
@henrywang0314 Thanks for the update. The request is currently being reviewed, and I will let you know if anything further is needed. Thank you for your understanding.
GitHub Issue #5579 Analysis: Support automatic artifact storage for files generated by skill toolset scripts
Executive Summary
What is broken? When executing agent skill scripts (via RunSkillScriptTool), files generated by the scripts (such as generated PDFs, images, data exports) are deleted immediately because the environment is executed within a nested tempfile.TemporaryDirectory that is discarded upon completion. There is no automatic detection or retention of these files.
Is there a linked PR that fixes this issue? None.
Recommendation: Should Fix (Medium Priority) — Standardizing dynamic output capture from skill script tools dramatically improves the usability of document, spreadsheet, and multimodal asset-generation skills without forcing developers to implement complex, custom storage workarounds.
Detailed Analysis
1. Root Cause Analysis ("What is broken?")
When an agent invokes a skill script via the RunSkillScriptTool.run_async method, it utilizes an internal helper class _SkillScriptCodeExecutor to serialize and execute the workspace script using the underlying code executor (e.g., local, container, or VM-based sandbox).
The execution flow decomposes as follows:
_build_wrapper_code designs a self-contained Python wrapper script.
The wrapper instantiates a temporary directory, switches the active working directory, and materializes skill assets locally:
def_materialize_and_run():
_orig_cwd=os.getcwd()
withtempfile.TemporaryDirectory() astd:
forrel_path, contentin_files.items():
...
os.chdir(td)
try:
# runs python with runpy or shell with subprocess.run()
Any files created during execution of the skill's Python code or shell scripts are saved locally inside td.
Once the script finishes or exits, the with tempfile.TemporaryDirectory() as td: context block is exited. This recursively wipes the temporary directory, purging all newly written documents, reports, or visual assets before they can be captured.
2. Existing Pull Requests ("Is there a linked PR that fixes this issue?")
Linked PR: None
PR URL: N/A
Analysis: A thorough investigation across existing pull requests mentioning issue 5579 or containing relevant keywords ("artifact extraction", "skill outputs") confirms no corresponding PR or branch has been submitted to resolve this issue yet.
3. Recommendation
Recommendation: Should Fix (Medium Priority)
Rationale:
Developer Experience: Generating data tables, charts, and reports is a first-class agent use case. Supporting automatic or opt-in file retention significantly saves developer lift.
Proposed Solution:
Update _build_wrapper_code to perform a walk/diff of td after tool execution.
Detect any newly created or modified files that are not part of the initial skill resource dictionary (_files).
Encode these files as base64-serialized data within the JSON result envelope printed to standard output.
Pass the tool_context to execute_script_async, allowing it to call await tool_context.save_artifact(...) to persist the discovered files in the ArtifactService automatically.
Return the list of saved artifact filenames back to the agent in the tool result dictionary, e.g. "saved_artifacts": ["output_report.pdf"].
Complexity: Low to Medium. Minimal risk of side-effects since it operates completely inside the closed sandbox execution wrapper block.
I'd like to take this — implementing automatic artifact capture for files generated by skill scripts (walk/diff the script tempdir after execution, save_artifact via tool_context, return saved_artifacts in the tool result).
Following the bot analysis path in _build_wrapper_code / RunSkillScriptTool. Will open a PR shortly.
Implementation follows the bot analysis: walk/diff the script tempdir after execution, persist new files via tool_context.save_artifact, and return saved_artifacts in the tool result.
Activity
klateefa commentedon May 4, 2026
@henrywang0314 Thanks for the update. The request is currently being reviewed, and I will let you know if anything further is needed. Thank you for your understanding.
rohityan commentedon Jun 5, 2026
/adk-issue-analyze
adk-bot commentedon Jun 5, 2026
GitHub Issue #5579 Analysis: Support automatic artifact storage for files generated by skill toolset scripts
Executive Summary
tempfile.TemporaryDirectorythat is discarded upon completion. There is no automatic detection or retention of these files.Detailed Analysis
1. Root Cause Analysis ("What is broken?")
When an agent invokes a skill script via the RunSkillScriptTool.run_async method, it utilizes an internal helper class _SkillScriptCodeExecutor to serialize and execute the workspace script using the underlying code executor (e.g., local, container, or VM-based sandbox).
The execution flow decomposes as follows:
td.with tempfile.TemporaryDirectory() as td:context block is exited. This recursively wipes the temporary directory, purging all newly written documents, reports, or visual assets before they can be captured.2. Existing Pull Requests ("Is there a linked PR that fixes this issue?")
5579or containing relevant keywords ("artifact extraction", "skill outputs") confirms no corresponding PR or branch has been submitted to resolve this issue yet.3. Recommendation
tdafter tool execution._files).tool_contexttoexecute_script_async, allowing it to callawait tool_context.save_artifact(...)to persist the discovered files in the ArtifactService automatically."saved_artifacts": ["output_report.pdf"].a2105z commentedon Aug 11, 2026
I'd like to take this — implementing automatic artifact capture for files generated by skill scripts (walk/diff the script tempdir after execution,
save_artifactviatool_context, returnsaved_artifactsin the tool result).Following the bot analysis path in
_build_wrapper_code/RunSkillScriptTool. Will open a PR shortly.a2105z commentedon Aug 11, 2026
Opened a fix in #6675
Implementation follows the bot analysis: walk/diff the script tempdir after execution, persist new files via
tool_context.save_artifact, and returnsaved_artifactsin the tool result.cc @klateefa @GWeale @DeanChensj
feat(tools): Persist skill-script outputs as artifacts
feat: persist skill-script outputs as artifacts