Appearance
Knowledge
Data sources give agents knowledge beyond the model: your documents, website, product API or FAQ. You create a data source once per project and attach it to any number of agents.
Data source types
| Type | Content comes from | Modes |
|---|---|---|
files | uploaded files: PDF, DOCX, PPTX, TXT, MD, HTML, CSV, JSON, images | indexed |
website | a crawl from a start URL and/or a sitemap | indexed |
http_api | an HTTP API: paginated requests mapped to documents, or called live as a tool | indexed or live |
text | text entries written in the console or pushed through the API (FAQ, Q&A, notes) | indexed |
Modes
- Indexed (default): content is fetched, parsed (with OCR for scans and images), split into chunks, embedded and stored. Retrieval combines vector similarity and full-text search, merged with reciprocal rank fusion. Documents are hashed, so a re-sync skips unchanged ones.
- Live (
http_apionly): nothing is stored. The API becomes a tool with a parameter schema you define; the model fills the parameters and the platform calls the API at run time. Use it for data that changes constantly (stock, prices, availability) or is too large to index.
Creating a data source
Data sources are created and configured in the console (Project → Data sources). Settings per type:
files: ocr (auto (default), force, off), ocrLanguages (Tesseract codes such as eng+deu), chunking.
website: startUrl and/or sitemapUrl (one is required), maxDepth (link depth from the start URL, 0 to 10, default 2), maxPages (1 to 2000, default 50), include / exclude (glob patterns on the URL path, for example /docs/**), respectRobotsTxt (default true), plus the files parsing options.
http_api:
request:method,url,headers,query,body. Values may contain{{secret:NAME}}(a project secret); in live mode{{param}}placeholders are filled from the tool arguments (URL-encoded inurlandquery, raw in headers, JSON-encoded inbody). With a secret, theurlneeds a literal scheme, host and port (fixed host).pagination:{"type": "none"}(default),{"type": "page", "param": "page", "start": 1, "maxPages": 50}or{"type": "cursor", "param": "cursor", "cursorPath": "meta.next", "maxPages": 50}.mapping(indexed mode, required):itemsPath(the array in each response page; empty means the response is the array),externalRef(path of a stable id),title,text(one path or a list of paths joined with blank lines),metadata(field → path). Paths are dotted:data.items.0.name.live(live mode, required):toolName,description,parameters(JSON Schema of the arguments),responsePath,maxResponseBytes(default 20 000),timeoutMs(default 10 000).
text: only chunking.
Chunking (indexed types): maxTokens (100 to 4000, default 700) and overlapTokens (0 to 1000, default 80).
Embedding model
Each indexed source uses one embedding model from those enabled on the platform (for example OpenAI text-embedding-3-small or -large, or Gemini embeddings); without a choice the platform default is used. The model is fixed when the source is created: switching means a re-index, which re-embeds every document (offered in the console). Larger models retrieve better and cost more embedding tokens; an agent whose sources use different models embeds the query once per model.
Embedding tokens are metered: at sync time on the data source's sync, at query time on the run.
Syncing
websiteandhttp_apisources sync on demand or on a schedule:hourly,dailyorweekly(set in the console).filesandtextsources sync automatically after documents are added.POST /v1/datasources/{id}/sync(scopedatasources:write) starts a sync and answers202with a sync run. A sync that is still queued is reused rather than duplicated. Live sources have no index (400 DATA_SOURCE_NOT_INDEXED).- When a sync finishes, a
datasource.syncedordatasource.failedwebhook is sent.
bash
curl -X POST "$HEVKAR_BASE_URL/v1/datasources/$SOURCE_ID/sync" \
-H "Authorization: Bearer $HEVKAR_API_KEY"ts
const syncRun = await hevkar.dataSources.sync(sourceId);
// { id, status: 'queued', force: false, stats: {}, error: null, startedAt, finishedAt: null }Pushing documents from your system
Keep a text or files source in sync with your own content by pushing documents (scope datasources:write). Pushing the same externalRef again replaces that document, so you can push on every change.
bash
curl "$HEVKAR_BASE_URL/v1/datasources/$SOURCE_ID/documents" \
-H "Authorization: Bearer $HEVKAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"documents": [{
"externalRef": "faq-12",
"title": "Refunds",
"text": "You can ask for a refund within 30 days…",
"metadata": {"lang": "en"}
}]}'
# files into a files source (multipart, up to 20 files; any field name)
curl "$HEVKAR_BASE_URL/v1/datasources/$SOURCE_ID/documents" \
-H "Authorization: Bearer $HEVKAR_API_KEY" \
-F "files=@handbook.pdf" -F "files=@pricing.pdf"ts
await hevkar.dataSources.pushDocuments(sourceId, [
{ externalRef: 'faq-12', title: 'Refunds', text: 'You can ask…', metadata: { lang: 'en' } },
]);
await hevkar.dataSources.pushFiles(sourceId, [
{ data: await readFile('handbook.pdf'), name: 'handbook.pdf' },
]);1 to 500 text documents per request (text up to 2 000 000 characters each). Uploading a file with the same name as an existing document of a files source replaces it. Website and HTTP API sources cannot take pushed documents (400 DOCUMENT_UPLOAD_NOT_SUPPORTED).
Attaching knowledge to an agent
In the agent's configuration, dataSources lists the attached sources, each with:
| Field | Default | Meaning |
|---|---|---|
dataSourceId | the source | |
topK | 5 | chunks to retrieve from this source (1 to 50) |
minScore | minimum cosine similarity (0 to 1); weaker chunks are dropped | |
filter | metadata filter: only chunks whose metadata contains these key/values |
Live sources are attached as tools instead (tools: [{ "kind": "live_source", "dataSourceId": "…" }]).
Retrieval modes
knowledgeMode decides how indexed sources are used:
tool(default): the model gets asearch_knowledgetool and decides when and what to search, possibly several times. Best for assistants where many questions need no lookup.context: every run retrieves with the input (for conversational agents, the user's message; withrewriteQuery, a standalone query written from the history) and adds the results to the instructions as numbered sources. Best when every request needs grounding.
In both modes sources are numbered and the model is told to cite them like [1].
What was retrieved
Every retrieval is stored on the run. GET /v1/runs/{id} returns:
json
{
"retrieval": [
{
"query": "refund period",
"chunks": [
{
"chunkId": "…",
"documentId": "…",
"dataSourceId": "…",
"score": 0.0328,
"similarity": 0.81,
"text": "You can ask for a refund within 30 days…",
"documentTitle": "Refunds",
"dataSourceName": "Help center"
}
]
}
]
}score is the fused rank score; similarity the cosine similarity that minScore compares. text holds the first 500 characters; text and title are missing when the chunk no longer exists.
Workflows
Workflows can search indexed sources without an agent with a search node.