{
  "title": "AgentShield Workflow Examples",
  "description": "Copy-paste workflow patterns for AI agent integration",
  "workflows": [
    {
      "name": "Wallet Safety Check",
      "description": "Verify a contract before any token approval or swap",
      "steps": [
        {
          "step": 1,
          "action": "Agent receives transaction request involving contract 0xABC..."
        },
        {
          "step": 2,
          "action": "GET /verify?contract=0xABC...&chain=ethereum"
        },
        {
          "step": 3,
          "action": "Parse response: if safe=true and score>0.7, proceed"
        },
        {
          "step": 4,
          "action": "If safe=false or score<0.7, abort transaction and log risk"
        }
      ],
      "input": {
        "contract": "0xABC...",
        "chain": "ethereum"
      },
      "output": {
        "safe": true,
        "score": 0.95,
        "verdict": "APPROVED",
        "risk_level": "LOW",
        "flags": []
      }
    },
    {
      "name": "Signature Risk Scoring",
      "description": "Score risk before signing any on-chain message or approval",
      "steps": [
        {
          "step": 1,
          "action": "Agent is asked to sign approval for contract 0xDEF..."
        },
        {
          "step": 2,
          "action": "GET /deep-scan?contract=0xDEF...&chain=base"
        },
        {
          "step": 3,
          "action": "Check permission_analysis.unlimited_approval_risk"
        },
        {
          "step": 4,
          "action": "If unlimited_approval_risk=true, limit approval amount or reject"
        },
        {
          "step": 5,
          "action": "If risk_breakdown.overall_risk is HIGH or CRITICAL, reject signature"
        }
      ],
      "input": {
        "contract": "0xDEF...",
        "chain": "base"
      },
      "output": {
        "safe": false,
        "score": 0.3,
        "verdict": "UNKNOWN",
        "permission_analysis": {
          "unlimited_approval_risk": true
        },
        "risk_breakdown": {
          "overall_risk": "HIGH"
        }
      }
    },
    {
      "name": "Contract Anomaly Detection",
      "description": "Detect anomalous contracts in a multi-contract workflow",
      "steps": [
        {
          "step": 1,
          "action": "Agent plans a multi-step DeFi operation: swap → stake → claim"
        },
        {
          "step": 2,
          "action": "Batch verify all contracts: GET /verify for each address"
        },
        {
          "step": 3,
          "action": "Flag any contract with flags containing \"new_contract\" or \"unverified_source_code\""
        },
        {
          "step": 4,
          "action": "For flagged contracts, run GET /deep-scan for detailed analysis"
        },
        {
          "step": 5,
          "action": "If any contract scores below 0.5, abort the entire workflow"
        }
      ],
      "input": {
        "contracts": [
          "0x111...",
          "0x222...",
          "0x333..."
        ],
        "chain": "ethereum"
      },
      "output": {
        "results": [
          {
            "contract": "0x111...",
            "safe": true
          },
          {
            "contract": "0x222...",
            "safe": true
          },
          {
            "contract": "0x333...",
            "safe": false,
            "flags": [
              "new_contract"
            ]
          }
        ]
      }
    },
    {
      "name": "Pre-Transaction Verification",
      "description": "Full verification pipeline before executing a swap on a DEX",
      "steps": [
        {
          "step": 1,
          "action": "Agent identifies swap opportunity on DEX router 0xROUTER"
        },
        {
          "step": 2,
          "action": "GET /verify?contract=0xROUTER&chain=ethereum — verify the router"
        },
        {
          "step": 3,
          "action": "GET /verify?contract=0xTOKEN&chain=ethereum — verify the token contract"
        },
        {
          "step": 4,
          "action": "Check both responses: safe=true AND score>0.8 for both"
        },
        {
          "step": 5,
          "action": "If both pass, execute swap. If either fails, skip and log."
        },
        {
          "step": 6,
          "action": "POST /monitor with wallet address to watch for post-trade drain"
        }
      ],
      "input": {
        "router": "0xROUTER",
        "token": "0xTOKEN",
        "chain": "ethereum",
        "wallet": "0xYOUR_WALLET"
      },
      "output": {
        "router_safe": true,
        "token_safe": true,
        "monitoring_active": true
      }
    },
    {
      "name": "Continuous Wallet Monitoring",
      "description": "Set up ongoing drain detection for an autonomous agent wallet",
      "steps": [
        {
          "step": 1,
          "action": "POST /monitor with agent wallet address and alert threshold"
        },
        {
          "step": 2,
          "action": "AgentShield monitors wallet balance every block"
        },
        {
          "step": 3,
          "action": "If balance drops >20% unexpectedly, freeze event fires"
        },
        {
          "step": 4,
          "action": "GET /alerts?wallet=0x... to check for triggered alerts"
        },
        {
          "step": 5,
          "action": "POST /freeze to emergency-freeze all linked wallets if needed"
        }
      ],
      "input": {
        "wallet": "0xAGENT_WALLET",
        "threshold": 0.2
      },
      "output": {
        "monitoring": true,
        "alert_on": "balance_drop_20_pct",
        "freeze_ready": true
      }
    }
  ]
}