Gateway

What Is a Webhook (LLM)?

An outbound HTTP callback that sends LLM gateway events to external systems for alerts, reviews, analytics, or workflow automation.

What Is a Webhook (LLM)?

A webhook is an outbound HTTP callback that an LLM gateway sends when a production event occurs, such as a completed request, guardrail block, model fallback, evaluation failure, or cost alert. It belongs to the gateway family because it turns gateway-side events into signed payloads for downstream systems. In FutureAGI, webhooks connect Agent Command Center events to alerting, human review, analytics, ticketing, and workflow automation without forcing every service to poll the gateway.

Why it matters in production LLM/agent systems

Ignoring webhooks leaves production LLM events trapped inside the gateway until somebody opens a dashboard or a batch job polls for them. That delay matters when the event is a guardrail block on a high-value user, a fallback chain that exhausted all providers, or an evaluation failure on an agent action that created external side effects. The visible failure mode is usually not “no webhook.” It is a missed incident, stale moderation queue, delayed refund review, or support ticket that lacks the trace context needed to debug the model path.

Developers feel this when their application database says a task succeeded but the gateway trace shows a post-processing failure. SREs feel it as alert fatigue from polling jobs that report late or duplicate the same incident. Compliance teams feel it when blocked prompts, PII detections, and human-review decisions are not pushed into the audit system with event IDs and timestamps. Product teams see it as slow escalation loops: users report a bad answer before internal systems detect the risky trace.

Webhooks are especially important for 2026-era agent pipelines because one user goal can create many asynchronous events: retrieval, tool calls, model fallback, post-guardrail checks, and final response evaluation. Logs usually show scattered symptoms: high callback p99 latency, webhook retry queues growing, signature verification failures, duplicate deliveries, and traces missing the external ticket or review ID. A good webhook design makes the event lifecycle observable from gateway event to downstream action.

How FutureAGI handles webhooks

FutureAGI handles webhooks through Agent Command Center, using the specific FAGI surface gateway:webhooks. The surface is part of the gateway resource set alongside routing-policies, sessions, guardrails, alerts, logs, and models. In a production support agent, an engineer might subscribe an internal review service to events such as request.completed, guardrail.blocked, model_fallback.triggered, and eval.failed.

A practical route looks like this: traffic enters Agent Command Center, a routing policy: cost-optimized selects the first model, pre-guardrail checks the prompt, and the provider span records gen_ai.system, gen_ai.request.model, and llm.token_count.prompt. If a post-response JSONValidation check fails because the model returned malformed structured output, the gateway emits a signed webhook to a review endpoint with the route ID, trace ID, event type, delivery attempt, and timestamp. The application does not need a polling worker to discover the failure.

FutureAGI’s approach is to treat webhooks as part of the reliability path, not as a notification afterthought. The engineer can alert when webhook delivery success drops below target, route failed evals into a human annotation queue, or trigger model fallback regression checks when a provider starts producing more eval.failed events. Unlike a generic Zapier callback or a Portkey alert rule, Agent Command Center keeps the webhook tied to gateway routing, guardrails, traceAI spans, and evaluator output, so the receiver can act on the same trace the SRE and ML engineer inspect.

How to measure or detect it

Measure webhooks as delivery infrastructure plus LLM-event quality:

  • Delivery success rate - percentage of webhook events that receive a 2xx response before the retry budget ends.
  • Callback p99 latency - time from gateway event creation to successful downstream acknowledgement.
  • Retry queue age - oldest undelivered event by subscription; rising age means the receiver or network path is degraded.
  • Duplicate-event rate - repeated deliveries for the same event ID; receivers should be idempotent.
  • Signature failure rate - rejected callbacks because the receiver could not verify the gateway signature.
  • Triggering trace context - segment failures by gen_ai.system, gen_ai.request.model, and llm.token_count.prompt.
  • User-feedback proxy - escalation rate and thumbs-down rate on traces that created review or alert webhooks.

For structured-output workflows, pair webhook alerts with JSONValidation so the event fires from an actual schema failure, not a vague exception.

from fi.evals import JSONValidation

schema = {"type": "object", "required": ["answer", "citations"]}
result = JSONValidation(schema=schema).evaluate(output=model_output)
print(result)

The important detection question is whether the downstream system received an actionable event before the user or compliance queue noticed the problem.

Common mistakes

  • Treating delivery as exactly-once. Webhooks are usually at-least-once, so receivers need idempotency keys and replay-safe handlers.
  • Skipping signature verification. A webhook endpoint that accepts unsigned payloads becomes an easy path for fake alerts or workflow triggers.
  • Sending full prompts to every receiver. Route only the fields each downstream system needs, especially when traces may contain PII.
  • Retrying forever. Use bounded retries, dead-letter queues, and alerting when callback failures exceed the subscription budget.
  • Ignoring event versioning. Adding fields is easy; changing payload meaning without a version breaks analytics and incident automation.

Frequently Asked Questions

What is a webhook in an LLM gateway?

A webhook is an outbound HTTP callback that sends gateway events, such as request completion, guardrail blocks, fallbacks, or eval failures, to an external endpoint. It lets teams react to production LLM events without polling.

How is a webhook different from polling an API?

Polling asks the gateway for updates on a schedule. A webhook pushes a signed event to your endpoint when the event occurs, which is faster and cheaper for incident, review, and automation workflows.

How do you measure LLM webhooks?

Measure delivery success rate, retry queue age, callback p99 latency, duplicate-event rate, and trace fields such as gen_ai.request.model and llm.token_count.prompt on the triggering gateway request.