Skip to main content
This walkthrough takes you through the core v2 lifecycle in six calls. Every step shows the request, the success payload, and what to do if it fails. You need an API key: a personal key is the quickest way to try Priors. See Authentication. No organization yet? Start with Set up your organization.

Step 1: create the agent

Success: status 202. You are the owner. With no visibility in the request, the agent is public if you are an Org admin or a Project admin, and private otherwise.
If it fails:
  • 400 or 422 invalid_request: agent_config is missing role or objective, or one exceeds its length limit.
  • 409 agent_quota_exceeded: the organization holds 100 live agents. Delete an unused agent.

Step 2: wait until the agent is ready

Success: status 200 with "status": "ready". Poll once per second until it flips from initializing to ready (usually a few seconds). If it is not ready:
  • initializing for more than a minute: keep polling. After 10 minutes it moves to failed.
  • failed: delete the agent and create a new one.
  • 404 agent_not_found: check agent_id and your key.

Step 3: create a thread

Success: status 201. The thread is ready immediately.
If it fails:
  • 409 agent_not_ready: finish step 2 first.
  • 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; save observation_id.
If it fails:
  • 400 or 422 invalid_request: content is empty or speaker is missing (required with an API key).
  • 402 payment_required: organization has zero credits.
  • 404 thread_not_found: check agent_id and thread_id.

Step 5: wait until the facts are learned

Success: status 200 with "status": "committed".
If it is not done:
  • processing: poll again after Retry-After (or 1 second).
  • interrupted: a Priors restart paused it; keep polling as it resumes automatically.
  • failed: read error and learning, fix the input, and resend.

Step 6: ask a question

Success: status 200. The finished answer is in answer.
To ask the same question without learning from the question or reply, call POST…/respond instead of observe-and-respond. If it fails:
  • 429 rate_limit_exceeded: more than 20 answers in one minute or 2 concurrent answers. Wait Retry-After seconds.
  • 503 answer_model_unavailable: retry with the same Idempotency-Key.

What this walkthrough showed

  • Agent creation and observe both run asynchronously; poll until ready and committed.
  • observe-and-respond returns a finished answer (and learns the turn); respond answers without learning.
  • Memory belongs to the agent: opening a second thread answers the same question identically.
Next: 2. Bring your own model or 3. Teach from a document.