Skip to content

[Agent Builder] Default value for optional params in ESQL tools#238472

Merged
chrisbmar merged 18 commits intoelastic:mainfrom
chrisbmar:agent-builder-11481-optional-param-esql-tools-frontend
Feb 10, 2026
Merged

[Agent Builder] Default value for optional params in ESQL tools#238472
chrisbmar merged 18 commits intoelastic:mainfrom
chrisbmar:agent-builder-11481-optional-param-esql-tools-frontend

Conversation

@chrisbmar
Copy link
Contributor

@chrisbmar chrisbmar commented Oct 10, 2025

Summary

closes https://github.com/elastic/search-team/issues/11481
relates to https://github.com/elastic/search-team/issues/12658 [design]

In this PR, we introduced the ability in the API for creating ESQL tools to specify a default value for parameters that were marked as optional: true

This PR focuses specifically on the frontend implementation of enabling users to set a default value (compulsory from the Kibana UI when the parameter is marked as optional) - however, it remains optional in the API for backwards compatibility. Optional parameters that do not have a default value, and where the LLM does not provide one will ultimately result in the ESQL query having invalid syntax which throws an error, hence why we're making it compulsory to provide a default value.

Before
image

After
image

Video:

Screen.Recording.2026-02-09.at.08.47.17.mov
@chrisbmar chrisbmar added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Oct 10, 2025
@chrisbmar chrisbmar self-assigned this Oct 10, 2025
@chrisbmar chrisbmar force-pushed the agent-builder-11481-optional-param-esql-tools-frontend branch from 731a3af to e9faf5b Compare February 6, 2026 15:19
@chrisbmar chrisbmar marked this pull request as ready for review February 9, 2026 08:51
@chrisbmar chrisbmar requested a review from a team as a code owner February 9, 2026 08:51
Copy link
Member

@machadoum machadoum left a comment

Choose a reason for hiding this comment

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

Hey! Thanks for implementing this super requested feature 👏 👏 👏

Let me summarize my thoughts here:

  • Form validation (esql_tool_form_validation.ts) has a full validateDefaultValueType switch that duplicates the rules in convertDefaultValueToType (integer/float/boolean/date/string/array).

  • This new field looks different than the one in the test tool page, but they both are inputs for the same ESQL field. It doesn't support the newly introduced date picker or array input.

  • Test tools don’t need all this validation because the test flyout uses schema-driven, typed controls (EuiFieldNumber, EuiSwitch, etc.), so submitted values are already numbers/booleans/strings which makes the logic is simpler.

Could we reuse the logic from the test tool page? I know it could be challenging to reuse the same react component due to the lack of space in the UI. But that would simplify the code and align the feature between the the tool and test tool page.

I am not blocking this PR with my comment, because it fixes a user problem. But I think we should address the inconsistencies it introduces soon.

Update: Adding prints for small issues I found:

Arrays Screenshot 2026-02-09 at 13 22 30

date "1"
Screenshot 2026-02-09 at 13 56 48

UI packed on small sized window / can't read default value
Screenshot 2026-02-09 at 13 20 12

@chrisbmar
Copy link
Contributor Author

chrisbmar commented Feb 9, 2026

@machadoum thanks for the amazing feedback!

I've extracted a shared EsqlParamValueInput component that maps each EsqlToolFieldType to the appropriate typed input (number field, boolean switch, date picker, combo box for array and text field for string). The default value column now uses this component, and I've removed the redundant validateDefaultValueType and convertDefaultValueToType since the typed inputs enforce correctness at the UI input level 🚀

In a separate PR, we should refactor the test_tools logic to use this new EsqlParamValueInput but I think it's out of scope for now. - let me know your thoughts here?

Also, can you please help me test the array type as I was struggling with this? It's not very intuitive. Everything else works.

Screen.Recording.2026-02-09.at.19.01.42.mov
Copy link
Member

@machadoum machadoum left a comment

Choose a reason for hiding this comment

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

Great improvement! 🚀 🚀 🚀 🚀

@chrisbmar chrisbmar enabled auto-merge (squash) February 10, 2026 08:50
@chrisbmar
Copy link
Contributor Author

/ci

@chrisbmar chrisbmar merged commit 707dc0d into elastic:main Feb 10, 2026
16 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Agent Builder API Smoke Tests #1 / Agent Builder - LLM Smoke tests EIS Models (dynamically configured) Connector: openai-gpt-oss-20b can execute a tool

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
agentBuilder 1443 1444 +1

Async chunks

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

id before after diff
agentBuilder 566.0KB 569.3KB +3.3KB

Page load bundle

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

id before after diff
agentBuilder 86.0KB 86.0KB -1.0B

History

cc @chrisbmar

mbondyra added a commit to mbondyra/kibana that referenced this pull request Feb 10, 2026
* commit '7dcc1fe3c205d2de0c3ca3f65804f21de09013c3': (285 commits)
  Enrich kbn-check-saved-objects-cli README with CI and manual usage docs (elastic#252557)
  [Discover] Add feature flag to make ESQL the default query mode (elastic#252268)
  Add maskProps.headerZindexLocation above to inspect component flyout (elastic#252543)
  [Security Solution][Atack/Alerts] Flyout header: Assignees  (elastic#252190)
  Upgrade EUI to v112.3.0 (elastic#252315)
  [Fleet] Make save_knowledge_base async in streaming state machine (elastic#252328)
  Upgrade @smithy/config-resolver 4.3.0 → 4.4.6 (elastic#252457)
  [Lens as API] Add colorMapping support for XY charts (ES|QL data layers) (elastic#252051)
  [WorkplaceAI] Add Google Drive data source and connector (elastic#250677)
  [Scout] Move GlobalSearch FTR tests to Scout (elastic#252201)
  [EDR Workflows] Fix osquery pack results display when agent clock is skewed (elastic#251417)
  [Observability Onboarding] Apply integrations limit after dedup in parseIntegrationsTSV (elastic#252486)
  [Entity Analytics] Update `host.ip` aggregation to remove painless script (elastic#252426)
  Address `@elastic/eui/require-table-caption` lint violations across `@elastic/obs-presentation-team` files (elastic#251050)
  Consolidate JSON stringify dependencies (elastic#251890)
  [index mgmt] Use esql instead of query dsl to get the index count (elastic#252422)
  Add Usage API Plugin (elastic#252434)
  Cases All Templates page (elastic#250372)
  [Agent Builder] Default value for optional params in ESQL tools (elastic#238472)
  [Fleet] Add upgrade_details.metadata.reason to AgentResponseSchema (elastic#252485)
  ...
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.4.0

5 participants