Knowledge Sets
Ship background knowledge about your product to the AI by dropping a decorated class into your package.
A knowledge set is a collection of background knowledge about a subject — for example, a product such as Umbraco Engage. It is defined in code and shipped inside a package, so the AI can draw on it.
A package author ships knowledge by dropping a single decorated class into an assembly. The set is discovered at startup, needs no configuration, and its content flows to the model on demand.
Knowledge sets are the content complement to Contexts: context resource types define the shape of context, while knowledge sets provide ready-made content.
Overview
Each knowledge set:
Has a stable ID, a display name, and an optional description and icon
Contains one or more items (shown as "Topics" in the backoffice), each a chunk of markdown
Is auto-discovered at startup via the
[AIKnowledgeSet]attribute — no registration codeIs auto-active — installed sets are available to every request with nothing to configure
Is surfaced on demand — the model retrieves an item's content only when it is relevant
How It Works
Installed knowledge sets flow through the same context resolution pipeline as contexts. For each request, the AI is shown a grouped list of the available items, where each item's name and description act as a breadcrumb. The model then pulls an item's full markdown content only when it decides the item is relevant. Item content is produced lazily, so listing a set never loads its content.
Creating a Knowledge Set
Derive from AIKnowledgeSetBase, decorate the class with [AIKnowledgeSet], and override GetItemsAsync to return the items. Use AIKnowledgeSetItem.FromContent for static markdown:
That is the complete happy path. On startup the class is discovered, and its items become knowledge the AI can draw on — no further wiring required.
Loading Content Dynamically
FromContent wraps a literal string. When an item's content needs to be built at request time — for example loaded from a service — set GetContentAsync directly instead. The producer is invoked lazily, only when the content is retrieved:
AIKnowledgeSetItem
Key
string
Stable, URL-safe identity within the set (for example "goals"). Keep it stable across renames.
Name
string
Display name, shown in the backoffice.
Description
string?
The breadcrumb the AI sees when the item is advertised — write it to help the model decide whether to retrieve the item.
GetContentAsync
Func<CancellationToken, Task<string>>
Lazily produces the markdown content, injected as-is when retrieved.
Registration
Knowledge sets are auto-discovered via the [AIKnowledgeSet] attribute and the IDiscoverable interface. No manual registration is needed.
To turn off a set shipped by another package, exclude it in a Composer:
The builder also exposes .Add<T>(), but you rarely need it. A decorated set is already registered by discovery. .Add<T>() only helps for the uncommon case of a set that implements IAIKnowledgeSet directly, without the [AIKnowledgeSet] attribute.
Viewing Installed Knowledge Sets
Installed sets appear under AI Configuration > Knowledge Sets in the backoffice. This view is read-only: you can browse the installed sets and open a topic to inspect its content. Knowledge sets are defined in code, so they cannot be created or edited from the backoffice.
Related
Contexts - Injecting brand voice, guidelines, and content into AI operations
Custom Tools - Give AI agents actions to perform
Last updated
Was this helpful?