Skip to content

Conversation

@supreme-gg-gg
Copy link
Contributor

@supreme-gg-gg supreme-gg-gg commented Oct 29, 2025

This PR expands features from #1062 and integrates with #1077.

  • Wrap bash commands with Anthropic Sandbox Runtime ("srt") to replace manually handling security
  • Creates working directory for agent based on session id, where skills/ is symlinked to the /skills loaded into the container or any other customised skills base path. This directory is where all commands are run, python imports from skills are handled by modifying the PYTHONPATH env variable
  • Added write, read, edit file tools to help the agent perform better at simple coding tasks when skill requires them
  • The following enhancement to artifact related utils
    • Tool to "stage" artifact from the storage to working directory so the agent can perform action on them
    • Tool to "return" output artifacts from working directory to the storage so the client can download later
    • Currently, working with artifacts require custom Runner loop (run locally) due to frontend limitations

Testing

Features in this PR will work to the full capacity of the examples listed in #1062, this includes everything from accessing skills to writing code, managing dependencies, and creating files / images, subject to the limitations below.

Limitations

  • This only works locally, to work in BYO or any other environment we need to install srt + setup .srt-config.json properly, for local testing just adding pypi.org to allowed network

@supreme-gg-gg supreme-gg-gg changed the title (feat) Use Sandbox Runtime for Bash tool and refactor artifact utils tools feat: Use Sandbox Runtime for Bash tool and refactor artifact utils tools Oct 29, 2025
@supreme-gg-gg supreme-gg-gg marked this pull request as ready for review October 30, 2025 20:10
Copilot AI review requested due to automatic review settings October 30, 2025 20:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the skills system architecture to separate file operations and bash execution into dedicated tools, enabling more granular control and better separation of concerns. The changes also introduce centralized session path management and an artifacts toolset for managing file uploads and downloads.

  • Introduced dedicated file operation tools (ReadFileTool, WriteFileTool, EditFileTool) separate from bash execution
  • Moved BashTool from skills to a shared tools module and updated it to use Anthropic Sandbox Runtime
  • Centralized session path management with caching via new session_path module
  • Created ArtifactsToolset to manage file upload/download lifecycle independently from skills

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
python/packages/kagent-adk/src/kagent/adk/tools/file_tools.py New file operation tools for reading, writing, and editing files with line numbers and precise string replacement
python/packages/kagent-adk/src/kagent/adk/tools/bash_tool.py Relocated and refactored bash tool to use Anthropic Sandbox Runtime with improved sandboxing
python/packages/kagent-adk/src/kagent/adk/tools/init.py New tools module exporting file and bash tools
python/packages/kagent-adk/src/kagent/adk/skills/skills_toolset.py Updated to include new file operation tools alongside bash and skills tools
python/packages/kagent-adk/src/kagent/adk/skills/skills_plugin.py Enhanced to initialize session paths and register all tools via plugin hooks
python/packages/kagent-adk/src/kagent/adk/skills/skill_tool.py Minor documentation update for script location guidance
python/packages/kagent-adk/src/kagent/adk/skills/skill_system_prompt.py Removed legacy system prompt generation (functionality replaced)
python/packages/kagent-adk/src/kagent/adk/skills/bash_tool.py Removed old bash tool implementation (replaced by tools/bash_tool.py)
python/packages/kagent-adk/src/kagent/adk/skills/init.py Updated exports to reflect module reorganization
python/packages/kagent-adk/src/kagent/adk/skills/README.md Comprehensive documentation updates explaining new architecture and workflow
python/packages/kagent-adk/src/kagent/adk/artifacts/stage_artifacts_tool.py Refactored to use centralized session path management and improved file handling
python/packages/kagent-adk/src/kagent/adk/artifacts/session_path.py New centralized session path initialization and caching system
python/packages/kagent-adk/src/kagent/adk/artifacts/return_artifacts_tool.py New tool for uploading generated files back to artifact service
python/packages/kagent-adk/src/kagent/adk/artifacts/artifacts_toolset.py New toolset bundling stage and return artifact tools
python/packages/kagent-adk/src/kagent/adk/artifacts/init.py Updated exports to include new artifact tools and session path functions
python/packages/kagent-adk/src/kagent/adk/_a2a.py Added import for InMemoryArtifactService

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Jet Chiang <jetjiang.ez@gmail.com>
Signed-off-by: Jet Chiang <jetjiang.ez@gmail.com>
Signed-off-by: Jet Chiang <jetjiang.ez@gmail.com>
Signed-off-by: Jet Chiang <jetjiang.ez@gmail.com>
Signed-off-by: Jet Chiang <jetjiang.ez@gmail.com>
Signed-off-by: Jet Chiang <jetjiang.ez@gmail.com>
Signed-off-by: Jet Chiang <jetjiang.ez@gmail.com>
Signed-off-by: Jet Chiang <jetjiang.ez@gmail.com>
Signed-off-by: Jet Chiang <jetjiang.ez@gmail.com>
Signed-off-by: Jet Chiang <jetjiang.ez@gmail.com>
add_skills_tool_to_agent(skills_directory, root_agent)
plugins = [SkillsPlugin(skills_directory=skills_directory)]

kagent_app = KAgentApp(root_agent, agent_card, app_cfg.url, app_cfg.app_name)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this to use plugin instead of directly adding tools because it handles creating temporary session paths as well

@EItanya EItanya merged commit 00e0082 into kagent-dev:main Nov 3, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants