observe. Once it reaches committed, every thread on that agent can answer from it and return downloadable citations.
Step 1: check limits before uploading
Default document limits enforced by Priors:- Maximum file size: 30 MiB (
413 document_too_largeabove this). - Maximum pieces per file: 20,000 (
413 document_too_many_turnsabove this). - Upload arrival rate: 1 per 10 seconds per subject; 6 per 10 seconds per organization.
- Concurrent reads: 1 file at a time per agent (additional files queue on the server); 3 files at once per organization (
429withRetry-After: 90).
/v2/me at startup to verify your API key and organization.
Step 2: upload the file with multipart observe
In v2, file uploads go to POST/v2/agents//threads//observe with Content-Type: multipart/form-data. Pass an Idempotency-Key so retries never duplicate work.
202. For a file call, the top-level observation_id is null. Each entry in files has its own file_id and observation_id. Save both.
duplicate is true when this agent already had these exact bytes; nothing was read or billed, and the ids are the earlier upload’s. When a file is refused, its file_id and observation_id are null, and error gives the code, a message, and retry_after.
If it fails:
413 document_too_large/document_too_many_turns: file exceeds 30 MiB or 20,000 pieces. Split the file.400 encrypted_document/unsupported_document/document_needs_ocr: remove password, convert format, or supply a PDF with selectable text.409 document_already_ingested: exact bytes were already learned in another thread of this agent (memories are already searchable).409 document_uploaded_elsewhere: an upload of this file in another thread stopped partway; resume it with POST/v2/agents//files//resume.429 rate_limit_exceeded: arrival rate (1/10 s per subject, 6/10 s per org) or org concurrency cap (3 concurrent reads) hit. WaitRetry-Afterseconds.502/503(document_service_unavailable,ocr_failed,ocr_busy): transient backend failure; retry with the sameIdempotency-Key.
Step 3: poll until committed
Retry-After (or every 2 seconds) until status is committed.
queued: the file is waiting behind another file on this agent and will start automatically.interrupted: a Priors restart paused aprocessingupload; keep polling as it resumes automatically. (Note: a restart while a file is stillqueuedorconvertingmarks itfailed; upload it again.)failed: if the upload stopped partway, call POST/v2/agents//files//resumeto finish only the remaining pieces without paying twice.
Step 4: upload additional files
You can upload a second file (PDF, Word, Markdown, CSV, plain text, or image) to the same agent without waiting for the first to finish: Priors queues it on the server (status: "queued" when polled) and starts it automatically after the first file commits. Space uploads at least 10 seconds apart per subject.
Step 5: ask a question and show citations
In v2, both POST…/respond (no learning, ideal for a shared support line) and POST…/observe-and-respond (learns the turn) return citations directly on the response:
200.
citations[0].label to display the filename and citations[0].href (with your API key on your backend proxy) to download the original file. verified is false for documents learned into memory, and true for images attached directly to that turn.
Step 6: list or remove files
List every file the agent holds:202 and deletes the file bytes immediately; poll the returned Location header (GET/v2/agents//memories?file_id=src_01J…) until every citing turn reaches forgotten.
What this walkthrough showed
- Multipart
observehandles documents up to 30 MiB and 20,000 pieces in one unified endpoint. respondandobserve-and-respondreturn downloadablecitationswithfile_id,label, andhref.- Answering calls run normally while documents are being learned.
- Deleting a file removes both the stored bytes and every memory citing that file.