Skip to content

[Agent Builder] APM error AI insights #243734

Merged
viduni94 merged 90 commits intoelastic:mainfrom
viduni94:agent-builder-error-sample-contextual-insights
Dec 11, 2025
Merged

[Agent Builder] APM error AI insights #243734
viduni94 merged 90 commits intoelastic:mainfrom
viduni94:agent-builder-error-sample-contextual-insights

Conversation

@viduni94
Copy link
Copy Markdown
Contributor

@viduni94 viduni94 commented Nov 20, 2025

Closes https://github.com/elastic/obs-ai-assistant-team/issues/413

Summary

This PR handles APM error AI insights via Agent Builder.

Attachments:

  • AI_INSIGHT attachment type with AI Insight summary
  • ERROR attachment with errorId and other params to fetch the error document.

Additions

  • Adds an API to pre-fetch the error data and generate an LLM response by calling the inference client.
  • Once the summary is generated it's showed inline on the page (uses the common component)
  • The user can click on "Start conversation" which opens to the agent builder flyout to continue the conversation along with the AI_INSIGHT attachment and ERROR attachment.
  • When the user opens the agent builder flyout from an error page using the global nav button, the ERROR attachment is added to the context of the flyout.
  • License check before rendering AI insights (we may want to make this part of the shared component)

To enable agent builder and the nav:

uiSettings:
  overrides:
    agentBuilder:navEnabled: true
    agentBuilder:enabled: true

To see the AI insight, feature flag must be enabled for now. This feature will be hidden on main for now behind this flag until the Gen AI Setting is available.

feature_flags.overrides:
  observabilityAgent.enabled: true

UI for AI insights

This PR consumes the common UI component in the observability-agent-builder package.

Testing

Observability test clusters were used for testing.

Testing instructions

  1. Connect to a Observability test cluster
  2. In Kibana, go to "Observability" --> "Service Inventory"
  3. Pick a service and visit the "Error" tab and select an error
  4. Click on "What's this error"

Screen recording

AI INSIGHTS:

522162938-e40dd31b-264e-47e1-b8e8-dec5f7e85897.mov

GLOBAL NAV:

522529317-5ffda2f5-1131-48c3-99c2-612bd5bfca87.mov

Flaky test runner - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/10052

Checklist

@viduni94 viduni94 self-assigned this Nov 20, 2025
@viduni94 viduni94 changed the title [Agent Builder] Experiment one attachment type for APM errors [Agent Builder] Observability error attachment Nov 24, 2025
@viduni94 viduni94 added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Nov 25, 2025
@viduni94 viduni94 changed the title [Agent Builder] Observability error attachment [Agent Builder] Observability "error" attachment Nov 25, 2025
Copy link
Copy Markdown
Contributor

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

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

Looks good!

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#10052

[✅] x-pack/solutions/observability/test/api_integration_deployment_agnostic/feature_flag_configs/stateful/oblt.ai_agent.stateful.config.ts: 50/50 tests passed.

see run history

@neptunian
Copy link
Copy Markdown
Contributor

neptunian commented Dec 10, 2025

Your serverless tests will fail because they need to be registered sync https://github.com/elastic/kibana/pull/244023/files#diff-31fd5a7a673266714e7b4d8b96c619111a6f01f3d4642e24622787b6b7082cc4 . I went ahead and made the change in my PR since we're removing that feature flag async call in #245299

@viduni94
Copy link
Copy Markdown
Contributor Author

Your serverless tests will fail because they need to be registered sync https://github.com/elastic/kibana/pull/244023/files#diff-31fd5a7a673266714e7b4d8b96c619111a6f01f3d4642e24622787b6b7082cc4 . I went ahead and made the change in my PR since we're removing that feature flag async call in #245299

Thanks @neptunian
Updated

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 2044 2065 +21

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
observabilityAgentBuilder 24 29 +5

Async chunks

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

id before after diff
apm 2.8MB 2.9MB +9.4KB
Unknown metric groups

API count

id before after diff
observabilityAgentBuilder 24 29 +5

History

cc @viduni94

Copy link
Copy Markdown
Contributor

@rmyz rmyz left a comment

Choose a reason for hiding this comment

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

small nit

@@ -0,0 +1,19 @@
/*
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.

I would move this file to be a custom hook, this way, you could use useApmPluginContext directly instead of from params

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @rmyz
Thank you for the review!

This was a temporary feature flag and I have a PR to remove it - #245299
Therefore, is it okay to keep this as is for now?
It'll be removed before 9.3 FF

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.

sure, approving

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot 🙏🏻

@viduni94 viduni94 merged commit 6cf385c into elastic:main Dec 11, 2025
12 checks passed
andrimal pushed a commit to andrimal/kibana that referenced this pull request Dec 11, 2025
Closes elastic/obs-ai-team#413

## Summary

This PR handles APM error AI insights via Agent Builder.

Attachments:
- `AI_INSIGHT` attachment type with AI Insight summary
- `ERROR` attachment with `errorId` and other params to fetch the error
document.

### Additions
- Adds an API to pre-fetch the error data and generate an LLM response
by calling the inference client.
- Once the summary is generated it's showed inline on the page (uses the
common component)
- The user can click on "Start conversation" which opens to the agent
builder flyout to continue the conversation along with the `AI_INSIGHT`
attachment and `ERROR` attachment.
- When the user opens the agent builder flyout from an error page using
the global nav button, the ERROR attachment is added to the context of
the flyout.
- License check before rendering AI insights (we may want to make this
part of the shared component)

To enable agent builder and the nav:
```
uiSettings:
  overrides:
    agentBuilder:navEnabled: true
    agentBuilder:enabled: true
```

To see the AI insight, feature flag must be enabled for now. This
feature will be hidden on main for now behind this flag until the Gen AI
Setting is available.

```
feature_flags.overrides:
  observabilityAgent.enabled: true
```

### UI for AI insights
This PR consumes the common UI component in the
`observability-agent-builder` package.

### Testing
Observability test clusters were used for testing.

#### Testing instructions
1. Connect to a Observability test cluster
2. In Kibana, go to "Observability" --> "Service Inventory"
3. Pick a service and visit the "Error" tab and select an error
4. Click on "What's this error"

### Screen recording

AI INSIGHTS:


https://github.com/user-attachments/assets/d1b0b2b2-9805-4737-8929-e27319164649

GLOBAL NAV:


https://github.com/user-attachments/assets/2e310f4b-563b-4681-83cb-fd2581936b3a

Flaky test runner -
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/10052

### Checklist

- [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)
- [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)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
seanrathier pushed a commit to seanrathier/kibana that referenced this pull request Dec 15, 2025
Closes elastic/obs-ai-team#413

## Summary

This PR handles APM error AI insights via Agent Builder.

Attachments:
- `AI_INSIGHT` attachment type with AI Insight summary
- `ERROR` attachment with `errorId` and other params to fetch the error
document.

### Additions
- Adds an API to pre-fetch the error data and generate an LLM response
by calling the inference client.
- Once the summary is generated it's showed inline on the page (uses the
common component)
- The user can click on "Start conversation" which opens to the agent
builder flyout to continue the conversation along with the `AI_INSIGHT`
attachment and `ERROR` attachment.
- When the user opens the agent builder flyout from an error page using
the global nav button, the ERROR attachment is added to the context of
the flyout.
- License check before rendering AI insights (we may want to make this
part of the shared component)

To enable agent builder and the nav:
```
uiSettings:
  overrides:
    agentBuilder:navEnabled: true
    agentBuilder:enabled: true
```

To see the AI insight, feature flag must be enabled for now. This
feature will be hidden on main for now behind this flag until the Gen AI
Setting is available.

```
feature_flags.overrides:
  observabilityAgent.enabled: true
```

### UI for AI insights
This PR consumes the common UI component in the
`observability-agent-builder` package.

### Testing
Observability test clusters were used for testing.

#### Testing instructions
1. Connect to a Observability test cluster
2. In Kibana, go to "Observability" --> "Service Inventory"
3. Pick a service and visit the "Error" tab and select an error
4. Click on "What's this error"

### Screen recording

AI INSIGHTS:


https://github.com/user-attachments/assets/d1b0b2b2-9805-4737-8929-e27319164649

GLOBAL NAV:


https://github.com/user-attachments/assets/2e310f4b-563b-4681-83cb-fd2581936b3a

Flaky test runner -
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/10052

### Checklist

- [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)
- [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)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

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 Team:obs-ai Observability AI team Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants