graceful-tool-failure
它能做什么
这项技能告诉 AI,当必需的工具持续失败时该怎么应对:列出失败的内容,并给出一个标注清楚的部分答案。适合需要在任务受阻时得到诚实状态说明的人。
适用场景
- ✓当 PDF 提取或网页搜索等必需工具已失败三次或以上时。
- ✓当同一目标的其他方法也已失败时。
- ✓当任务缺少被阻塞的能力、无法完整完成时。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/graceful-tool-failure/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我:PDF 工具一直处理不了我的文件,网页搜索也查不到内容。请告诉我哪些环节失败了,并给出最好的部分答案,同时清楚标明。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 先列出阻碍任务的问题以及失败的尝试,然后给出最好的部分输出,并标明其可信度和局限性。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Graceful Tool Failure Workflow
This skill guides agents on how to respond when critical tools (like PDF extraction, web search, data APIs) fail repeatedly and block task completion.
When to Apply This Skill
Use this pattern when:
- A core tool required for task completion has failed multiple times (3+ attempts with different approaches)
- Alternative approaches to achieve the same goal have also failed
- The task cannot be fully completed without the blocked capability
Step-by-Step Instructions
1. Explicitly Report Blocking Issues
Clearly document what failed and why:
## Blocking Issues
The following tools/approaches were attempted but failed:
1. **PDF Extraction (pdftotext)**: Command returned error - file appears corrupted or uses non-standard encoding
2. **PDF Extraction (PyMuPDF)**: Library could not parse document structure
3. **Web Search**: Search queries returned no relevant results for [specific topic]
These failures prevent completion of [specific deliverable].
2. Attempt Minimal Viable Output
Using available domain knowledge, create the best possible output with clear limitations:
## Partial Output (Based on Domain Knowledge)
*Note: The following content is derived from general domain knowledge rather than the requested source materials.*
[Insert best-effort content here]
**Confidence Level**: Low - content has not been verified against source documents
**Recommendation**: Verify all claims against original source materials when available
3. Avoid Claiming Success
Never state the task is complete when core deliverables are missing or unverified:
Incorrect:
"Task completed successfully."
Correct:
"Task partially completed. Core deliverable [X] could not be produced due to tool failures. Minimal viable output provided with disclaimers. Manual review or alternative data sources recommended."
4. Provide Actionable Next Steps
Suggest concrete actions for human operators or alternative approaches:
## Recommended Next Steps
1. Obtain the source document in an alternative format (e.g., request text version from document owner)
2. Manually extract key information from the PDF and provide as text input
3. Use alternative tools: [list specific tools or services]
4. Proceed with partial output acknowledging limitations: [describe what can still be accomplished]
Code Examples
Example: Python Script with Fallback Behavior
def extract_with_fallback(pdf_path):
"""Attempt PDF extraction with multiple methods, fail gracefully."""
methods = [
("pdftotext", lambda p: run_shell(f"pdftotext {p} -")),
("PyMuPDF", lambda p: extract_with_pymupdf(p)),
("pdfplumber", lambda p: extract_with_pdfplumber(p)),
]
failures = []
for method_name, method_func in methods:
try:
result = method_func(pdf_path)
if result:
return {"success": True, "content": result}
except Exception as e:
failures.append(f"{method_name}: {str(e)}")
# All methods failed - return graceful failure
return {
"success": False,
"failures": failures,
"message": "All extraction methods failed. Consider manual extraction or alternative source."
}
Example: Response Template for Failed Tasks
## Task Status: PARTIALLY COMPLETE
### What Was Accomplished
- [List completed subtasks]
### What Could Not Be Completed
- [Deliverable X]: Blocked by [specific tool failure]
- [Deliverable Y]: Requires source material that could not be accessed
### Blocking Issues Summary
| Tool/Method | Attempts | Error |
|-------------|----------|-------|
| Tool A | 3 | [error details] |
| Tool B | 2 | [error details] |
### Partial Output (With Disclaimers)
[Insert best-effort work product]
### Recommendations
1. [Action item 1]
2. [Action item 2]
Key Principles
- Transparency Over Optimism: Clearly state what failed rather than obscuring limitations
- Document Attempts: Record which approaches were tried to prevent redundant work
- Preserve Value: Even partial output is better than no output, if properly disclaimed
- Enable Handoff: Make it easy for a human or different system to pick up where you left off
- No False Claims: Never mark a task as "complete" when core requirements are unmet
Anti-Patterns to Avoid
- ❌ Silently skipping failed steps withou
常见问题
AI 会隐藏失败的情况吗?
不会。指南要求逐一列出每个失败的工具和方法。
部分输出如何标注?
指南要求注明它基于通用知识,并给出可信度等级。
什么时候适用?
在多次尝试失败、任务无法完整完成之后适用。
详情
作者的原始描述
Report tool failures transparently and attempt minimal viable output with disclaimers
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #12890
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
agentpilot
7.8k帮你的智能体准备任务并运行 AgentPilot 循环,逐步改进项目:循环会提出修改、测试修改并为其打分。
openspace
7.8k帮你的智能体设置 OpenSpace,这是一个用于存储和获取智能体技能的工具,并通过 MCP 将其连接到你的 AI 应用。
rsi-arena
7.8k帮你的智能体设置并运行标准 AI 基准测试,例如 AIME 和 Terminal-Bench,用来比较不同的改进方法。
experiment-guide
7.8k帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。