Create an agent
SendPOST /v1/agents with a role and an objective. The role says who the agent is. The objective says what the agent must remember and why.
What happens after you send the request
- Priors reserves an
agent_idand returns status202. The agent’sstatusisinitializing. - Priors prepares the agent’s memory in the background.
- After a few seconds,
statusbecomesready. Now you can create threads.
The success response
expires_at is always null today, because agents do not expire.
To know when the agent is ready, call GET /v1/agents/{agent_id} every second until status is ready.
Errors
The table below lists the errors this call can return.401 and 503 service_unavailable can happen on any call; see Errors.
The agent status
An agent is always in one of the states below.
A call that needs a working agent returns
409 agent_not_ready while the agent is initializing or failed.
How the memory works
You never read or write memories directly. You send observations. The agent decides what to keep. From each observation, the agent writes one or more memories. A memory is one short fact. It has the text of the fact and the time the fact refers to. The agent keeps every memory it writes. When you ask a question, the agent searches its memories for the ones that relate to the question. Then it uses those memories to answer. Three rules follow:- Memory belongs to the agent, not to a thread. A fact learned in one thread is available in every thread of the same agent.
- Learning happens after the response.
observereturns202before the memory exists. Poll the status until it iscommitted, then ask. - Memory is permanent. It exists until you delete the agent.
Read, change, and delete an agent
The table below lists the other calls on an agent.
One rule applies to
PATCH: agent_config replaces the whole object. Send role, objective, and metadata together. A field you leave out is cleared.
Deletion cannot be undone. The memory is not touched by PATCH.
Activity history
GET /v1/agents/{agent_id}/logs returns who used the agent, in which thread, and when. It never returns the text of a message. Only the owner can read it. Use limit and cursor to read it page by page.