> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhook examples

> Push run.start, tool.call, and run.complete to HTTP, Slack, or your own handler.

# Webhook examples

Runnable file: [agentium-examples/webhooks/webhook-destinations.ts](https://github.com/agentiumOS/agentium-examples/blob/main/webhooks/webhook-destinations.ts).

Guide: [Webhooks](/webhooks/overview)

***

## 1. Console + HTTP

```typescript theme={null}
import { Agent, openai, httpWebhook, type WebhookDestination } from "@agentium/core";

function consoleWebhook(): WebhookDestination {
  return {
    name: "console",
    async send(event, payload) {
      const p = payload as Record<string, unknown>;
      console.log(event, p.agentName, p.runId);
    },
  };
}

const agent = new Agent({
  name: "assistant",
  model: openai("gpt-4o-mini"),
  instructions: "Be short.",
  webhooks: {
    destinations: [
      consoleWebhook(),
      // httpWebhook({ url: "https://example.com/events", secret: "my-secret" }),
    ],
    events: ["run.start", "run.complete", "run.error", "tool.call"],
  },
});

await agent.run("What is 2 + 2?");
```

Each listed event fires every destination. Use this for Slack alerts, audit logs, or a custom bus.
