---
title: "Publisher | EventWolf SDK"
description: "Publish events from your server without waiting for each send, and learn how the EventWolf SDK's publisher batches, retries, and reports them."
url: "https://agentpost.tools/docs/eventwolf/sdk/publisher"
kind: sdk
---

# Publisher

`createPublisher({ client, source })` publishes events in the background over a client made with your project’s secret key. Use it when your code shouldn’t wait for each send, such as inside a request handler. To wait for the answer to each publish, call `client.events.publish` instead, as the [EventWolf SDK](/docs/eventwolf/sdk.md#create-a-client) overview shows.

## Publish

`publish(event)` fills in `id`, `source`, and `time` before the first attempt and batches the events that arrive together. It returns a receipt, whose `settled` promise reports how the send ended.

## Retries

The publisher retries a transient failure with the same event IDs, so EventWolf answers `duplicate` for an event it already stored and never stores it twice. It waits 1, 2, 4, 8, 16, and 32 seconds, then one minute before each of 14 more attempts, which spans 15 minutes. Pass `retryDelaysMs` to set your own waits.

The publisher holds up to 1,000 events in memory while it retries; pass `maxHeldEvents` to change that. `settled` reports when the queue filled or the retries ran out. A restart drops the held events.

## Before a script exits

Call `await publisher.flush()` to wait for the held events to settle.
