Data model
Long Sequence Feature: ordered history at scale.
Store long, ordered behavior histories per entity and serve them with tail reads, time windows, and filters — the input rankers, agents, and investigation tools need without scanning a warehouse at request time.
What it is
The last N events for an entity, in order, ready to read.
A Long Sequence Feature is a per-entity, event-time-ordered log the engine understands as a first-class object. Each entity — a user, device, merchant, or agent session — owns its own sequence, and the store keeps the recent tail hot.
Reads come in three shapes: a tail read for the most recent N events, a windowed slice over a time range or count, and either with filters on type, source, or dimension. Older events stay recoverable but out of the hot path.
Because the store keeps the recent tail warm and reconstructs full history from WAL plus snapshots, a tail read stays sub-millisecond even when the entity has millions of events behind it.
Sharded across millions of sparse entity keys; each key keeps its own ordered tail warm.
In practice
Append events, then read a recent slice.
ts.append(
table="user_events",
entity="user_42",
ts_ms=event.ts_ms,
attrs={"kind": "view", "item": "sku_812"},
)
seq = ts.sequence(
table="user_events",
entity="user_42",
last=50,
since="24h",
where={"kind": "view"},
)
When to use it
When you need recent-first history, not a warehouse scan.
Reach for a sequence whenever a request depends on what this entity did lately, in order. It replaces per-feature stream jobs and request-time warehouse queries with a single bounded, replay-friendly read.
| Use case | Sequence read | Why it fits |
|---|---|---|
| Ranking & recommendation | Last 200 interactions per user | Feeds a ranker the ordered behavior signal without a feature pipeline. |
| Agent tool history | Ordered tool calls per session | Backs Context Management with the exact action trail behind a decision. |
| Investigation trails | Windowed slice with filters | Reconstructs what happened, in order, after failover or migration. |
| Shopping & content journeys | Tail read since last session | Serves the recent path without scanning cold history. |
Related models