跳到正文
Skillpedia
智能体7.8k · #12996

shell-agent-delegation

它能做什么

这项技能告诉 AI 智能体,在直接工具失败后,把困难的任务交给 shell 智能体。它适合需要完成文档或数据任务、又不需要逐步控制的人。

适用场景

  • ✓当代码沙箱、页面读取器或搜索工具返回未知错误的时候。
  • ✓当同一任务上接连多次直接工具尝试失败的时候。
  • ✓当文档或数据任务较复杂,需要多个步骤和库选择的时候。

技能链接

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/shell-agent-delegation/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/shell-agent-delegation/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请把一页的 SBAR 模板制作成 PDF。直接工具一直失败,请把整个任务交给 shell 智能体。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会写一份清晰、自成一体的任务描述,交给 shell 智能体。shell 智能体会决定使用 Python 还是 Bash,编写代码、运行它、检查输出并修复错误。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Shell Agent Delegation for Resilient Workflow Execution

When to Use This Skill

Apply this pattern when:

  • Direct tool execution (execute_code_sandbox, read_webpage, search_web) fails with 'unknown error'
  • Multiple tool attempts have failed in sequence
  • The task requires complex document generation or data processing
  • You need a tool that can autonomously select libraries and handle multi-step workflows

Why This Works

The shell_agent tool differs from direct execution tools in key ways:

  • Autonomous tool selection: Decides whether to use Python or Bash based on the task
  • Built-in error recovery: Automatically retries and fixes errors (up to several rounds)
  • Iterative execution: Writes code, executes, inspects output, and adapts
  • Full workflow ownership: Handles the entire task end-to-end without manual intervention

Step-by-Step Instructions

Step 1: Recognize the Failure Pattern

Identify when to pivot to shell_agent:

- execute_code_sandbox returned 'unknown error'
- read_webpage/search_web failed multiple times
- Direct approaches are struggling with the task complexity

Step 2: Formulate the Delegation Task

Create a clear, self-contained task description for shell_agent:

Good task description:

Create a 1-page SBAR Template PDF document. Include sections for:
- Situation: Brief description of the current situation
- Background: Relevant context and history
- Assessment: Current assessment and analysis
- Recommendation: Proposed actions and next steps
Use a professional layout with clear headings and adequate whitespace.

Key elements to include:

  • The end goal (what should be produced)
  • Required sections/components
  • Format requirements (PDF, DOCX, etc.)
  • Any style or layout preferences

Step 3: Execute the Delegation

Call shell_agent with your task description:

# Conceptual example
shell_agent(task="Create a professional SBAR Template PDF with Situation, Background, Assessment, and Recommendation sections. Include clear headings and professional formatting.")

Step 4: Monitor and Verify

After shell_agent completes:

  1. Check that the output file was created in the working directory
  2. Verify the content meets requirements
  3. If issues remain, provide refined instructions to shell_agent

Code Example

# When direct approaches fail:
# execute_code_sandbox(code="...")  # Returns 'unknown error'
# search_web(query="...")  # Returns 'unknown error'

# Pivot to shell_agent:
shell_agent(
    task="Generate a professional one-page template document in PDF format. "
         "Include clearly labeled sections with appropriate spacing and formatting. "
         "Select the most appropriate Python library for PDF generation.",
    timeout=300  # Allow time for iteration and error recovery
)

Best Practices

  1. Be specific about the output: Clearly describe what the final product should look like
  2. Trust the autonomy: Let shell_agent decide on libraries and implementation details
  3. Allow sufficient timeout: Set timeout to 300+ seconds for complex tasks requiring iteration
  4. One task at a time: Give shell_agent a complete, self-contained objective
  5. Don't micromanage: Avoid prescribing specific libraries or code unless necessary

Common Use Cases

  • Document generation (PDF, DOCX, reports, templates)
  • Data processing pipelines with multiple steps
  • Web scraping with fallback handling
  • Complex file manipulation tasks
  • Tasks requiring library discovery and selection

Anti-Patterns to Avoid

❌ Don't use shell_agent for simple, single-command tasks (use run_shell instead) ❌ Don't provide overly prescriptive code instructions (defeats the autonomous benefit) ❌ Don't set timeout too low (<60 seconds for complex tasks) ❌ Don't split a coherent task into multiple shell_agent calls unnecessarily

常见问题

一份好的任务描述包括什么?

这项技能要求用详细的平实语言描述目标、章节和内容,使 shell 智能体能够独立工作。

shell 智能体会自己选择工具吗?

会。它决定使用 Python 还是 Bash,以及使用哪些库。

它会尝试修复多少次?

这项技能说明它会自动重试多轮。

详情

作者的原始描述

Delegate complex tasks to shell_agent when direct tool execution fails, leveraging autonomous error recovery and library selection

repo: HKUDS/AgentPilot

热度

GitHub 星标
7.8k
排名
#12996
许可证
MIT
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能