Skip to content
GitHub (opens in a new tab)

KnowledgeSources

The files, websites and folders an agent knows, each with its index progress and status. Upload files, add a website or connect a folder from one Add source menu, retry a failed source, remove one.

stableOrganismcontracts/knowledgesources.json

Preview

KnowledgeSources

The files, websites and folders an agent knows, and how far each is indexed. Not FileUpload.

Master

Four sources index two at a time, and a website joins a moment in: it queues, then indexes. The scanned PDF fails partway; Retry it and it runs to the end. Add source uploads files, adds a website (it queues, then indexes) or connects a folder. Remove a row, or Replay.

Knowledge sources

4 sources
  • pricing-handbook.pdfFile · 2.4 MBQueued
  • docs.example.comWebsite · 142 pagesQueued
  • contracts-scan-2019.pdfFile · 8.4 MBQueued
  • Legal templatesFolder · 38 filesQueued

Usage

Your app indexes; pass each source's status and progress in as it moves. Set a failed source's error in plain words. onRetry should set it back to indexing at 0, and onRemove should drop it from sources: its row folds away in place and focus moves to the next row. onUpload gets rejected files with a reason: add them as failed rows. Only status changes are announced to screen readers.

Do's

  • showing what an agent's knowledge base or retrieval index holds
  • indexing progress per source, with failures people can retry
  • adding files, a website or a folder in the same place; files onUpload turns down come back with a reason, so the app adds them as failed rows

Don'ts

  • attaching files to a form or message — FileUpload
  • usage against a plan limit — UsageList
  • connecting apps and accounts — IntegrationPicker
  • the sources behind one answer — CitedAnswer
<KnowledgeSources
  sources={[
    { id: "handbook", name: "pricing-handbook.pdf", type: "file", status: "ready", size: 2516582 },
    { id: "docs", name: "docs.example.com", type: "site", status: "indexing", progress: 64, count: 142 },
  ]}
  onUpload={(accepted, rejected) => upload(accepted, rejected)}
  accept=".pdf,.docx,.md"
  maxFileSize={20 * 1024 * 1024}
  maxSizeLabel="PDF, DOCX or MD, max 20 MB"
  onAddWebsite={addSite}
  folders={folders}
  onConnectFolder={connectFolder}
  onRetry={retrySource}
  onRemove={removeSource}
/>

When to use

  • showing what an agent's knowledge base or retrieval index holds
  • indexing progress per source, with failures people can retry
  • adding files, a website or a folder in the same place; files onUpload turns down come back with a reason, so the app adds them as failed rows

When not to use

  • attaching files to a form or message — FileUpload
  • usage against a plan limit — UsageList
  • connecting apps and accounts — IntegrationPicker
  • the sources behind one answer — CitedAnswer

What an agent reads

import { KnowledgeSources } from "agentic-ds-kit";
must
  • a small kit Card (one even padding) named by its title (aria-label); the compact header row holds a 16px icon, an h3 title and a muted status line ("4 sources · 1 indexing"); sources are a list named like the Card
  • status is never colour alone: queued, indexing and failed show an icon plus a word; ready shows its muted check only, with "Ready" as visually hidden text and as a Tooltip on the check. Status icons are aria-hidden
  • one polite live region announces status changes only ("handbook.pdf, Failed, Scanned PDF has no text"), plus the status line when it changes; progress ticks and the first load are never announced
  • each indexing bar is a kit Progress named by its source
  • row actions are icon-only Buttons, each with an aria-label and a Tooltip: Remove (X while queued or indexing, Trash2 after) is named "Remove {name}"; Retry (RotateCcw, Tooltip Retry) is named "Retry {name}"
  • a leaving row is inert and aria-hidden while it folds; after Remove, focus moves to the next row's Remove, else to Add source
  • adding goes through one Add source Button (quiet at the foot of the list, outline under the Empty) that opens a kit Popover with menu rows (role menu and menuitem; arrow keys, Home, End and Enter). Upload files, Add a website and Connect a folder each show only when their handler is passed. The file input is hidden and out of the tab order; the menu row is the control
  • Add a website and Connect a folder switch the same panel to a step with a Back icon Button (named Previous); Escape in a step goes back, a second Escape closes. The address field is a kit Input named Website address: Enter adds, an error is text under the field (aria-describedby) that keeps the value, and focus stays in the field
  • files onUpload turns down are announced in the live region with their reason ("scan.zip, This file type isn't accepted"); the app adds them as failed rows, so none vanish silently
  • motion: new rows rise in (a first load stays still), progress fills smoothly, Indexing… shimmers (its mark stays still), ready draws a check and failed draws a cross when they change live, and a removed row fades and folds its height so the rows below close up without a jump. the Add source menu grows from its button, its rows settle one after another and the highlight glides between rows. All off under prefers-reduced-motion
defaults
Nothing extra in the contract.
stops if
  • Do not invent a local SourceList, SourceRow, IndexProgress or UrlField; this is the piece
  • Do not wrap it in another Card; it brings its own
  • Do not index, crawl or upload inside the component; the app does it and passes each status in
  • Do not announce progress ticks; only status changes are announced
  • Do not use a native progress element; rows compose kit Progress
  • Do not use raw hex or primitive --color-* ramps
  • Do not put a solid primary Button on a row
  • Do not build a local dropdown elsewhere; use DropdownMenu

From contracts/knowledgesources.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
sourcesarrayYes—{ id, name, type, status, progress?, size?, count?, error?, iconSrc? }[], in the order to show; rows are keyed by id. progress is 0 to 100 while indexing (left out, the bar is indeterminate). size is bytes for a file; count is pages for a site, files for a folder. error is the plain-words reason on a failed source. iconSrc is a favicon or logo; left out, the type icon shows. Empty renders a kit Empty.
typefile | site | folderNo—Each source's type. Shown as an icon and a word (File, Website, Folder).
statusqueued | indexing | ready | failedNo—Each source's status, always an icon plus a word. ready is quiet (a muted check alone, with Ready as hidden text and a Tooltip; green only while its check draws on a live change), so colour marks only failed and indexing. indexing shows a still brand mark, a shimmering Indexing… and a Progress bar with its percent on its own line under the name and detail, which grows in when indexing starts and folds away when it ends; failed shows the reason in place of the detail, in secondary text, so only the status is red.
onUploadfunctionNo—(accepted: File[], rejected: { file, reason }[]) => void. Adds Upload files to the Add source menu (maxSizeLabel is its muted hint); it opens the file picker. Files that miss accept or pass maxFileSize come back in rejected with a plain-words reason; add them as failed sources with that reason as error.
onAddWebsitefunctionNo—(address) => void. Adds Add a website: the same menu switches to a step with one address field and an Add button. The address comes trimmed, without http(s):// or a trailing slash; one that does not parse or is already a site in sources gets an inline error that keeps what was typed.
onConnectFolderfunctionNo—(key) => void. With folders, adds Connect a folder: the menu switches to the list of folders; picking one closes the menu.
foldersarrayNo—{ key, name, detail? }[], the folders that can still be connected. Empty shows All folders connected.
acceptstringNo—The file input accept list, also checked on upload (".pdf,.docx,.md", "image/*").
maxFileSizenumberNo—Largest file in bytes; bigger files come back in onUpload's rejected list.
maxSizeLabelstringNo—The muted hint under Upload files, e.g. "PDF, DOCX or MD, max 20 MB".
onRetryfunctionNo—(id) => void. Failed rows show a Retry icon Button (RotateCcw, Tooltip Retry, named Retry {name}) just before the status, which stays right beside Remove. Set the source back to queued or indexing at 0; its bar fills again.
onRemovefunctionNo—(id) => void. Every row shows a Remove icon Button (X while queued or indexing, Trash2 after). Drop the source from sources; its row folds away in place.
titlestringNo—Header title, Card name and list name. Default KitLabels knowledgeSources ("Knowledge sources").
  • Component
    →

    FileUpload

    Choose files Button in a dashed drop zone (or a compact Button-only row) plus a list of file rows with progress, done, and error states.

  • Component
    →

    UsageList

    A list of usage limits, one a row: the limit's name, how much is used of it, a bar, and a short note.

  • Component
    →

    IntegrationPicker

    A filterable catalogue of integrations: search, a category filter with an optional Connected segment, and one tile per provider that ends in a status word (Not connected, Connected, Needs attention, Paused, Connecting…, Coming soon) and at most one action (Connect, Manage, or a sync Switch), with an optional overflow menu in the tile head. connectFlow "detail" opens a Drawer with what it can access and Connect or Disconnect.

  • Component
    →

    CitedAnswer

    An assistant reply with inline citation marks that preview their passage in a hover card, and sources folded into one pill with site icons.