Knowledge

The Knowledge resource lets you add facts to your agents' knowledge base and query what they know. Thinklio organises knowledge in four layers — org, team, agent, and interaction — and the Platform API gives you programmatic access to the org and team layers.

Knowledge Layers

| Layer | Scope | Managed via | |-------|-------|-------------| | Org | All agents in the organisation | Platform API, Admin UI | | Team | All agents in a team | Platform API, Team settings | | Agent | A specific agent | Platform API, Agent Studio | | Interaction | A single session | Channel API (automatic) |

Fact Format

Facts are structured records with a content string, an optional type, and optional metadata. The content is indexed for semantic search. Metadata is stored but not indexed.

Bulk Import

For large knowledge bases, use the bulk import endpoint which accepts an array of facts. Imports are processed asynchronously; the response includes a job ID you can poll for completion.

Semantic Search

The knowledge search endpoint accepts a natural language query and returns the most semantically relevant facts. This is the same search the agent uses internally when answering questions.

Endpoints

POST/v1/knowledge/factsComing Soon

Add knowledge facts

Add one or more knowledge facts to the specified layer. Facts are indexed for semantic search immediately.

Request Body

{
  "layer": "org | team | agent (required)",
  "team_id": "string (required if layer is team)",
  "agent_id": "string (required if layer is agent)",
  "facts": [
    {
      "content": "string (required)",
      "type": "string (optional)",
      "metadata": "object (optional)"
    }
  ]
}

Response

{
  "created": 3,
  "fact_ids": [
    "fact_01hxyz",
    "fact_01habc",
    "fact_01hdef"
  ]
}
GET/v1/knowledge/searchComing Soon

Search knowledge facts

Semantic search across knowledge facts accessible to the API key. Returns the most relevant facts for the given query.

Parameters

NameTypeInRequiredDescription
qstringqueryYesNatural language search query.
layerstringqueryNoLimit search to a specific layer: org, team, or agent.
limitintegerqueryNoNumber of results to return (default 5, max 20).

Response

{
  "results": [
    {
      "id": "fact_01hxyz",
      "content": "string",
      "type": "string",
      "layer": "team",
      "score": 0.94,
      "metadata": {}
    }
  ]
}