resilient-data-gathering
Skill này làm gì
Skill này cho AI agent một phương án dự phòng khi nhiều công cụ cùng lỗi liên tiếp. Nó dành cho những người cần một kết quả có thể kiểm tra sau, ngay cả khi các công cụ thông thường không phản hồi.
Khi nào nên dùng
- ✓Khi công cụ tìm kiếm, agent hỗ trợ và sandbox mã đều thất bại sau hai hoặc ba lần thử.
- ✓Khi dữ liệu cần thiết đã biết hoặc có thể ước tính hợp lý từ cuộc trò chuyện.
- ✓Khi bạn cần lưu các kết quả trung gian để kiểm tra hoặc khôi phục sau này.
Liên kết skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/resilient-data-gathering/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Công cụ tìm kiếm và công cụ mã liên tục lỗi. Hãy dùng giá sản phẩm tôi đã đưa, cho vào một script và lưu kết quả vào file JSON.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent thu thập dữ liệu nó đã có, đưa vào một script Python trong shell và lưu từng bước vào file JSON. Những file này cho phép bạn kiểm tra công việc và tiếp tục từ chỗ dừng.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Resilient Data Gathering Workflow
Purpose
When search_web, shell_agent, and execute_code_sandbox all fail repeatedly with 'unknown error' or similar tool execution failures, fall back to embedding known domain data directly into run_shell Python scripts and persisting intermediate data to JSON files for auditability and recovery.
When to Use This Pattern
Apply this pattern when:
- Trigger condition: 2-3 consecutive failures across multiple tools (
search_web,shell_agent,execute_code_sandbox) with 'unknown error' messages - You have domain knowledge: The required data is known or can be reasonably estimated from context
- Auditability needed: Intermediate results must be preserved for verification or rollback
Step-by-Step Instructions
Step 1: Recognize Tool Failure Pattern
Monitor for repeated failures across multiple execution tools:
search_webreturns errors or empty resultsshell_agentfails to complete autonomous tasksexecute_code_sandboxthrows 'unknown error' repeatedly
Decision point: After 2-3 failures, switch to the fallback pattern rather than continuing to retry failing tools.
Step 2: Gather Known Domain Data
Collect all data you already know or can reasonably infer:
- Product specifications, prices, SKUs
- Competitor information from context
- Business rules and constraints
- Historical data from previous task phases
Document this data in a structured format before embedding.
Step 3: Embed Data in run_shell Python Script
Create a Python script that embeds the known data directly as literals or constants:
import json
import os
from datetime import datetime
# ============================================
# EMBEDDED DOMAIN DATA (known from context)
# ============================================
PRODUCT_DATA = {
"sku_001": {
"name": "Product A",
"competitor_price": 29.99,
"weight_oz": 12,
"category": "beverage"
},
"sku_002": {
"name": "Product B",
"competitor_price": 34.99,
"weight_oz": 16,
"category": "snack"
}
}
BUSINESS_RULES = {
"margin_target": 0.25,
"price_floor": 19.99,
"price_ceiling": 99.99
}
# ============================================
# ANALYSIS LOGIC
# ============================================
def analyze_products(products, rules):
results = {}
for sku, data in products.items():
price_per_oz = data["competitor_price"] / data["weight_oz"]
recommended_price = data["competitor_price"] * (1 + rules["margin_target"])
recommended_price = max(rules["price_floor"], min(rules["price_ceiling"], recommended_price))
results[sku] = {
**data,
"price_per_oz": round(price_per_oz, 2),
"recommended_price": round(recommended_price, 2),
"analysis_timestamp": datetime.now().isoformat()
}
return results
# Execute analysis
analysis_results = analyze_products(PRODUCT_DATA, BUSINESS_RULES)
# ============================================
# PERSIST INTERMEDIATE DATA (audit trail)
# ============================================
output_file = "intermediate_analysis.json"
with open(output_file, "w") as f:
json.dump({
"metadata": {
"generated_at": datetime.now().isoformat(),
"source": "embedded_domain_data",
"fallback_reason": "tool_execution_failures"
},
"results": analysis_results
}, f, indent=2)
# Signal artifact location for downstream tools
print(f"ARTIFACT_PATH:{os.path.abspath(output_file)}")
# Output results for immediate consumption
print("\n=== ANALYSIS RESULTS ===")
print(json.dumps(analysis_results, indent=2))
Step 4: Execute via run_shell
Run the embedded script using run_shell:
python3 << 'EOF'
[paste the full script from Step 3]
EOF
Or save to a file first:
cat > analysis_script.py << 'SCRIPT'
[paste script content]
SCRIPT
python3 analysis_script.py
Step 5: Persist and Verify Intermediate Results
Ensure JSON files are created and contain valid data:
import json
# Verify persistence
with open("intermediate_analysis.json", "r") as f:
验证数据 = json.load(f)
assert "results" in 验证数据
assert "metadata" in 验证数据
print(f"✓ Persisted {len(验证数据['results'])} records")
Step 6: Chain Subsequent Operations
Use persisted JSON as input for downstream operations:
import json
Câu hỏi thường gặp
Khi nào agent chuyển sang cách này?
Skill yêu cầu chuyển sau hai hoặc ba lần thất bại qua các công cụ tìm kiếm, agent hỗ trợ và sandbox.
Tại sao lưu dữ liệu vào file JSON?
Các file đã lưu giúp kết quả dễ kiểm tra và cho phép tiếp tục nếu có sự cố.
Agent có thể bịa ra các con số còn thiếu không?
Skill dựa vào dữ liệu đã biết hoặc suy luận hợp lý, nên hãy kiểm tra mọi ước tính trước khi dùng.
Chi tiết
Mô tả gốc của tác giả
Fallback pattern when primary tools fail - embed known data in scripts and persist to JSON for auditability
repo: HKUDS/AgentPilot
Độ phổ biến
- Sao GitHub
- 7.8k
- Vị trí xếp hạng
- #12973
- Giấy phép
- MIT
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
agentpilot
7.8kGiúp agent của bạn cải thiện dự án từng bước bằng cách chuẩn bị tác vụ và chạy vòng lặp AgentPilot, gồm đề xuất, kiểm thử và chấm điểm thay đổi.
openspace
7.8kGiúp agent của bạn thiết lập OpenSpace, công cụ lưu và lấy lại skill của agent, rồi kết nối nó với ứng dụng AI của bạn qua MCP.
rsi-arena
7.8kGiúp agent của bạn thiết lập và chạy các bài kiểm thử benchmark AI chuẩn, như AIME và Terminal-Bench, để so sánh các phương pháp cải tiến khác nhau.
experiment-guide
7.8kGiúp agent của bạn lên kế hoạch các thí nghiệm nhỏ, đọc kết quả và ghi lại phát hiện khi tìm cách cải thiện một chương trình.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.