Skip to content

[Agent Builder] Adds GenAI Settings UI for managing installation of documentation#245749

Merged
spong merged 9 commits intoelastic:mainfrom
spong:ab-product-docs-settings
Dec 11, 2025
Merged

[Agent Builder] Adds GenAI Settings UI for managing installation of documentation#245749
spong merged 9 commits intoelastic:mainfrom
spong:ab-product-docs-settings

Conversation

@spong
Copy link
Copy Markdown
Member

@spong spong commented Dec 10, 2025

Summary

This PR adds a new Documentation section to the GenAI Settings page for managing the installation of documentation assets like the Elastic Documentation used by the Product Docs Platform Tool and the Security Labs content used by the security.security_labs_search tool

Design issue: https://github.com/elastic/ai-enhancements/issues/77

Note

Security Labs content is not yet served up by the product docs CDN, so it is currently a disabled placeholder until I work #244946 next. We can hide this item for now if that is preferred.

Implementation notes

  • The product_docs API's are called directly from the client instead of plumbing a new AB API. In support of this, the llm_product_doc privilege was added to the ONECHAT_FEATURE_ID. If this is not desired, we can remove this addition and plumb a dedicated API.
  • This UI section should be conditionally visible based on if the Agent Builder experience is enabled/feature is available. I need to confirm, but I believe this is coming in [ML] Agent Builder: Opt-in flow #244532. This functionality has been added.
  • Client hooks for managing product docs were added to /ai_infra/product_doc_base instead of gen_ai_settings. I originally had them in the setting public code, but figured they made more sense alongside the product docs. Happy to change is there is preference here.
  • As previously discussed, we're only supporting installing ELSER embeddings at the moment. We'll probably want to update the Platform Docs tool do instruct the model to do query re-writing to english in support of this. This is done in: [Agent Builder] Adds Integration Knowledge platform tool #245259
  • This uses the same product docs API as the O11y/Security Assistants, so there is no compatibility issues when switching the AB experience on/off or using the old assistants.
  • RBAC support provided such that documentation management actions are disabled unless the user has agentBuilder['all'] Kibana feature privileges.

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

PR developed with Cursor + Opus 4.5

@spong spong self-assigned this Dec 10, 2025
@spong spong added the release_note:skip Skip the PR/issue when compiling release notes label Dec 10, 2025
@spong spong requested a review from a team as a code owner December 10, 2025 00:27
@spong spong added the backport:skip This PR does not require backporting label Dec 10, 2025
@spong spong requested a review from a team as a code owner December 10, 2025 00:27
@spong spong added the v9.3.0 label Dec 10, 2025
@spong spong requested a review from a team as a code owner December 10, 2025 03:04
@spong spong requested a review from Copilot December 10, 2025 04:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new "Documentation" section to the GenAI Settings page, enabling users to manage installation of documentation assets (Elastic Documentation and Security Labs content) that enhance Agent Builder responses. The implementation includes client-side React hooks for product documentation management and UI components for displaying installation status and actions.

Key changes:

  • Added client hooks (useProductDocStatus, useInstallProductDoc, useUninstallProductDoc) to the product_doc_base plugin for managing documentation installation
  • Created a new Documentation section UI with install/uninstall capabilities in the GenAI Settings page
  • Added llm_product_doc privilege to the OneChat feature for direct API access

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
x-pack/platform/plugins/shared/onechat/server/features.ts Added llm_product_doc privilege to OneChat feature permissions
x-pack/platform/plugins/shared/ai_infra/product_doc_base/public/hooks/use_product_doc_status.ts New hook for fetching product documentation installation status with auto-polling
x-pack/platform/plugins/shared/ai_infra/product_doc_base/public/hooks/use_install_product_doc.ts New hook for installing product documentation with query invalidation
x-pack/platform/plugins/shared/ai_infra/product_doc_base/public/hooks/use_uninstall_product_doc.ts New hook for uninstalling product documentation with query invalidation
x-pack/platform/plugins/shared/ai_infra/product_doc_base/public/hooks/index.ts Exports for the new product documentation hooks
x-pack/platform/plugins/shared/ai_infra/product_doc_base/public/hooks/constants.ts React Query keys for product documentation operations
x-pack/platform/plugins/shared/ai_infra/product_doc_base/public/index.ts Exports new hooks from product_doc_base plugin public API
x-pack/platform/plugins/private/gen_ai_settings/public/components/documentation/documentation_section.tsx Main UI component for the Documentation section with installation management
x-pack/platform/plugins/private/gen_ai_settings/public/components/documentation/types.ts Type definitions for documentation items and status
x-pack/platform/plugins/private/gen_ai_settings/public/components/documentation/translations.ts i18n translations for the Documentation section
x-pack/platform/plugins/private/gen_ai_settings/public/components/documentation/index.ts Exports DocumentationSection component
x-pack/platform/plugins/private/gen_ai_settings/public/components/gen_ai_settings_app.tsx Integrated Documentation section into the GenAI Settings page
x-pack/platform/plugins/private/gen_ai_settings/public/plugin.ts Added productDocBase dependency to plugin start dependencies
Configuration files (tsconfig.json, moon.yml, kibana.jsonc, limits.yml) Updated dependencies and bundle size limits
x-pack/platform/plugins/private/gen_ai_settings/public/components/documentation/documentation_section.test.tsx Unit tests for Documentation section component
Comments suppressed due to low confidence (1)

x-pack/platform/plugins/shared/ai_infra/product_doc_base/public/hooks/use_product_doc_status.ts:1

  • Corrected capitalization of 'Tech Preview' to 'TECH PREVIEW' to match the translation constant.
/*

Comment on lines +79 to +97
// Check if product documentation is installed
const isAvailable = await isProductDocAvailable(llmTasks);
if (!isAvailable) {
// Build the full settings URL using the request's base path (includes space prefix)
const basePath = coreSetup.http.basePath.get(request);
const settingsUrl = `${basePath}${GENAI_SETTINGS_APP_PATH}`;

return {
results: [
createErrorResult({
message: `Product documentation is not installed. To use this tool, please install Elastic documentation from the GenAI Settings page: ${settingsUrl}. Do not perform any other tool calls, and provide the user with a link to install the documentation.`,
metadata: {
settingsUrl,
},
}),
],
};
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pgayvallet @sorenlouv @yuliia-fryshko

Now the tool is always available, and will link the user off to the settings page to install the docs if not yet installed:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you @spong !

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #59 / discover/group1 discover histogram should modify the time range when the histogram is brushed

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
genAiSettings 101 138 +37
productDocBase 43 48 +5
total +42

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
productDocBase 9 20 +11

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
genAiSettings 48.7KB 55.7KB +7.0KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
productDocBase 3 6 +3

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
genAiSettings 4.9KB 5.0KB +142.0B
productDocBase 3.0KB 4.5KB +1.5KB
total +1.6KB
Unknown metric groups

API count

id before after diff
productDocBase 24 44 +20

History

cc @spong

@spong spong merged commit 5a91511 into elastic:main Dec 11, 2025
13 checks passed
@spong spong deleted the ab-product-docs-settings branch December 11, 2025 22:39
seanrathier pushed a commit to seanrathier/kibana that referenced this pull request Dec 15, 2025
…ocumentation (elastic#245749)

## Summary

This PR adds a new `Documentation` section to the `GenAI Settings` page
for managing the installation of documentation assets like the [Elastic
Documentation](https://www.elastic.co/docs/reference/kibana/configuration-reference/ai-assistant-settings)
used by the [Product Docs Platform
Tool](elastic#242598) and the Security
Labs content used by the `security.security_labs_search` tool

Design issue: elastic/ai-enhancements#77

<p align="center">
<img width="700"
src="https://github.com/user-attachments/assets/46d7805e-5ef1-4213-8ec9-25875a4f039d"
/>
</p> 


> [!NOTE]
> Security Labs content is not yet served up by the product docs CDN, so
it is currently a disabled placeholder until I work
elastic#244946 next. We can hide this
item for now if that is preferred.


### Implementation notes

* The `product_docs` API's are called directly from the client instead
of plumbing a new AB API. In support of this, the `llm_product_doc`
privilege was added to the `ONECHAT_FEATURE_ID`. If this is not desired,
we can remove this addition and plumb a dedicated API.
* This UI section should be conditionally visible based on if the Agent
Builder experience is enabled/feature is available. ~I need to confirm,
but I believe this is coming in
elastic#244532 This functionality has
been added.
* Client hooks for managing product docs were added to
`/ai_infra/product_doc_base` instead of `gen_ai_settings`. I originally
had them in the setting public code, but figured they made more sense
alongside the product docs. Happy to change is there is preference here.
* As previously discussed, we're only supporting installing ELSER
embeddings at the moment. ~We'll probably want to update the Platform
Docs tool do instruct the model to do query re-writing to english in
support of this.~ This is done in:
elastic#245259
* This uses the same product docs API as the O11y/Security Assistants,
so there is no compatibility issues when switching the AB experience
on/off or using the old assistants.
* RBAC support provided such that documentation management actions are
disabled unless the user has `agentBuilder['all']` Kibana feature
privileges.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [X] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [X] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

_PR developed with Cursor + Opus 4.5_

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants