What You Can Extend¶
KnowledgeLake has sixteen places where you can add your own logic, send data out, or bring your own data in. Each one runs in a different place, at a different time, and can reach different data. Pick the wrong one and your code cannot see what it needs.
This page maps every extension point to the stage where it runs, then gives short rules to choose one.
At a glance
- Code surfaces JavaScript in the browser (QuickJS), JavaScript on the server (V8), Liquid templates, and your own code in any language behind an HTTPS endpoint.
- No-code surfaces Expression routes, AI hints, global variables, the Secondary Event Provider.
- Shared object Almost every surface reads the same work item. Read The Work Item Model before you write code.
- Time limits On Platform Limits.
All extension points¶
| Extension point | Where it runs | Language | Best for |
|---|---|---|---|
| Intuitive AI refiners | Server, Intuitive AI step | Regex, hint or JavaScript | Deciding a class or subclass |
| Intuitive AI custom actions | Server, Intuitive AI step | JavaScript | Exact rules that fix a field during capture |
| Auto Extraction field hints | Server, Auto Extraction action | Plain language | Extracting fields during capture |
| Custom Behavior | Browser index panel, and server | JavaScript | Rules a person sees while indexing |
| Workflow routes | Workflow worker | JavaScript, or no code | Deciding the next step |
| Custom Step | Workflow worker | JavaScript | Unattended work on the work item |
| Custom Event step | Workflow worker | JavaScript | Business facts for your own reporting |
| Step setting values | Workflow worker | Liquid or JavaScript | Filling one step setting from the work item |
| Global Variables | Workflow worker | None (a value) | Values that admins change in one place |
| Call External API | Workflow worker | Configuration, Liquid body | One value from a public web service |
| Custom Gizmos | User's browser, in a task | HTML, CSS, JavaScript | A custom screen or control in a task |
| Search filter behavior | Browser search query panel | JavaScript | Search filter defaults, visibility and validation |
| Your own endpoint | Your platform | Any | Other systems, file bytes, tests or a log |
| REST API | Anywhere | Any | Code that runs outside KnowledgeLake |
| Events and the Secondary Event Provider | Your event store | None in KnowledgeLake | Reports on platform activity |
| Custom Insight widgets | Your endpoint, called by the server | Any | Dashboard numbers from your own system |
Where each extension point runs¶
A document meets the extension points in this order. Capture, index and task work all run as steps of a workflow, so the workflow box sits in the middle of the flow.
graph TD
CAP["Capture: Intuitive AI refiners, custom actions, AI hints"] --> IDX["Index: Custom Behaviors"]
IDX --> WF["Workflow: routes, Custom Step, Custom Event, Call External API, step settings, global variables"]
WF --> TSK["Task: Custom Gizmos, behaviors in Start QC Task"]
TSK --> WF
WF --> REL["Release: repository, then search filter behaviors"]
WF --> OUT["Outside systems: your endpoint, REST API clients, your event store, Insight widget endpoint"]
OUT --> WF
The sections below follow the same stages. Each entry says what the extension point is, where it runs, its language, and what it can reach.
Capture and classify¶
Intuitive AI refiners¶
Rules that confirm or reject a class or subclass for a page or a document during classification.
- Types Regex Anchor (a regular expression over the text of a zone), Zero-Shot Classifier (the AI Refiner: a plain-language hint), Identification Zone, and Custom Condition or Custom Document Condition (your JavaScript).
- Runs On the server, in the Intuitive AI processing step. Custom conditions run in V8.
- Language Configuration, a .NET regular expression, a plain-language hint, or JavaScript.
- Can reach The page or document being classified and its OCR text (
state,services.OcrService). A read-only snapshot of the work item (state.BatchProjection). - Returns A custom condition returns a confidence with
result.SetResult(confidence). - Network None.
- Read Custom Refiners
Intuitive AI custom actions¶
JavaScript that runs after a class or subclass matches. Custom Action works on a page. Custom Document Action works on a whole document.
- Runs On the server, in the Intuitive AI processing step (V8).
- Language JavaScript.
- Can reach The page or document, its OCR text, page dimensions and the read-only
state.BatchProjection. - Writes
Indexfields of the current document, withresult.SetDocumentMetadata(key, value). - Network None.
- Read Custom Actions
Auto Extraction field hints¶
A plain-language hint on each field and each table column that tells AI extraction what to look for. It is configuration, not code.
- Runs On the server, in the Auto Extraction action.
- Language Plain language.
- Can reach The document text and the hints you write.
- Read Writing AI Hints
Index¶
Custom Behavior¶
A short script attached to one field of a content type. It shows, hides, enables, fills or validates fields.
- Runs in the browser In the index panel (QuickJS).
- Runs on the server In V8, in four places: the Index Your Documents step, the Run Indexing Behaviors step, Search bulk edit, and the Start QC Task step when its setting Mark Valid Documents as Indexed is Yes (the default).
- Language JavaScript.
- Can reach The fields on the panel (
panel), andcontext.username,context.usergroupsandcontext.app. - On the server
context.appis"worker"and there is no user. - Cannot reach The network, other documents or the work item.
- Read Custom Behaviors introduction
Behaviors run before QC tasks
The Start QC Task step runs every document's behaviors on the server and writes back the values they set. A behavior that stamps the user or the date runs there with no user. Guard browser-only logic with if (context.app !== "worker").
Workflow¶
Workflow routes¶
The condition on each path out of a workflow step.
- Types Expression (built in the designer, no code), JavaScript (an expression that is coerced to true or false), and Global Variable (the variable's value is evaluated as a JavaScript expression).
- Runs In the workflow worker (V8), when the step finishes.
- Order The first true route wins. If no route is true, the default route is used.
- Language JavaScript, or no code for Expression routes.
- Can reach
workItem(WorkItemId,Name,Metadata,Documents),workItem.ReleaseInfoafter a hold is released (for example when a task completes), andGlobalVariables.Get(name). - Expression routes Read work-item metadata only.
- Limits No network. A route cannot change the work item.
- Read Routes
Custom Step¶
A workflow step that runs your JavaScript over the whole work item. It does metadata math, renames, splits, merges, moves documents and sets routing values.
- Runs In the workflow worker (V8). Writes are queued and applied when the script ends.
- Language JavaScript.
- Can reach The work item as
batch(alsoworkItem): metadata, documents, pages and the file list. It readsGlobalVariables.Get(name). - Writes Through
builder. - Not available Network,
console,require. - Read Custom Step introduction
Custom Event step¶
A workflow step (Automated Steps, Custom Event) that writes one event of your own design. The event goes to your Secondary Event Provider, where you report on it.
- Set up You set its scopes, for example
invoice, approved, and a script sets its properties. - Runs In the workflow worker (V8), 10 seconds. The step never changes the work item.
- Language JavaScript.
- Can reach The work item as
batch(read only),GlobalVariables.Get(name), andbuilder.SetEventProperty(key, value). - Network None.
- Read Custom Event step
Step setting values¶
Most step settings take a fixed value, a Liquid Template, a JavaScript expression or a Global Variable.
- Choose Select the gear icon next to the setting's name in the workflow designer.
- Liquid Fills a setting from the work item, for example an email subject or a request body.
- Runs In the workflow worker, right before the step runs.
- Language Liquid or JavaScript.
- Can reach The work item as
WorkItemin Liquid (read only), for example{{ WorkItem.Metadata.Index.Vendor }}. - Read Liquid in Step Settings
Global Variables¶
Named values that you manage in the Workflow app, for example a review limit, a URL or a token. Change the value once and every workflow that reads it uses the new value.
- Runs The workflow worker reads the value when a step, route or script needs it.
- Language None. It is a value.
- Can reach Nothing.
- Read it with
GlobalVariables.Get(name)in a Custom Step, Custom Event or route, or pick it for a step setting. - Read Global Variables
Important
Secret variables are readable from workflow JavaScript. Routes, JavaScript step settings, Custom Step and Custom Event can all read a secret variable's value. Anyone who can edit a workflow script can read the secret. Never write a secret into metadata, an event property or an error message. Creating or changing a secret variable needs the Manage Secret Workflow Variables feature.
Call External API¶
A workflow step (External Steps, Call External API) that sends one HTTP GET or POST request. Switch the Body setting to Liquid Template to fill it from the work item.
- Runs In the workflow worker. The request comes from KnowledgeLake, not from a browser.
- Language Configuration, plus Liquid for the body.
- Can reach Any public HTTPS host. Local and private addresses are refused before the request is sent.
- Result The response body and status code land in the
ApiResultsbucket on the work item. - Read Call External API
Task¶
Custom Gizmos¶
A small web app (index.html, main.js, whitelist.txt) that you place in a task layout. It gives a person a custom view or control inside a task. Any customer with Tasks can use them.
- Runs In the user's browser, in a sandboxed iframe inside the task.
- Language HTML, CSS and JavaScript.
- Can reach Its configuration inputs (
gizmo.Config), and the KnowledgeLake API as the signed-in user (gizmo.API, limited to the permissions it declares). - Outside hosts Hosts that you list in
whitelist.txtand that allow the request in CORS. - Returns Results to the task with
gizmo.PublishResult(). - Read Custom Gizmos introduction
Release and search¶
Search filter behavior¶
A behavior on a filter field of a saved search. It sets a default, shows or hides a filter, or validates input. A script on a filter uses the SetFilter* builder methods.
- Runs In the browser, in the search query panel (QuickJS), 1.5 seconds.
- Language JavaScript.
- Can reach The filters on the panel and
context.username. - Not here
context.usergroups,context.appand the network. - Read Search filter behaviors introduction
Outside systems¶
Your own endpoint¶
Code you host and deploy, for example an Azure Function or an AWS Lambda. A Call External API step calls it and adds a WorkItemId header. Your code then calls the REST API to read the work item and write results back.
- Runs On your platform, under your own timeouts, logging and source control.
- Language Any.
- Can reach Anything your code can reach, plus the document file bytes through the REST API.
- Read Your Own Endpoint
REST API¶
The public API. Every action is POST https://{tenant}/api/{Group}/{Action} with a JSON body and a TempIdentityToken header.
- Runs Anywhere: your app, a script, Power Automate, a function.
- Language Any.
- Can reach Everything that the token's user and the token's features allow: work items, documents, files, workflows, global variables, jobs, bots and the repository.
- Read API introduction
Events and the Secondary Event Provider¶
KnowledgeLake writes an event for platform activity: API calls, workflow steps, app actions. An administrator can forward these events to your own Azure Cosmos DB (SQL API) or Elastic store, filtered by category, and build reports there. Custom Event steps add your own events to the same feed.
- Runs Configuration > Apps > Event Settings, with the Manage Event Settings feature.
- Delivery Best effort. An event can be lost, and order across servers is not guaranteed.
- Language None in KnowledgeLake. You query your own store.
- Can reach Not applicable. KnowledgeLake only writes to your store. It never reads it back.
- Read Events overview and the Events Dictionary
Custom Insight widgets¶
An Insight dashboard widget (Custom Text, Custom Time Series or Custom Categorical) that shows data from your own endpoint. An administrator adds a Web Request source connection with an Endpoint URL, a Bearer Token and a Timeout, then points the widget at it.
- Runs KnowledgeLake calls your endpoint with HTTP GET when the dashboard loads.
- Request It sends
Authorization: Bearer <token>and headers that name the dashboard, the widget and the viewer. - Requires The Insight module must be on for your tenant.
- Language Any. Your endpoint returns JSON in the published schema and answers
GET {base}/validatewith HTTP 200. - Can reach Whatever your endpoint can reach. Local and private addresses are refused.
- Read Insight widgets introduction
Which one do I use¶
Use the first rule that matches.
- A person must see it while they index. Use a Custom Behavior. If the same rule must also hold before a QC task opens, keep it in the behavior: Start QC Task runs it on the server.
- It changes what a search filter shows, defaults or accepts. Use a search filter behavior.
- It decides which step comes next. Use a route. Use an Expression route for one or two simple comparisons. Use a JavaScript route for compound logic. Put a threshold that admins change in a Global Variable.
- It needs only the work item and runs unattended. Use a Custom Step. If a route must act on the result, write the result to work-item metadata.
- It fills one step setting from the work item. Use Liquid in that setting (the gear icon). Do not add a Custom Step only to build a string.
- It records a business fact for your own reporting. Use a Custom Event step and a Secondary Event Provider. Do not write report data into metadata only to export it later.
- It needs one value from a public web service. Use Call External API, then a Custom Step that parses the body from
ApiResults. - It needs another system with its own authentication, the file bytes, tests or a log. Write your own endpoint and call it with Call External API.
- It decides the class or subclass of a page or document. Use an Intuitive AI refiner. Try a Regex Anchor or a Zero-Shot Classifier hint first. Write a Custom Condition only when those cannot express the rule.
- It extracts or corrects a field during capture. Use Auto Extraction field hints first. Use a custom action when the rule is fixed and exact, for example a calculation or a lookup in the page text.
- A person needs a custom screen or control inside a task. Use a Custom Gizmo.
- A dashboard must show numbers from your own system. Use a Custom Insight widget with a Web Request source.
- It runs outside KnowledgeLake. Use the REST API.
In short
- If it only needs the work item, it is a Custom Step.
- If it needs anything outside KnowledgeLake, it is your own code, and Call External API is how the workflow calls it.
- If a person has to see it while indexing, it is a Custom Behavior.
- If it is for a report, it is an event.
Build it with an AI assistant¶
AI coding assistants write good KnowledgeLake code when you give them the contract, a working example and a precise goal. Without the contract, they invent object and endpoint names that look right and do not exist.
- Paste the AI Assistant Primer first. It holds this page's map and rules in a form a model reads well.
- Then follow Build with an AI Assistant.