---
title: "EventWolf events"
description: "Learn what an EventWolf event holds, what EventWolf adds when it accepts one, when it is a duplicate, how imported history is kept and ordered, and why one is rejected."
url: "https://agentpost.tools/docs/eventwolf/concepts/events"
kind: concept
---

# Events

An event is one thing that happened in your product, such as a request assigned to someone, written as a [CloudEvent](https://cloudevents.io) 1.0 in JSON. Your server publishes it once; EventWolf keeps it in sequence order for as long as the config’s retention says, which is forever in Agentpost’s starting config. A stored event stays as published; [erasure](/docs/eventwolf/concepts/erasure.md) of personal fields is the one exception. An [event type](/docs/eventwolf/concepts/event-types.md) can check its data, a [filter](/docs/eventwolf/concepts/filters.md) finds it, and a [subscription](/docs/eventwolf/concepts/subscriptions.md) acts on it.

## The envelope

An event is a JSON object with these core attributes:

| Attribute | Required | What it holds |
| --- | --- | --- |
| `specversion` | Yes | `"1.0"`. |
| `source` | Yes | Where it came from, such as `/support/backend`: one of your services, without spaces. |
| `id` | No | Your ID for it, unique within its `source`. EventWolf makes one when you leave it out, but then a retry is a second event. |
| `type` | Yes | What happened, as dot-separated segments, such as `request.assigned`. |
| `subject` | No | What it is about, such as `r_9`. Written `type:id`, such as `request:r_9`, it is also a reference. |
| `time` | No | When it happened. Default: when EventWolf received it. |
| `datacontenttype` | No | A JSON media type. EventWolf stores `application/json`. |
| `dataschema` | No | Your schema identifier, up to 2,048 characters. If omitted, EventWolf adds it when it checks a registered schema. |
| `data` | No | The details, as JSON. |

Event data is JSON, in `data`; an event with `data_base64` answers [`invalid_envelope`](/docs/eventwolf/errors.md#invalid_envelope). Every other top-level attribute is an extension: a name of 1 to 20 lowercase letters and digits, with a string, number, or boolean value, such as `"severity": "high"`. EventWolf stores and delivers extensions as they are, except these, which it reads and stores as strings:

-   **`actor`:** who did it, written `type:id`, such as `user:u_ben`.
-   **`onbehalfof`:** the delegator, when the actor acted under a delegation, written `type:id`. [Who acted](/docs/platform/concepts/principals.md#who-acted) gives the rule.
-   **`refs`:** what else it is about, as space-separated `type:id` references, such as `request:r_9 user:u_ana`.
-   **`workspace`:** the workspace it belongs to, when the app groups its principals into workspaces. Reads and subscriptions can filter on it.
-   **`causationid`** and **`causationsource`:** the `id` and `source` of the event that caused it, which a timeline follows. **`correlationid`** groups the events of one flow.

## What EventWolf adds

An accepted event gets a `sequence`, its place in your project’s order, which only grows. Its record also holds when EventWolf received it, who published it in `publishedBy` (its `actor`, any `onBehalfOf`, and `via`, the channel it came through), its references, and the version of its type’s schema it was checked against. An imported event’s record adds `imported`, and an erased event’s `erased`. Deliveries carry the stored event with `sequence` added.

References come from `subject`, `actor`, `onbehalfof`, `refs`, and the data paths its type names in `refPaths`, each with its role: the attribute it came from, or `ref` for `refs` and a data path. A read with `ref=user:u_ana` finds every event about Ana, in any role.

## Duplicates

An event is known by its `source` and `id` within a project. Publishing one that EventWolf still holds answers `duplicate` and stores nothing, so a producer retries with the same `id` and never makes two. A retry passes the same checks as any publish, and its answer carries the first event’s `sequence` only when your credential may publish the stored event. Once retention removes the first event, the same `id` stores a new one. A rejected event isn’t stored, so publishing it again with the same `id` after a fix is accepted.

## Imported history

An import brings another system’s events into your project’s history, with their original occurrence and receipt times and where they came from. Each record has `publishedBy.via: "import"` and `imported: { batchId, origin, originalReceivedAt? }`, and takes a new sequence after the events already stored. An import entry that passes its checks deduplicates against stored events by `source` and `id`, just like a publish.

Import accepts unregistered types and data that fails today’s schema. It records when each type was seen, and takes references only from `subject`, `actor`, `onbehalfof`, and `refs`. Each entry needs its original `id`, and an event that carries a field of EventWolf’s record, such as `sequence`, `receivedAt`, or `projectId`, is rejected. The envelope rules and the data size limit still apply. A rejected entry is answered in the import’s results and recorded nowhere else.

Imported events are history only. Importing makes no matches, deliveries, notifications, or pushes, and the live tail leaves them out, then and on resume. A [replay](/docs/eventwolf/concepts/replays.md) can send imported events within its receipt-time range that match its webhook subscriptions.

[Import event history](/docs/eventwolf/guides/import-history.md) maps an export, imports it in batches, resumes it, and reads it back.

## History order

History follows sequence order by default, newest first. Sequence records when your project accepted an event, so imported history sits after the events stored before it, however old it is. Receipt-time order, `sort=receivedAt` on [List events](/docs/eventwolf/reference/events.md#list-events), puts imported history beside live events by `receivedAt`, with sequence breaking ties. Either order runs newest first, or oldest first with `order=asc`. The `from` and `to` bounds always filter on the event’s occurrence time, `time`.

A page’s `next` cursor belongs to its sort: pass it as `after` with the same sort, order, and filters. A cursor from the other sort answers [`invalid_request`](/docs/eventwolf/errors.md#invalid_request). The live tail always follows sequence, and `Last-Event-ID` resumes it after a sequence, never a receipt-time cursor.

## Several projects

Each project environment has its own history and sequence. A [workspace key](/docs/platform/concepts/workspace-keys.md) with `events:read` reads events and event types in its own workspace and environment, one adopted project per request, named in the `x-agentpost-project` header. Sequences from two histories don’t compare, so a tool that shows several together orders their events by `time` or `receivedAt`.

## Rejected events

A publish EventWolf rejects is stored as an ingestion failure instead, for 30 days in Agentpost’s starting config, with the code and the issues that rejected it and the first 4,096 bytes of what was sent. Its code says why:

-   [`invalid_envelope`](/docs/eventwolf/errors.md#invalid_envelope): the envelope breaks the rules above.
-   [`unknown_type`](/docs/eventwolf/errors.md#unknown_type): the type isn’t registered, and the config rejects unknown types.
-   [`invalid_data`](/docs/eventwolf/errors.md#invalid_data): the data doesn’t match the type’s schema.
-   [`data_too_large`](/docs/eventwolf/errors.md#data_too_large): the data is larger than the config allows.

A publish your credential may not make answers [`forbidden`](/docs/eventwolf/errors.md#forbidden) and records no failure. A recorded failure also publishes a `tools.agentpost.events.ingest.rejected` event, at most one per code each minute with a count of those it held back, so a subscription can tell you a producer broke.

## IdentityHound access history

When your project adopts IdentityHound too, Agentpost reads its change feed from a saved position in each environment and publishes those changes into EventWolf. The events keep `source: "/identityhound"`, types under `tools.agentpost.identity.`, and their original ID, time, and data. Agentpost adds `actor`, `onbehalfof`, and `workspace` when the change gives it the corresponding facts. [IdentityHound’s event history](/docs/identityhound/concepts/change-feed.md#event-history) explains ordering, the 30-day limit on backfill, actor references, and recovery from a rejection.

## EventWolf’s own events

EventWolf publishes its own facts into your project’s history, with `source: "/eventwolf"` and types under `tools.agentpost.events.`: a rejection, a delivery that ran out of retries (`delivery.exhausted`), an endpoint disabled or enabled, a test ping, a change to an endpoint, subscription, type, or the config, a replay started or completed, and a push address made invalid (`push_address.invalidated`). They hold no secrets and no response bodies, and a subscription can match them like any other event.

## Erasure

[Erasure](/docs/eventwolf/concepts/erasure.md) removes named personal fields from one stored event, clears affected references and the text of its notifications and pushes, and records who asked. Its page lists which copies you clear yourself.

## Limits

-   A batch, or an import, holds at most 100 events and 1 MB.
-   An event’s `data` is at most the config’s `ingest.maxDataBytes`, from 1,024 to 1,048,576 bytes. Agentpost starts projects at 65,536 bytes.
-   `data` nests at most 64 levels deep.
-   `id`, `type`, and `subject` are at most 500 characters, and `source` at most 2,048.
-   If retention removes events after your last sequence, the live tail resumes with the remaining matching events and gives no error about the missing history.

## Where to act on it

-   The [EventWolf quickstart](/docs/eventwolf/quickstart.md) publishes events, sees a duplicate and a rejection, and reads a history, and [Import event history](/docs/eventwolf/guides/import-history.md) brings in another system’s events.
-   The [SDK live tail](/docs/eventwolf/sdk/tail.md) reads matching events with `client.events.tail(input, handlers)` and resumes after disconnects.
-   [Publish an event](/docs/eventwolf/reference/events.md#publish-an-event), [Import event history](/docs/eventwolf/reference/events.md#import-event-history), [List events](/docs/eventwolf/reference/events.md#list-events), [Look up an event](/docs/eventwolf/reference/events.md#look-up-an-event), [Get an event timeline](/docs/eventwolf/reference/events.md#get-an-event-timeline), and [Stream events](/docs/eventwolf/reference/events.md#stream-events).
-   [List ingestion failures](/docs/eventwolf/reference/ingest-failures.md#list-ingestion-failures).
-   The [events reference](/docs/eventwolf/reference/events.md).
