- Call
observe-and-recall(to learn the user’s message and fetch memories) orrecall(read-only, no learning). - Format the returned
memoriesinto your system prompt. - Call your own language model and return its reply.
- Optionally store your model’s reply with
observeif later turns must remember what your assistant committed to.
Before you start
Create an agent and a thread as in walkthrough 1. Remember the core rule: each agent’s memory is its own; everyone who talks to one agent shares what it learns. Give each customer their own agent if you learn from their messages. See A5. Bring your own model.Step 1: retrieve memories with observe-and-recall (or recall)
Use observe-and-recall when the agent should learn from this message (for example, a sales agent per prospect). Use recall when the agent must not learn from user messages (for example, an inbound support line answering from fixed manuals).
200. Memories arrive in the order the search found them. Each memory is the turn it was made from.
text: what was said, word for word.timestamp: when the turn was said (thetimestampsent with it, or else when Priors received it).speaker,speaker_id,metadata: who said it and themetadatayou stored on the turn.turn_id: the turn’s id, as the agent’s memory list shows it.observation_id: the learning of this message. Poll it with GET…/observe/. It isnullonrecall.
memories array is a normal 200 success for a new agent; let your model answer from the user message alone.
If it fails:
429 rate_limit_exceeded: waitRetry-Afterseconds (20 calls/min or 2 concurrent calls per subject).503 service_unavailable: retry with the sameIdempotency-Key, or fall back to answering without memory for that turn.
Step 2: inject memories into your prompt
Pass the dated memories in your system prompt, keeping each memory’s date and speaker visible so your model reasons cleanly when facts change over time:Step 3: optionally store your model’s reply
observe-and-recall learned the user’s message, not your model’s reply. If your assistant makes a promise, quotes a price, or confirms a booking that future turns must remember, send the reply with observe:
speaker to your assistant’s name so Priors keeps assistant commitments distinct from user statements.
Cost and concurrency notes
observe-and-recallbills input words (learning the user message) plus output words (the recalled memory text).recallbills output words only (no learning).- If one user message triggers multiple internal model calls on your backend, call Priors once and reuse the same
memorieslist across all of them.