Skip to main content
This walkthrough takes you through the whole lifecycle in six calls. Each step shows the request, the success response, and what to do if the call fails. You need a signed-in Priors session. See Authentication. The table below is the plan.

Step 1: create the agent

Success: status 202. You are now the owner.
If it fails:
  • 400 invalid_request: agent_config is missing role or objective. Add them.
  • 409 agent_quota_exceeded: you already own 20 agents. Delete one you no longer use.

Step 2: wait until the agent is ready

Success: status 200 with "status": "ready". This usually takes a few seconds. Call again every second until you see it. If it is not ready:
  • "status": "initializing" for more than a minute: keep calling. The agent is still being prepared. After 10 minutes, the status becomes failed.
  • "status": "failed": delete the agent and create a new one.
  • 404 agent_not_found: the id is wrong, or the agent belongs to another organization.

Step 3: create a thread

Success: status 201.
If it fails:
  • 409 agent_not_ready: you did not wait for step 2. Poll the agent until its status is ready.
  • 429 rate_limit_exceeded: more than 5 threads in 10 seconds. Wait Retry-After seconds.

Step 4: teach the agent

Success: status 202. Nothing is learned yet.
If it fails:
  • 400 invalid_request: a content list is empty, or a block is not {"type": "text", ...}.
  • 404 thread_not_found: the thread id is wrong, or the thread belongs to another account.

Step 5: wait until the facts are learned

Success: status 200 with "status": "committed".
If it is not done:
  • queued or processing: call again in one second.
  • failed: read error. Correct the observation and send it again.
  • interrupted: a Priors restart paused it. It resumes by itself. Keep polling.

Step 6: ask a question

Success: status 200. The answer is in response_context.
used_memory_ids is not empty. That means the answer came from a memory, not from a guess. When it is empty, the agent had no related memory. If it fails:
  • 429 rate_limit_exceeded: more than 20 answers in one minute, or 2 answers already running. Wait Retry-After seconds.
  • 503 answer_model_unavailable: wait, then send the request again.

What this walkthrough showed

  • Creating an agent and learning both finish after the response. Poll, then continue.
  • The question in step 6 is now a memory too.
  • The thread is yours. The memory belongs to the agent. A second thread answers the same question in the same way.
Next: bring your own model, or teach from a document.