撐得過後續 Claude 呼叫的 Claude Webhook。

Anthropic 透過 Webhook 把 agent 的結果送給你。你想把它再丟進另一次 Claude 呼叫,做格式化、評分或分流。這又多了 30 秒。AnyHook 接住這段落差。

時限問題

Claude Managed Agents 的 Webhook 最多嘗試傳遞三次,每次以退避方式間隔 5 到 120 秒。最後一次失敗後,事件就會被丟棄,沒有任何訊號告訴你它遺失了。

拿到 agent 的結果,最自然的做法就是丟進另一次 Claude 呼叫:摘要執行過程、分類輸出、決定要不要升級處理。第二次呼叫又要 20–40 秒。你還沒做出任何有用的事,就已經超出 SLA 了。

3
Anthropic 丟棄事件前的傳遞嘗試次數
30 秒以上
用來摘要/分類的第二次 Claude 呼叫
5–120 秒
Anthropic 三次嘗試之間的退避時間
0
處理程式需要的程式碼修改

換一個網址,Claude 流程維持不變

AnyHook 大約 1 秒就回應 Anthropic,再把事件傳遞到你的端點,附上原本的 Anthropic-Signature,以及重新簽章的 AnyHook-Signature。

// In your Anthropic dashboard, set the webhook URL to:
//    https://in.anyhook.net/{user-slug}/{app-slug}
//
// Your handler is now free to run a follow-up Claude call.

import Anthropic from "@anthropic-ai/sdk";
import { verifyWebhook } from "anyhook-verify";

const anthropic = new Anthropic();

export async function POST(req: Request) {
  if (!(await verifyWebhook(req, process.env.ANYHOOK_SIGNING_SECRET!))) {
    return new Response("invalid", { status: 401 });
  }

  const { agent_result } = await req.json();

  // Free to take 30+ seconds. Anthropic already saw 200.
  const summary = await anthropic.messages.create({
    model: "claude-opus-4-7",
    max_tokens: 800,
    messages: [{ role: "user", content: `Summarise: ${agent_result}` }],
  });

  await persistSummary(summary);
  return new Response("ok", { status: 200 });
}

團隊常問的問題

AnyHook 怎麼驗證 Anthropic 的簽章?
在邊緣節點不驗證:Anthropic 的機制不在 AnyHook 檢查的清單裡(清單見文件)。原本的簽章標頭會原封不動地轉送,所以你的伺服器可以在第一次傳遞時保留自己的檢查,而每次傳遞上的 AnyHook-Signature 則證明它經過 AnyHook。
Claude Managed Agents 的 Webhook 會計入我的 Anthropic 用量限制嗎?
Anthropic 只會把每個事件傳遞給 AnyHook 一次(如果 AnyHook 本身沒有確認收到,則依 Anthropic 一般的重試政策處理)。之後,所有往你端點的下游重試都由 AnyHook 處理。處理程式慢,不會對 Anthropic 造成壓力。
事後還能看到原始的 Claude payload 嗎?
可以。每個事件都以加密方式儲存,依方案可重播 3、30 或 90 天;之後 Pro 與 Scale 方案還會保存唯讀封存 1 或 7 年。你可以檢視原始 payload,或重播到你的端點。

換一個網址。Anthropic 的處理程式不用改。

Free 方案每月涵蓋 10,000 個事件。不用 SDK:把 Anthropic 指向你的 AnyHook 接收網址。