web-tool-fallback
它能做什么
这项技能指导智能体在其网页读取和搜索工具同时失败时,采取备用步骤。适合仍需要从网络获取信息才能完成任务的人。
适用场景
- ✓当页面读取工具和搜索工具同时因不明错误而失败的时候。
- ✓当任务完成仍然需要这些信息的时候。
- ✓当页面地址可能以其他形式生效时,例如存档版或备用版本。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/web-tool-fallback/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“页面读取工具和搜索在这个网站上都失败了。请尝试该地址的其他版本,例如存档,并告诉我你找到了什么。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体首先尝试替代来源,例如存档副本、其他域名,以及更简单的地址版本。如果这些也失败,它会切换到备用的 shell 方法来获取数据。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Web Tool Fallback Strategy
When to Use This Skill
Apply this skill when all web-reading tools (read_webpage, search_web) fail simultaneously with unknown errors during a research or information-gathering task.
Recognition Criteria
Confirm this pattern before applying fallbacks:
- Multiple web tool calls have failed (not just one isolated failure)
- Errors are unknown/unexpected (not expected 404s or rate limits that can be handled normally)
- The information is still needed to complete the task
Fallback Procedure
Critical: execute_code_sandbox may also fail during system-wide issues. Always be prepared to immediately fall back to run_shell if sandbox execution returns errors.
Step 1: Attempt Alternative Sources
Before abandoning web access, try these alternatives:
Alternative URLs:
- Archive.org / Wayback Machine versions
- Alternative domains (e.g., .org instead of .com)
- Different subdomains or paths
Simplified Requests:
- Try reading just the domain root
- Remove query parameters from URLs
- Try HTTP instead of HTTPS (or vice versa)
# Example: Generate alternative URL formats
original_url = "https://example.com/research/report?id=123"
alternatives = [
"https://example.com/research/report",
"http://example.com/research/report?id=123",
"https://web.archive.org/web/*/https://example.com/research/report"
]
Step 2: Use execute_code_sandbox for Embedded Knowledge
Step 2: Use execute_code_sandbox for Embedded Knowledge (May Fail)
When web access is unavailable, generate content from reliable embedded knowledge. Note: execute_code_sandbox can fail during cascading system issues—if it returns errors, immediately proceed to Step 2b.
code = '''
# Generate structured information from embedded knowledge
evaluation_frameworks = {
"Kirkpatrick Model": ["Reaction", "Learning", "Behavior", "Results"],
"Bloom's Taxonomy": ["Remember", "Understand", "Apply", "Analyze", "Evaluate", "Create"],
"SMART Criteria": ["Specific", "Measurable", "Achievable", "Relevant", "Time-bound"]
}
# Create comprehensive reference material
for framework, levels in evaluation_frameworks.items():
print(f"## {framework}\\n")
for i, level in enumerate(levels, 1):
print(f"{i}. {level}")
print()
'''
If execute_code_sandbox returns any error (unknown error, timeout, execution failure):
- Do not retry execute_code_sandbox multiple times
- Immediately proceed to Step 2b (run_shell fallback)
- Document the sandbox failure in your Research Access Notes
- Established frameworks and methodologies
- Standard best practices
- Well-documented technical concepts
- Historical information that doesn't change frequently
### Step 2b: Fall Back to run_shell if execute_code_sandbox Fails
### Step 2b: Fall Back to run_shell if execute_code_sandbox Fails (REQUIRED)
**When to use**: execute_code_sandbox returns any error OR fails to produce output within reasonable time.
**Action**: Immediately switch to run_shell with direct Python execution. Do not continue attempting execute_code_sandbox.
1. **Use run_shell with direct Python execution** (simplest, most reliable):
1. **Use run_shell with direct Python execution**:
```bash
python3 -c "print('content from embedded knowledge')"
Use heredoc for multi-line scripts:
python3 << 'EOF' # Your Python code here frameworks = {"Kirkpatrick": ["Reaction", "Learning", "Behavior", "Results"]} for name, levels in frameworks.items(): print(f"## {name}") for level in levels: print(f"- {level}") EOFCapture output to file for further processing:
python3 -c "print('structured content')" > output.txt
Why run_shell works when execute_code_sandbox fails:
- Direct system Python execution bypasses sandbox restrictions
- No additional abstraction layer that could fail
- More reliable during cascading tool failures
- Should be your go-to when sandbox is compromised
Step 3: Create Document with Placeholder Citations
For tasks requiring formal documentation:
- Draft the document using available knowledge
- Mark uncertain citations clearly:
[WEB_ACCESS_LIMITED: URL https://example.com/source could not be accessed] - Use placeholder format for references:
[Reference needed: Topic - URL attempted but inaccessibl
常见问题
会尝试哪些替代地址?
技能建议使用存档副本、替代域名、不带查询参数的简化网址,以及在 http 和 https 之间切换。
如果沙箱也失败了怎么办?
技能要求,当沙箱执行返回错误时,转而使用 shell 运行工具。
智能体会说明它没能获取什么吗?
技能的目标是完成任务,因此智能体应当注明它无法获取的任何数据。
详情
作者的原始描述
Implement fallback strategies when web-reading tools fail simultaneously
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #13027
- 许可证
- 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帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。