curl --request GET \
--url https://app.sapientpriors.com/api/v2/agents/{agent_id}/threads/{thread_id}/observe/{observation_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.sapientpriors.com/api/v2/agents/{agent_id}/threads/{thread_id}/observe/{observation_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.sapientpriors.com/api/v2/agents/{agent_id}/threads/{thread_id}/observe/{observation_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"observation_id": "<string>",
"status": "queued",
"turns_total": 1,
"turns_processed": 1,
"error": "<string>",
"error_code": "file_stopped_partway",
"learning": {
"not_learned_turns": [
{
"first": 2,
"last": 2
}
],
"reason": "<string>",
"message": "<string>",
"refunded_credits": "<string>"
}
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}Get learning status
How far an observation’s learning has got. While it runs, Retry-After says when to ask again.
curl --request GET \
--url https://app.sapientpriors.com/api/v2/agents/{agent_id}/threads/{thread_id}/observe/{observation_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.sapientpriors.com/api/v2/agents/{agent_id}/threads/{thread_id}/observe/{observation_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.sapientpriors.com/api/v2/agents/{agent_id}/threads/{thread_id}/observe/{observation_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"observation_id": "<string>",
"status": "queued",
"turns_total": 1,
"turns_processed": 1,
"error": "<string>",
"error_code": "file_stopped_partway",
"learning": {
"not_learned_turns": [
{
"first": 2,
"last": 2
}
],
"reason": "<string>",
"message": "<string>",
"refunded_credits": "<string>"
}
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}Authorizations
An API key, shaped spk_<key_id>_<secret><checksum>, sent as Authorization: Bearer spk_.... Each key belongs to one project and reaches only that project: an id from another project answers 404.
- A service account's key runs your product. It acts as the service account, with the role the service account holds in the project, and keeps working when people leave. It reaches the project's public agents, never a private one. Only this key may send
X-SP-End-User. - A personal key acts as the person who created it, with their role in the project. It is for building and testing: every response carries
X-SP-Warning: personal API key, not for production, andX-SP-End-Useris refused with 400.
Keys are created and revoked on the API keys page of the Priors application. No API endpoint creates or revokes a service account's key. A personal key lasts 30, 90, or 365 days (90 by default), and a person can hold 10 live personal keys in an organization. A service account's key lasts 90 or 365 days (365 by default), and a service account can hold 5 live keys. The secret is shown once, at creation, and cannot be recovered.
A personal key made before projects (spu_...) keeps working until it expires, in its organization's Default project.
Keep keys on your server: a request with a Sec-Fetch-Site header is refused with 400, and Priors sends no CORS headers.
Path Parameters
Response
Successful Response
How far one observe call's learning has got.
queued: waiting behind another file this agent is reading. converting: the file is being read. processing: turns are being learned. interrupted: paused by a restart; it resumes where it stopped and is not charged again. Poll these after Retry-After. committed, failed and cancelled are final.
queued, converting, processing, interrupted, committed, failed, cancelled Set when a file upload ended before every turn was learned: file_stopped_partway (it stopped; what was learned is kept) or file_sections_not_learned (some sections could not be learned after a restart). To learn the rest, resume the file: POST /v2/agents/{agent_id}/files/{file_id}/resume. null otherwise.
file_stopped_partway, file_sections_not_learned