Get sources summary
GET/v2/agents/{agentId}/sources/summary
Return how many sources an agent has by status and by type, plus the total size of its knowledge, in one small call for dashboards and scripts.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
Returns counts for the sources of one agent instead of the sources themselves. Call it to show a progress indicator while training runs, to alert when a source fails, or to check that an import created everything you expected.
Request
GET /v2/agents/{agentId}/sources/summary
Path parameters:
| Name | Type | Required | Description |
|---|---|---|---|
agentId |
string | Yes | The ID of the agent, starting with agt_. |
The call has no query parameters and no body. To see which sources are behind the numbers, filter List sources by status or type.
Example request
curl https://api.askocto.co/v2/agents/agt_8f3k2m/sources/summary \
-H "Authorization: Bearer $OCTO_API_KEY"
const response = await fetch(
"https://api.askocto.co/v2/agents/agt_8f3k2m/sources/summary",
{ headers: { Authorization: `Bearer ${process.env.OCTO_API_KEY}` } },
)
const summary = await response.json()
const pending = summary.byStatus.queued + summary.byStatus.training
console.log(`${summary.byStatus.ready} of ${summary.total} sources ready, ${pending} pending`)
Example response
A successful call returns 200 OK.
{
"agentId": "agt_8f3k2m",
"total": 9,
"characters": 182340,
"byStatus": {
"queued": 1,
"training": 1,
"ready": 6,
"failed": 1
},
"byType": {
"website": 2,
"file": 3,
"text": 1,
"qa": 3
}
}
Response fields
| Name | Type | Description |
|---|---|---|
agentId |
string | The agent the numbers belong to. |
total |
integer | The number of sources of the agent. |
characters |
integer | The combined size of the content of all ready sources. |
byStatus |
object | Counts for queued, training, ready and failed. Every key is always present, with 0 when there is none. |
byType |
object | Counts for website, file, text and qa. Every key is always present. |
The counts in byStatus add up to total, and so do the counts in byType. The agent only answers from ready sources, as the Sources API overview explains.
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized |
The API key is missing, malformed or deleted. |
| 404 | not_found |
No agent has this ID in your workspace. |
| 429 | rate_limited |
Too many requests. Wait for the number of seconds in the Retry-After header. |