[Agent Builder] Agent does not 'forget' deleted tools that are re-created with the same name#253110
Merged
ashatova merged 29 commits intoelastic:mainfrom Feb 19, 2026
Merged
Conversation
joemcelroy
reviewed
Feb 16, 2026
joemcelroy
reviewed
Feb 16, 2026
Member
|
Could you also add FTRs for this please? This has alot of moving parts, would be great to have some coverage here. |
leemthompo
reviewed
Feb 17, 2026
Member
leemthompo
left a comment
There was a problem hiding this comment.
Noticed couple minor copy/API docs things :)
florent-leborgne
approved these changes
Feb 18, 2026
Member
florent-leborgne
left a comment
There was a problem hiding this comment.
LGTM for docs & copy
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
Page load bundle
History
|
joemcelroy
approved these changes
Feb 19, 2026
ersin-erdal
pushed a commit
to ersin-erdal/kibana
that referenced
this pull request
Feb 19, 2026
…ated with the same name (elastic#253110) Closes: elastic/search-team#12339 ## Summary When deleting a tool that is still used by agents, the API returns **409** with the list of agents. The UI shows a confirmation modal; "Yes, remove and delete" calls delete again with **`force: true`** (removes the tool from those agents, then deletes it). ## Changes - **Public DELETE route:** Optional **`force`** query (default `false`). If `false` and any agent uses the tool → 409 with `code: 'TOOL_USED_BY_AGENTS'` and `agents: [{ id, name }, ...]`. If `true` - remove refs from agents, then delete. - **Common:** **`TOOL_USED_BY_AGENTS_ERROR_CODE`** and **`AgentRef`** for the 409 response shape. - **Agents service:** **`getAgentsUsingTools(params)`** (check-only) and existing **`removeToolRefsFromAgents`**; **`runToolRefCleanup`** overloads for typing. - **Public API:** **`delete({ toolId, force })`** and **`bulkDelete(toolIds, { force })`**. - **UI:** **`use_delete_tools`** detects 409, stores **`usedByAgents`**, shows force-confirm modal; **tools_provider** renders the modal and i18n. - **Tests:** Agents service tests for **`getAgentsUsingTools`** and **`removeToolRefsFromAgents`** (including error propagation). --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: https://github.com/elastic/search-team/issues/12339
Summary
When deleting a tool that is still used by agents, the API returns 409 with the list of agents. The UI shows a confirmation modal; "Yes, remove and delete" calls delete again with
force: true(removes the tool from those agents, then deletes it).Changes
forcequery (defaultfalse). Iffalseand any agent uses the tool → 409 withcode: 'TOOL_USED_BY_AGENTS'andagents: [{ id, name }, ...]. Iftrue- remove refs from agents, then delete.TOOL_USED_BY_AGENTS_ERROR_CODEandAgentReffor the 409 response shape.getAgentsUsingTools(params)(check-only) and existingremoveToolRefsFromAgents;runToolRefCleanupoverloads for typing.delete({ toolId, force })andbulkDelete(toolIds, { force }).use_delete_toolsdetects 409, storesusedByAgents, shows force-confirm modal; tools_provider renders the modal and i18n.getAgentsUsingToolsandremoveToolRefsFromAgents(including error propagation).