What Priors does
Priors gives your product a memory. You send Priors the things that happen: messages, notes, documents. Priors turns them into memories. Later you ask a question, and Priors answers from those memories. You do not manage the memories yourself. You do three things:- Create an agent.
- Send the agent observations.
- Ask the agent questions.
Three words
The API uses three words on every page. Learn them here.
The most important rule follows from these words: a fact learned in one thread is available in every thread of the same agent. Threads keep conversations separate. Memory keeps facts together.
The five calls
The table below lists the calls that most products use. Each row says what the call does and what the response contains.Which answering call to use
Choose one of the three ways to ask an agent:- You have your own language model: use
observe-and-enrich. Priors gives you the memories. Your model writes the reply. - You want Priors to write the reply: use
observe-and-respond. - You build a chat screen and want the reply as it is written, with links to source files: use
chat/stream.
Two calls do not finish right away
Two calls return before the work is done. For these calls you poll: you callGET again every second until the status changes.
- After
POST /v1/agents, pollGET /v1/agents/{agent_id}untilstatusisready. - After
POST .../observe, pollGET .../observe/{observation_id}/statusuntilstatusiscommitted.
One agent for each of your customers
Give each customer their own agent. An agent has its own memory and its own storage, so nothing crosses between two of them. Keep your own record of whichagent_id belongs to which customer.
Inside one agent, send X-SP-End-User with your own identifier for the person a request acts for. That keeps one person’s conversations separate from another’s on the same agent, while the memory stays shared across the agent. See Call Priors from your backend.
Where to go next
The complete lifecycle
Every call in the order you use it. Each call shows the request, the success response, and every error with what to do.
Walkthrough 1: your first agent
The five calls above, one after another, with the responses.
Errors
Every error code, its cause, and what to do.
Call Priors from your backend
API keys, one agent per customer, and naming the person each request acts for.
Limits
Request rates, file sizes, images per message, agents per organization.
Credits
What a call costs and what happens when credits run out.
Terminology
Every word this documentation uses, defined once.