Read the state
The payoff: one GET returns everything Tessera knows about a user's behavior, compressed into a vector and your label's score.
- curl
- Python SDK (planned)
08-read-state.sh
#!/usr/bin/env bash
# Quickstart step 8 — read a user's embedding and score from the serving API.
set -euo pipefail
: "${TESSERA_API_BASE:?e.g. https://api.staging.tessera.zone/v1}"
: "${TESSERA_API_KEY:?your tsk_test_… key}"
STATE="$(curl -sS "$TESSERA_API_BASE/slots/quickstart/entities/user/u_00001/state" \
-H "Authorization: Bearer $TESSERA_API_KEY")"
echo "$STATE" | python3 -m json.tool
# Every scored response is auditable: the embedding, the per-label scores,
# and the freshness block naming the exact model fingerprint and the last
# event the state incorporates.
printf '%s' "$STATE" | python3 -c '
import json, sys
state = json.load(sys.stdin)
freshness = state["freshness"]
print("embedding_dimension:", len(state["embedding"]))
print("score repeat_purchase_30d present:", "repeat_purchase_30d" in state["scores"])
print("model_fingerprint:", freshness["model_fingerprint"])
print("event_cursor timestamp:", freshness["event_cursor"]["timestamp"])
'
Download quickstart/08-read-state.sh — this exact file runs in CI on every change (hosts shown are for this environment).
08-read-state.py
"""Quickstart step 8 (planned Python SDK) — read one user's embedding and score."""
import os
from tessera import Tessera
client = Tessera(base_url=os.environ["TESSERA_API_BASE"])
state = client.api.get_slot_entity_state(slot="quickstart", entity_type="user", entity_id="u_00001")
embedding = state.embedding.root
assert isinstance(embedding, list)
print(f"embedding_dimension: {len(embedding)}")
print(f"score repeat_purchase_30d present: {'repeat_purchase_30d' in state.scores}")
# Every scored response is auditable (005 §7): who computed it, from what.
freshness = state.freshness
print(f"model_fingerprint: {freshness.model_fingerprint}")
print(f"bundle_id: {freshness.bundle_id}")
print(f"event_cursor timestamp: {freshness.event_cursor.timestamp.isoformat()}")
client.close()
Download quickstart-sdk/08-read-state.py — this exact file runs in CI on every change (hosts shown are for this environment).
The response has three parts:
embedding— the user's behavioral embedding (32 floats under the CI profile; 256 for stock tier S). Use it for lookalikes, clustering, or as features downstream.scores—{"repeat_purchase_30d": p}: the probability head you trained in step 6, keyed by the label you defined in step 4.freshness— the audit trail, on every scored response:model_fingerprintandbundle_id(exactly which bytes scored this),event_cursor(the last event this state incorporates),computed_at. From one served score you can walk back to the exact dataset, contract and policy that produced it.
Need many users at once? POST /slots/quickstart/scores:batch reads up to
1,000 entities in one call, and exports snapshot the
whole slot to Parquet or your warehouse.
Where to go next
- Connect your real data — warehouses, buckets, streams.
- Concepts — the mental model behind each step you just ran.
- Serve — slots, batch scoring, state reads, exports in depth.
- Label-free quickstart — what this flow looks like with zero labels.