The Knowledge template shows how to use the Knowledge primitive.Documentation Index
Fetch the complete documentation index at: https://docs.inworld.ai/llms.txt
Use this file to discover all available pages before exploring further.
Run the Template
- Go to
Assets/InworldRuntime/Scenes/Primitivesand play theKnowledgeTemplatescene.
- After pressing Play, click
Connect.
- Click
Add Knowledgeto add more records.
Add.
In this demo, all added records go to the knowledge/test collection.
- Click
Query Knowledgeto search the knowledge records.
Query.
Matching records will be displayed on the screen.
- Clicking the trash icon next to a knowledge record deletes all records in that knowledge collection for this game session.

Understanding the Template
Structure
-
This demo has two prefabs under
InworldController:TextEmbedder(containsTextEmbedderModule) andKnowledge(containsKnowledgeModule). -
These modules create
TextEmbedderFactoryandKnowledgeFactory, and each factory creates aTextEmbedderInterfaceorKnowledgeInterfacebased on the currentTextEmbedder/KnowledgeConfig.

KnowledgeData
KnowledgeData is the asset this demo interacts with. After the text embedder initializes, whenever you submit a query, the AI module batches this KnowledgeData and tries to retrieve the most relevant pieces of knowledge. By default, it’s stored underAssets/InworldRuntime/Data/General.

knowledge/.
See the example data in our Unity project.

Workflow
- Initialization is sequenced because
Knowledgedepends onInworldController. - When
InworldControllerinitializes, it callsInitializeAsync()onTextEmbedderModule.
InworldController invokes OnProcessInitialized, which triggers KnowledgeModule initialization (see Primitives Overview).
- Once
KnowledgePanelis initialized,InworldControllerinvokesOnFrameworkInitialized.
KnowledgeConfigPanel on KnowledgeCanvas > ConfigPanel is registered to this event, which enables the UI for interaction.
Knowledge entries must already be compiled to the remote before the demo is run. The demo itself does not compile knowledge at runtime — see the prerequisite warning above.
Add Knowledge
- When you press
Add Knowledgeand submit the input text, the data is added to the currentKnowledgeData. - In this demo, this invokes
KnowledgeInteractionPanel._AddKnowledge(). - It adds a new entry to the
knowledge/testgroup.
KnowledgeInteractionPanel.cs
Entries added at runtime are local to the current session. To make them available for future sessions, add them to the
KnowledgeData asset in the Inspector and compile to remote from the editor.Query Knowledge
-
As long as
InworldControlleris connected and each module is initialized, you can clickQuery Knowledge. - Enter any question; if it matches the knowledge database above, related entries are listed.
- More relevant entries appear higher in the list.
-
When you press Enter or click
Query, it first triggersKnowledgeInteractionPanel._QueryKnowledge(). -
This calls
InworldController.Knowledge.GetKnowledges(), which in turn callsKnowledgeInterface.GetKnowledge().
InworldController.cs