[Obs AI Assistant] aware of new .integration_knowledge* system index#237085
Conversation
|
Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant) |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
…urce-definitions/scripts/fix-location-collection.ts'
| esClient: { asCurrentUser: ElasticsearchClient; asInternalUser: ElasticsearchClient }; | ||
| }): Promise<RecalledEntry[]> { | ||
| try { | ||
| const indexExists = await esClient.asInternalUser.indices.exists({ |
There was a problem hiding this comment.
while working on the security AI assistant piece for this work (#236197), I found that kibana_system does not have permission to call indices.exists(), nor does it have permission to call indices.get(). both calls would result in an error being thrown from ES
yes... it's weird, apparently read permissions for this index is apparently not sufficient to access these two "simple" index checks
we decided to implement an empty search as a workaround to check against index existence:
There was a problem hiding this comment.
@jen-huang thanks for pointing that out. I’ve removed the index existence check. The code now handles missing indexes in the try/catch block. If an error occurs (e.g., the index doesn’t exist), it will log the error and return an empty list of retrieved documents.
[2025-10-13T18:15:40.344+02:00][ERROR][plugins.observabilityAIAssistant.service.kb] Error recalling from .integration_knowledge index
[2025-10-13T18:15:40.345+02:00][DEBUG][plugins.observabilityAIAssistant.service.kb] ResponseError: index_not_found_exception
Root causes:
index_not_found_exception: no such index [.integration_knowledge]
at KibanaTransport._request (/Users/arturoliduena/arturoliduena/kibana/node_modules/@elastic/elasticsearch/node_modules/@elastic/transport/src/Transport.ts:591:17)
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at /Users/arturoliduena/arturoliduena/kibana/node_modules/@elastic/elasticsearch/node_modules/@elastic/transport/src/Transport.ts:697:22
at KibanaTransport.request (/Users/arturoliduena/arturoliduena/kibana/node_modules/@elastic/elasticsearch/node_modules/@elastic/transport/src/Transport.ts:694:14)
neptunian
left a comment
There was a problem hiding this comment.
This looks good. Verified documents are being recalled using Phoenix and logs. Can approve after making @jen-huang's change.
thanks @neptunian, I already applied @jen-huang 's suggestion. I removed |
⏳ Build in-progress
History
|
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…lastic#237085) Closes elastic/obs-ai-team#357 ## Summary This PR adds the awareness of `.integration_knowledge*` index as another index for recalling. The Obs AI Assistant will retrieve integration knowledge from the index Value added to the Obs AI Assistant (elastic/obs-ai-team#357 (comment)): > The assistant will become aware of LLM-facing documentation for any installed integrations in the user's cluster. For example, the Logstash integration might ship documentation that explains how to understand the health reporting metrics collected by the integration and the assistant could answer prompts like "why was my logstash server down yesterday?" using the user's real data. Manual Testing: 1 -> Follow the instructions from elastic#230107 (comment): > 1. If elastic/elasticsearch#132506 has been merged, run `yarn es snapshot` in Kibana, otherwise, checkout that branch in your local ES and then in kibana run `yarn es source` in order to use that version of ES which contains the index management, mappings, etc. >2. Install a package with any number of knowledge base docs in the `docs/knowledge_base` folder. You can use [this sample package](https://github.com/user-attachments/files/21867395/masonstestpackage-0.0.1.zip), or create your own following the guide below: > > - Using `elastic-package`, create a new package using `elastic-package create integration` - Once created add `knowledge_base` as a folder inside of the generated `docs` folder of the integration - Add an arbitrary amount of `.md` files to the knowledge_base folder - Run `elastic-package build` to build the package - There are a lot of different options for installing the package in a local kibana instance. I prefer to just take the generated .zip folder from `/build` in `elastic-package` and upload it to kibana using the custom integrations feature. You can also expose the package registry, or whatever you see fit. >3. Watch the Kibana logs for errors/debug messages etc >4. Use the new endpoint or just directly check the index using `GET /.integration_knowledge/_search` to verify that the documents are ingested into the system index of `.integration_knowledge` >5. Update the package and verify that the KB documents are updated by checking the response again, they should have the updated pkgVersion on the associated docs. >6. Remove the package and then verify (using the endpoint) that the docs are removed from the index 2 - Ask the AI Assistant about information contained in the integration documents 3- check that the documents are listed on the response of executed the function context inside learnings ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] 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 - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] 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) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Sandra G <neptunian@users.noreply.github.com> (cherry picked from commit 15878ad)
…index (#237085) (#239263) Closes elastic/obs-ai-team#380 # Backport This will backport the following commits from `main` to `9.2`: - [[Obs AI Assistant] aware of new .integration_knowledge* system index (#237085)](#237085) <!--- Backport version: 10.0.2 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Arturo Lidueña","email":"arturo.liduena@elastic.co"},"sourceCommit":{"committedDate":"2025-10-14T07:13:31Z","message":"[Obs AI Assistant] aware of new .integration_knowledge* system index (#237085)\n\nCloses https://github.com/elastic/obs-ai-assistant-team/issues/357\n## Summary\n\nThis PR adds the awareness of `.integration_knowledge*` index as another\nindex for recalling. The Obs AI Assistant will retrieve integration\nknowledge from the index\n\nValue added to the Obs AI Assistant\n(https://github.com/elastic/obs-ai-assistant-team/issues/357#issuecomment-3303692842):\n> The assistant will become aware of LLM-facing documentation for any\ninstalled integrations in the user's cluster. For example, the Logstash\nintegration might ship documentation that explains how to understand the\nhealth reporting metrics collected by the integration and the assistant\ncould answer prompts like \"why was my logstash server down yesterday?\"\nusing the user's real data.\n\nManual Testing: \n1 -> Follow the instructions from\nhttps://github.com//pull/230107#issue-3281157774:\n\n> 1. If elastic/elasticsearch#132506 has been\nmerged, run `yarn es snapshot` in Kibana, otherwise, checkout that\nbranch in your local ES and then in kibana run `yarn es source` in order\nto use that version of ES which contains the index management, mappings,\netc.\n>2. Install a package with any number of knowledge base docs in the\n`docs/knowledge_base` folder. You can use [this sample\npackage](https://github.com/user-attachments/files/21867395/masonstestpackage-0.0.1.zip),\nor create your own following the guide below:\n>\n> - Using `elastic-package`, create a new package using `elastic-package\ncreate integration`\n- Once created add `knowledge_base` as a folder inside of the generated\n`docs` folder of the integration\n- Add an arbitrary amount of `.md` files to the knowledge_base folder\n - Run `elastic-package build` to build the package\n- There are a lot of different options for installing the package in a\nlocal kibana instance. I prefer to just take the generated .zip folder\nfrom `/build` in `elastic-package` and upload it to kibana using the\ncustom integrations feature. You can also expose the package registry,\nor whatever you see fit.\n>3. Watch the Kibana logs for errors/debug messages etc\n>4. Use the new endpoint or just directly check the index using `GET\n/.integration_knowledge/_search` to verify that the documents are\ningested into the system index of `.integration_knowledge`\n>5. Update the package and verify that the KB documents are updated by\nchecking the response again, they should have the updated pkgVersion on\nthe associated docs.\n>6. Remove the package and then verify (using the endpoint) that the\ndocs are removed from the index\n\n2 - Ask the AI Assistant about information contained in the integration\ndocuments\n\n3- check that the documents are listed on the response of executed the\nfunction context inside learnings\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Sandra G <neptunian@users.noreply.github.com>","sha":"15878ad8a124539d4698de2510fd5d6ad90b8d38","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","backport:skip","Team:Obs AI Assistant","ci:project-deploy-observability","v9.3.0"],"title":"[Obs AI Assistant] aware of new .integration_knowledge* system index","number":237085,"url":"https://github.com/elastic/kibana/pull/237085","mergeCommit":{"message":"[Obs AI Assistant] aware of new .integration_knowledge* system index (#237085)\n\nCloses https://github.com/elastic/obs-ai-assistant-team/issues/357\n## Summary\n\nThis PR adds the awareness of `.integration_knowledge*` index as another\nindex for recalling. The Obs AI Assistant will retrieve integration\nknowledge from the index\n\nValue added to the Obs AI Assistant\n(https://github.com/elastic/obs-ai-assistant-team/issues/357#issuecomment-3303692842):\n> The assistant will become aware of LLM-facing documentation for any\ninstalled integrations in the user's cluster. For example, the Logstash\nintegration might ship documentation that explains how to understand the\nhealth reporting metrics collected by the integration and the assistant\ncould answer prompts like \"why was my logstash server down yesterday?\"\nusing the user's real data.\n\nManual Testing: \n1 -> Follow the instructions from\nhttps://github.com//pull/230107#issue-3281157774:\n\n> 1. If elastic/elasticsearch#132506 has been\nmerged, run `yarn es snapshot` in Kibana, otherwise, checkout that\nbranch in your local ES and then in kibana run `yarn es source` in order\nto use that version of ES which contains the index management, mappings,\netc.\n>2. Install a package with any number of knowledge base docs in the\n`docs/knowledge_base` folder. You can use [this sample\npackage](https://github.com/user-attachments/files/21867395/masonstestpackage-0.0.1.zip),\nor create your own following the guide below:\n>\n> - Using `elastic-package`, create a new package using `elastic-package\ncreate integration`\n- Once created add `knowledge_base` as a folder inside of the generated\n`docs` folder of the integration\n- Add an arbitrary amount of `.md` files to the knowledge_base folder\n - Run `elastic-package build` to build the package\n- There are a lot of different options for installing the package in a\nlocal kibana instance. I prefer to just take the generated .zip folder\nfrom `/build` in `elastic-package` and upload it to kibana using the\ncustom integrations feature. You can also expose the package registry,\nor whatever you see fit.\n>3. Watch the Kibana logs for errors/debug messages etc\n>4. Use the new endpoint or just directly check the index using `GET\n/.integration_knowledge/_search` to verify that the documents are\ningested into the system index of `.integration_knowledge`\n>5. Update the package and verify that the KB documents are updated by\nchecking the response again, they should have the updated pkgVersion on\nthe associated docs.\n>6. Remove the package and then verify (using the endpoint) that the\ndocs are removed from the index\n\n2 - Ask the AI Assistant about information contained in the integration\ndocuments\n\n3- check that the documents are listed on the response of executed the\nfunction context inside learnings\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Sandra G <neptunian@users.noreply.github.com>","sha":"15878ad8a124539d4698de2510fd5d6ad90b8d38"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/237085","number":237085,"mergeCommit":{"message":"[Obs AI Assistant] aware of new .integration_knowledge* system index (#237085)\n\nCloses https://github.com/elastic/obs-ai-assistant-team/issues/357\n## Summary\n\nThis PR adds the awareness of `.integration_knowledge*` index as another\nindex for recalling. The Obs AI Assistant will retrieve integration\nknowledge from the index\n\nValue added to the Obs AI Assistant\n(https://github.com/elastic/obs-ai-assistant-team/issues/357#issuecomment-3303692842):\n> The assistant will become aware of LLM-facing documentation for any\ninstalled integrations in the user's cluster. For example, the Logstash\nintegration might ship documentation that explains how to understand the\nhealth reporting metrics collected by the integration and the assistant\ncould answer prompts like \"why was my logstash server down yesterday?\"\nusing the user's real data.\n\nManual Testing: \n1 -> Follow the instructions from\nhttps://github.com//pull/230107#issue-3281157774:\n\n> 1. If elastic/elasticsearch#132506 has been\nmerged, run `yarn es snapshot` in Kibana, otherwise, checkout that\nbranch in your local ES and then in kibana run `yarn es source` in order\nto use that version of ES which contains the index management, mappings,\netc.\n>2. Install a package with any number of knowledge base docs in the\n`docs/knowledge_base` folder. You can use [this sample\npackage](https://github.com/user-attachments/files/21867395/masonstestpackage-0.0.1.zip),\nor create your own following the guide below:\n>\n> - Using `elastic-package`, create a new package using `elastic-package\ncreate integration`\n- Once created add `knowledge_base` as a folder inside of the generated\n`docs` folder of the integration\n- Add an arbitrary amount of `.md` files to the knowledge_base folder\n - Run `elastic-package build` to build the package\n- There are a lot of different options for installing the package in a\nlocal kibana instance. I prefer to just take the generated .zip folder\nfrom `/build` in `elastic-package` and upload it to kibana using the\ncustom integrations feature. You can also expose the package registry,\nor whatever you see fit.\n>3. Watch the Kibana logs for errors/debug messages etc\n>4. Use the new endpoint or just directly check the index using `GET\n/.integration_knowledge/_search` to verify that the documents are\ningested into the system index of `.integration_knowledge`\n>5. Update the package and verify that the KB documents are updated by\nchecking the response again, they should have the updated pkgVersion on\nthe associated docs.\n>6. Remove the package and then verify (using the endpoint) that the\ndocs are removed from the index\n\n2 - Ask the AI Assistant about information contained in the integration\ndocuments\n\n3- check that the documents are listed on the response of executed the\nfunction context inside learnings\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Sandra G <neptunian@users.noreply.github.com>","sha":"15878ad8a124539d4698de2510fd5d6ad90b8d38"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Sandra G <neptunian@users.noreply.github.com> Co-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com>
…lastic#237085) Closes elastic/obs-ai-team#357 ## Summary This PR adds the awareness of `.integration_knowledge*` index as another index for recalling. The Obs AI Assistant will retrieve integration knowledge from the index Value added to the Obs AI Assistant (elastic/obs-ai-team#357 (comment)): > The assistant will become aware of LLM-facing documentation for any installed integrations in the user's cluster. For example, the Logstash integration might ship documentation that explains how to understand the health reporting metrics collected by the integration and the assistant could answer prompts like "why was my logstash server down yesterday?" using the user's real data. Manual Testing: 1 -> Follow the instructions from elastic#230107 (comment): > 1. If elastic/elasticsearch#132506 has been merged, run `yarn es snapshot` in Kibana, otherwise, checkout that branch in your local ES and then in kibana run `yarn es source` in order to use that version of ES which contains the index management, mappings, etc. >2. Install a package with any number of knowledge base docs in the `docs/knowledge_base` folder. You can use [this sample package](https://github.com/user-attachments/files/21867395/masonstestpackage-0.0.1.zip), or create your own following the guide below: > > - Using `elastic-package`, create a new package using `elastic-package create integration` - Once created add `knowledge_base` as a folder inside of the generated `docs` folder of the integration - Add an arbitrary amount of `.md` files to the knowledge_base folder - Run `elastic-package build` to build the package - There are a lot of different options for installing the package in a local kibana instance. I prefer to just take the generated .zip folder from `/build` in `elastic-package` and upload it to kibana using the custom integrations feature. You can also expose the package registry, or whatever you see fit. >3. Watch the Kibana logs for errors/debug messages etc >4. Use the new endpoint or just directly check the index using `GET /.integration_knowledge/_search` to verify that the documents are ingested into the system index of `.integration_knowledge` >5. Update the package and verify that the KB documents are updated by checking the response again, they should have the updated pkgVersion on the associated docs. >6. Remove the package and then verify (using the endpoint) that the docs are removed from the index 2 - Ask the AI Assistant about information contained in the integration documents 3- check that the documents are listed on the response of executed the function context inside learnings ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] 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 - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] 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) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
…lastic#237085) Closes elastic/obs-ai-team#357 ## Summary This PR adds the awareness of `.integration_knowledge*` index as another index for recalling. The Obs AI Assistant will retrieve integration knowledge from the index Value added to the Obs AI Assistant (elastic/obs-ai-team#357 (comment)): > The assistant will become aware of LLM-facing documentation for any installed integrations in the user's cluster. For example, the Logstash integration might ship documentation that explains how to understand the health reporting metrics collected by the integration and the assistant could answer prompts like "why was my logstash server down yesterday?" using the user's real data. Manual Testing: 1 -> Follow the instructions from elastic#230107 (comment): > 1. If elastic/elasticsearch#132506 has been merged, run `yarn es snapshot` in Kibana, otherwise, checkout that branch in your local ES and then in kibana run `yarn es source` in order to use that version of ES which contains the index management, mappings, etc. >2. Install a package with any number of knowledge base docs in the `docs/knowledge_base` folder. You can use [this sample package](https://github.com/user-attachments/files/21867395/masonstestpackage-0.0.1.zip), or create your own following the guide below: > > - Using `elastic-package`, create a new package using `elastic-package create integration` - Once created add `knowledge_base` as a folder inside of the generated `docs` folder of the integration - Add an arbitrary amount of `.md` files to the knowledge_base folder - Run `elastic-package build` to build the package - There are a lot of different options for installing the package in a local kibana instance. I prefer to just take the generated .zip folder from `/build` in `elastic-package` and upload it to kibana using the custom integrations feature. You can also expose the package registry, or whatever you see fit. >3. Watch the Kibana logs for errors/debug messages etc >4. Use the new endpoint or just directly check the index using `GET /.integration_knowledge/_search` to verify that the documents are ingested into the system index of `.integration_knowledge` >5. Update the package and verify that the KB documents are updated by checking the response again, they should have the updated pkgVersion on the associated docs. >6. Remove the package and then verify (using the endpoint) that the docs are removed from the index 2 - Ask the AI Assistant about information contained in the integration documents 3- check that the documents are listed on the response of executed the function context inside learnings ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] 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 - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] 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) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
…lastic#237085) Closes elastic/obs-ai-team#357 ## Summary This PR adds the awareness of `.integration_knowledge*` index as another index for recalling. The Obs AI Assistant will retrieve integration knowledge from the index Value added to the Obs AI Assistant (elastic/obs-ai-team#357 (comment)): > The assistant will become aware of LLM-facing documentation for any installed integrations in the user's cluster. For example, the Logstash integration might ship documentation that explains how to understand the health reporting metrics collected by the integration and the assistant could answer prompts like "why was my logstash server down yesterday?" using the user's real data. Manual Testing: 1 -> Follow the instructions from elastic#230107 (comment): > 1. If elastic/elasticsearch#132506 has been merged, run `yarn es snapshot` in Kibana, otherwise, checkout that branch in your local ES and then in kibana run `yarn es source` in order to use that version of ES which contains the index management, mappings, etc. >2. Install a package with any number of knowledge base docs in the `docs/knowledge_base` folder. You can use [this sample package](https://github.com/user-attachments/files/21867395/masonstestpackage-0.0.1.zip), or create your own following the guide below: > > - Using `elastic-package`, create a new package using `elastic-package create integration` - Once created add `knowledge_base` as a folder inside of the generated `docs` folder of the integration - Add an arbitrary amount of `.md` files to the knowledge_base folder - Run `elastic-package build` to build the package - There are a lot of different options for installing the package in a local kibana instance. I prefer to just take the generated .zip folder from `/build` in `elastic-package` and upload it to kibana using the custom integrations feature. You can also expose the package registry, or whatever you see fit. >3. Watch the Kibana logs for errors/debug messages etc >4. Use the new endpoint or just directly check the index using `GET /.integration_knowledge/_search` to verify that the documents are ingested into the system index of `.integration_knowledge` >5. Update the package and verify that the KB documents are updated by checking the response again, they should have the updated pkgVersion on the associated docs. >6. Remove the package and then verify (using the endpoint) that the docs are removed from the index 2 - Ask the AI Assistant about information contained in the integration documents 3- check that the documents are listed on the response of executed the function context inside learnings ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] 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 - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] 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) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
…lastic#237085) Closes elastic/obs-ai-team#357 ## Summary This PR adds the awareness of `.integration_knowledge*` index as another index for recalling. The Obs AI Assistant will retrieve integration knowledge from the index Value added to the Obs AI Assistant (elastic/obs-ai-team#357 (comment)): > The assistant will become aware of LLM-facing documentation for any installed integrations in the user's cluster. For example, the Logstash integration might ship documentation that explains how to understand the health reporting metrics collected by the integration and the assistant could answer prompts like "why was my logstash server down yesterday?" using the user's real data. Manual Testing: 1 -> Follow the instructions from elastic#230107 (comment): > 1. If elastic/elasticsearch#132506 has been merged, run `yarn es snapshot` in Kibana, otherwise, checkout that branch in your local ES and then in kibana run `yarn es source` in order to use that version of ES which contains the index management, mappings, etc. >2. Install a package with any number of knowledge base docs in the `docs/knowledge_base` folder. You can use [this sample package](https://github.com/user-attachments/files/21867395/masonstestpackage-0.0.1.zip), or create your own following the guide below: > > - Using `elastic-package`, create a new package using `elastic-package create integration` - Once created add `knowledge_base` as a folder inside of the generated `docs` folder of the integration - Add an arbitrary amount of `.md` files to the knowledge_base folder - Run `elastic-package build` to build the package - There are a lot of different options for installing the package in a local kibana instance. I prefer to just take the generated .zip folder from `/build` in `elastic-package` and upload it to kibana using the custom integrations feature. You can also expose the package registry, or whatever you see fit. >3. Watch the Kibana logs for errors/debug messages etc >4. Use the new endpoint or just directly check the index using `GET /.integration_knowledge/_search` to verify that the documents are ingested into the system index of `.integration_knowledge` >5. Update the package and verify that the KB documents are updated by checking the response again, they should have the updated pkgVersion on the associated docs. >6. Remove the package and then verify (using the endpoint) that the docs are removed from the index 2 - Ask the AI Assistant about information contained in the integration documents 3- check that the documents are listed on the response of executed the function context inside learnings ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] 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 - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] 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) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
## Summary Adds an integration knowledge tool to Agent Builder that retrieves documentation from Fleet-installed integrations using semantic search on the `.integration_knowledge` index. The tool uses the conditional availability pattern and is only available when the integration knowledge index exists. <p align="center"> <img width="405" src="https://github.com/user-attachments/assets/640d4f54-34cc-47e3-b731-b3913139e84e" /> <img width="395" src="https://github.com/user-attachments/assets/fd66c044-5536-4947-98d8-45e4b168b34c" /> </p> ## Changes * Added `platform.core.integration_knowledge` builtin tool to `agent_builder_platform` that searches Fleet integration documentation * Tool is registered in plugin `setup()` with conditional availability using the `availability` configuration pattern * Availability is checked at runtime via ES search on `.integration_knowledge` index (using `size: 0` query) * Returns structured resource results with package name, version, filename, and content ## Technical Details * Tool registration added to `registerTools()` in plugin `setup()` phase, following the same pattern as `productDocumentationTool` * Uses `availability` configuration with `cacheMode: 'space'` to conditionally show/hide the tool based on index availability * Searches using Elasticsearch semantic search on the `content` field * `esClient.asInternalUser` is used for both handler execution and availability checking (index permissions require internal user) * Results include reference URLs to integration detail pages (`/app/integrations/detail/{package_name}`) ## Considerations * Tool requires Fleet to have indexed integration knowledge into `.integration_knowledge` * Tool availability is checked per-space and cached for performance * No Kibana restart required - tool appears/disappears dynamically based on index availability * This is the onechat/Agent Builder equivalent of the existing `IntegrationKnowledgeTool` in Security Solution's Assistant (#236197) and Observability Solution's Assistant (#237085) added in `9.2`. --- ## Testing > [!NOTE] > You must enable the `xpack.fleet.enableExperimental: ["installIntegrationsKnowledge"]` feature flag until this PR enabling it by default is merged (#245080). 1. Upload this sample [system-2.3.3-NEXT.zip](https://github.com/user-attachments/files/22546766/system-2.3.3-NEXT.zip) package via Integrations > Create new integration - The test package just copies the existing `docs/README.md` to `docs/knowledge_base/README.md` so that Fleet ingests it into `.integrations_knowledge` 2. Create new Agent with the new Integration Knowledge tool and ask questions related to system integrations, such as: - How can I collect CPU and memory data for my windows host? - What OS can I run the system integration on? - What does the system integration do? 3. Observe that the responses returned contain relevant information that is cited from the system integration. _PR developed with Cursor + Opus 4.5_ --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
) ## Summary Adds an integration knowledge tool to Agent Builder that retrieves documentation from Fleet-installed integrations using semantic search on the `.integration_knowledge` index. The tool uses the conditional availability pattern and is only available when the integration knowledge index exists. <p align="center"> <img width="405" src="https://github.com/user-attachments/assets/640d4f54-34cc-47e3-b731-b3913139e84e" /> <img width="395" src="https://github.com/user-attachments/assets/fd66c044-5536-4947-98d8-45e4b168b34c" /> </p> ## Changes * Added `platform.core.integration_knowledge` builtin tool to `agent_builder_platform` that searches Fleet integration documentation * Tool is registered in plugin `setup()` with conditional availability using the `availability` configuration pattern * Availability is checked at runtime via ES search on `.integration_knowledge` index (using `size: 0` query) * Returns structured resource results with package name, version, filename, and content ## Technical Details * Tool registration added to `registerTools()` in plugin `setup()` phase, following the same pattern as `productDocumentationTool` * Uses `availability` configuration with `cacheMode: 'space'` to conditionally show/hide the tool based on index availability * Searches using Elasticsearch semantic search on the `content` field * `esClient.asInternalUser` is used for both handler execution and availability checking (index permissions require internal user) * Results include reference URLs to integration detail pages (`/app/integrations/detail/{package_name}`) ## Considerations * Tool requires Fleet to have indexed integration knowledge into `.integration_knowledge` * Tool availability is checked per-space and cached for performance * No Kibana restart required - tool appears/disappears dynamically based on index availability * This is the onechat/Agent Builder equivalent of the existing `IntegrationKnowledgeTool` in Security Solution's Assistant (elastic#236197) and Observability Solution's Assistant (elastic#237085) added in `9.2`. --- ## Testing > [!NOTE] > You must enable the `xpack.fleet.enableExperimental: ["installIntegrationsKnowledge"]` feature flag until this PR enabling it by default is merged (elastic#245080). 1. Upload this sample [system-2.3.3-NEXT.zip](https://github.com/user-attachments/files/22546766/system-2.3.3-NEXT.zip) package via Integrations > Create new integration - The test package just copies the existing `docs/README.md` to `docs/knowledge_base/README.md` so that Fleet ingests it into `.integrations_knowledge` 2. Create new Agent with the new Integration Knowledge tool and ask questions related to system integrations, such as: - How can I collect CPU and memory data for my windows host? - What OS can I run the system integration on? - What does the system integration do? 3. Observe that the responses returned contain relevant information that is cited from the system integration. _PR developed with Cursor + Opus 4.5_ --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/obs-ai-assistant-team/issues/357
Summary
This PR adds the awareness of
.integration_knowledge*index as another index for recalling. The Obs AI Assistant will retrieve integration knowledge from the indexValue added to the Obs AI Assistant (https://github.com/elastic/obs-ai-assistant-team/issues/357#issuecomment-3303692842):
Manual Testing:
1 -> Follow the instructions from #230107 (comment):
2 - Ask the AI Assistant about information contained in the integration documents
3- check that the documents are listed on the response of executed the function context inside learnings
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.Identify risks
Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.