[Agent Builder] Default value for optional params in ESQL tools#238472
Conversation
a9f31e5 to
7838738
Compare
731a3af to
e9faf5b
Compare
There was a problem hiding this comment.
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:
...ent_builder/public/application/components/tools/form/validation/esql_tool_form_validation.ts
Outdated
Show resolved
Hide resolved
...k/platform/plugins/shared/agent_builder/public/application/utils/transform_esql_form_data.ts
Outdated
Show resolved
Hide resolved
|
@machadoum thanks for the amazing feedback! I've extracted a shared In a separate PR, we should refactor the 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 |
|
/ci |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
History
cc @chrisbmar |
* 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) ...



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: trueThis 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

After

Video:
Screen.Recording.2026-02-09.at.08.47.17.mov