跳到正文
Skillpedia
写作7.8k · #13032

fallback-doc-with-delegation

它能做什么

这项技能指导智能体在数据工具失败后制作文档。适合需要完成文档的人,无论是带格式的 PDF,还是纯文本或 markdown 文件。

适用场景

  • ✓当 PDF 读取或网络搜索失败,但文档仍必须生成的时候。
  • ✓当文档是带格式的复杂类型,例如排版好的 PDF 时。
  • ✓当文档是简单的文本或 markdown,可以直接写入的时候。

技能链接

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/write-file-fallback-report-enhanced/SKILL.md

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“我的 PDF 阅读器和网络搜索都失败了。请仍然制作摘要文档,如果可以的话,做成排版好的 PDF。”

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

工作原理

智能体根据复杂程度选择方法。对于带格式的文档,它会把明确的任务交给 shell 智能体;对于简单的文本或 markdown,它直接用文件写入工具写文件。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Fallback Document Generation with Delegation

When to Use This Skill

Use this workflow when attempting to generate a document or report, but multiple primary data source tools fail simultaneously:

  • read_file returns binary/image data instead of text (common with PDFs)
  • search_web returns errors or no results
  • execute_code_sandbox fails unexpectedly
  • Other data retrieval tools are unavailable

Key insight: Rather than getting stuck on failed data retrieval, pivot immediately to generating the document using the most appropriate available method—either shell_agent for complex formats or write_file for simple text.

Step-by-Step Instructions

Step 1: Detect Tool Failure Pattern

Recognize when you're in a fallback scenario:

TOOL_FAILURE_INDICATORS = [
    "read_file returns binary or image data",
    "search_web returns unknown error or empty results",
    "execute_code_sandbox fails repeatedly",
    "Multiple consecutive tool failures on data retrieval"
]

Decision point: If 2+ indicators are present, proceed to Step 2.

Step 2: Choose the Appropriate Fallback Method

Critical Decision: Select between shell_agent and write_file based on document complexity:

Use shell_agent when... Use write_file when...
Generating PDFs or formatted documents Creating simple markdown/text files
Complex layout or styling needed Plain structured content is sufficient
External libraries required (reportlab, pandoc) No special formatting libraries needed
Multi-step generation process Single-pass content generation
Verification/validation needed Direct file creation is adequate

Decision Tree:

Is the output a PDF or complex formatted document?
├── YES → Use shell_agent (delegates to skilled agent)
└── NO → Is it markdown or plain text?
    ├── YES → Use write_file (direct content generation)
    └── NO → Use shell_agent (handles uncertainty)

Step 3A: Execute with shell_agent (Complex Documents)

For PDFs and complex formatting:

# Delegate to shell_agent with clear task description
shell_agent(
    task="Generate a professional [document type] about [topic]. "
         "Use appropriate libraries (e.g., reportlab for PDFs). "
         "Include: [list key sections/requirements]. "
         "Save to working directory as [filename]."
)

Advantages of shell_agent:

  • Agent autonomously handles library selection and usage
  • Automatically retries and fixes errors
  • Can use multiple tools internally (run_shell, execute_code_sandbox)
  • Validates output before completion

Example:

shell_agent(
    task="Create a 1-page SBAR (Situation-Background-Assessment-Recommendation) "
         "template PDF with 4 sections. Each section should have guiding points "
         "and blank lined spaces for user input. Use reportlab library. "
         "Save as SBAR_template.pdf in current directory."
)

Step 3B: Execute with write_file (Simple Documents)

For markdown and plain text:

# Generate content with embedded domain knowledge
report_content = f"""# [Document Title]

## Executive Summary
[Brief overview of key findings/content]

## Background
[Context and scope - use embedded knowledge]

## Main Content
[Organized sections with headers, lists, tables as appropriate]

## Limitations & Notes
[Transparent about data source limitations if relevant]

## Recommendations/Next Steps
[Actionable guidance based on available information]
"""

write_file(path="output/report.md", content=report_content)

Step 4: Structure Content Professionally

Regardless of method, ensure professional organization:

# [Document Title]

## Executive Summary
[Brief overview of key findings/content]

## Background
[Context and scope - use embedded knowledge]

## Main Content
[Organized sections with headers, lists, tables as appropriate]

## Limitations & Notes
[Transparent about data source limitations if relevant]

## Recommendations/Next Steps
[Actionable guidance based on available information]

Step 5: Leverage Embedded Domain Knowledge

When external data is unavailable:

  • Use general domain knowledge appropriately
  • Clearly distinguish between verified facts and general guidance
  • Include actionable frameworks rather than specific unverified data
  • Add placeholder notes where specific data would enhance the document

Examp

常见问题

智能体何时使用 shell 智能体?

技能要求在制作 PDF 和其他带格式的文档时使用它。

什么时候普通文件就够了?

技能指出,简单的文本或 markdown 可以直接用文件写入工具写入。

它还需要失败的数据吗?

技能要求转而专注于制作文档,而不是停留在失败的检索上。

详情

作者的原始描述

Generate professional documents after tool failures using shell_agent for complex formats or write_file for simple text/markdown

repo: HKUDS/AgentPilot

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能