Skip to main content
This page explains agents. After you read it, you can create an agent, wait until it is ready, change it, and delete it. You also understand what the agent’s memory is and what it is not. An agent is one memory with a purpose. You create it once. It exists until you delete it.

Create an agent

Send POST /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.
The table below lists every field you can send.

What happens after you send the request

  1. Priors reserves an agent_id and returns status 202. The agent’s status is initializing.
  2. Priors prepares the agent’s memory in the background.
  3. After a few seconds, status becomes ready. Now you can create threads.
Your organization owns every agent your key creates, not any one person. Every key your organization holds reaches it alike.

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. observe returns 202 before the memory exists. Poll the status until it is committed, 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.