Knowledge base
Knowledge base

Read a knowledge source's indexed text

Read one knowledge-base source back as the agent searches it: an agent source or a workspace source, whatever its kind (text, url, site, upload or a set answer, which is always one passage). Returns `source` (id, scope, kind, name, url, status, chunkCount, error, refreshError, rejectedChunkCount and rejectedReasons from the quality gate, sharedState for a workspace source, lastFetchedAt, updatedAt) and `passages`, the indexed text in order, 10 to a page, each `{ index, tokens, section, pageUrl, text }`. Page through with `page` until `hasMore` is false; `pages` is the total. The passages are what the quality gate kept, so text it dropped (see rejectedReasons) is not there, and a source still being read has none yet. Use it to check what the agent can find before you add or rewrite a source, and to copy a text source's wording into update_text_kb_source or a set answer's into update_set_answer. It reads with your own access, so a source you can't open in the agent's Knowledge base can't be read here either, and each read is recorded in the audit log.

GET
/workspaces/{workspace}/agents/{agent}/knowledge-base/{source}

Authorization

bearerAuth
AuthorizationBearer <token>

A personal access token from Settings > API tokens.

In: header

Path Parameters

workspace*string

Workspace slug (GET /me lists yours).

agent*string

Agent slug within the workspace.

source*string

Query Parameters

page?integer

Page of passages, 10 to a page, in the order they were indexed. Pass nextPage from the last reply.

Default1
Range1 <= value <= 9007199254740991

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X GET "https://example.com/workspaces/string/agents/string/knowledge-base/string"
{
  "source": {
    "id": "string",
    "scope": "string",
    "kind": "string",
    "name": "string",
    "status": "string",
    "property1": null,
    "property2": null
  },
  "page": 0,
  "pages": 0,
  "hasMore": true,
  "property1": null,
  "property2": null
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}