本文へスキップ
Skillpedia
分析とスプレッドシート7.8k · #12973

resilient-data-gathering

できること

このスキルは、複数のツールが続けて失敗するときの予備の方法をAIエージェントに与えます。通常のツールが応答しなくても、後で確認できる結果が必要な人向けです。

使う場面

  • ✓検索、ヘルパーエージェント、コードのサンドボックスのツールが、2〜3回の試行の後に全部失敗するとき。
  • ✓必要なデータが、すでに分かっているか、会話からおおよそ推定できるとき。
  • ✓中間結果を、後で確認したり回復したりできるように保存したいとき。

スキルのリンク

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/resilient-data-gathering/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/resilient-data-gathering/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“検索とコードのツールが失敗し続けています。私が伝えた製品価格を使って、スクリプトにまとめ、結果をJSONファイルに保存してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、すでに持っているデータを集め、シェルのPythonのスクリプトに入れ、各ステップをJSONファイルに保存します。これらのファイルがあるので、作業を監査でき、止まった所から再開できます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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:

  1. Trigger condition: 2-3 consecutive failures across multiple tools (search_web, shell_agent, execute_code_sandbox) with 'unknown error' messages
  2. You have domain knowledge: The required data is known or can be reasonably estimated from context
  3. 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_web returns errors or empty results
  • shell_agent fails to complete autonomous tasks
  • execute_code_sandbox throws '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
よくある質問

エージェントはいつこの方法に切り替えますか?

検索、ヘルパー、サンドボックスのツール全体で、2〜3回失敗した後だとスキルは述べています。

なぜデータをJSONファイルに保存するのですか?

保存されたファイルは結果を確認しやすくし、何かが失敗しても作業を再開できるようにするからです。

エージェントは足りない数字を作り出しますか?

スキルは、既知の、または妥当に推測されたデータに頼ります。使う前に、推定値は必ず確認してください。

詳細

作者による元の説明

Fallback pattern when primary tools fail - embed known data in scripts and persist to JSON for auditability

repo: HKUDS/AgentPilot

人気

GitHubのスター
7.8k
ランキング
#12973
ライセンス
MIT
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル