close
Skip to content

agent: Add ask_user tool using elicitation forms - #61497

Merged
ChristopherBiscardi merged 5 commits into
zed-industries:mainfrom
e-r-w:agent-ask-user-elicitation
Aug 17, 2026
Merged

agent: Add ask_user tool using elicitation forms#61497
ChristopherBiscardi merged 5 commits into
zed-industries:mainfrom
e-r-w:agent-ask-user-elicitation

Conversation

@e-r-w

@e-r-w e-r-w commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a first-party ask_user tool to Zed's native agent (crates/agent) that lets the agent ask the user a question and get an answer back through a proper elicitation form rather than free-form chat text.

This is a step towards the interactive-question experience requested in discussion #48784 (implement the ACP elicitation spec for agent questions). Zed already renders elicitation forms client-side; this wires the native agent up to that existing rail so the agent can drive single-select and/or free-text prompts.

What it does

The tool takes:

  • question — the prompt shown to the user
  • options — optional list of selectable choices (single-select)
  • allow_free_text — whether the user may type a custom answer instead of picking an option

The agent decides the shape of each question:

options allow_free_text Result
2+ false Single-select only
2+ true Single-select with a free-text "other" field
empty true Free-text only

A typed answer takes precedence over a selected option, and the tool always resolves (a cancelled or failed elicitation is reported back to the agent rather than hanging).

Demo

Screen.Recording.2026-07-24.at.9.57.02.am.mov

Implementation

  • thread.rs — new ThreadEvent::Elicitation(ElicitationRequest) variant plus ToolCallEventStream::request_elicitation, mirroring the existing prompt_for_decision permission rail.
  • agent.rs — handles the elicitation event by building a session-scoped acp::CreateElicitationRequest and routing it through AcpThread::request_elicitation, piping the response back to the tool.
  • tools/ask_user_tool.rs — the tool itself, including schema construction and response extraction.
  • Registered in the write and ask profiles and excluded from the tool-permissions setup UI.

No client-side UI changes were needed — the existing elicitation form rendering handles it.

Tests

cargo test -p agent ask_user — 5 unit tests covering schema construction, validation, and accept/decline/cancel handling.

Release Notes:

  • Added an ask_user tool that lets the agent ask the user a question with selectable options and/or free-text input, rendered as an elicitation form

@cla-bot

cla-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @e-r-w on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jul 23, 2026
@e-r-w

e-r-w commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jul 23, 2026
@cla-bot

cla-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@ChristopherBiscardi ChristopherBiscardi added the area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features label Jul 23, 2026
@e-r-w
e-r-w force-pushed the agent-ask-user-elicitation branch 2 times, most recently from 3b22caa to e508dc1 Compare August 6, 2026 02:04
@e-r-w

e-r-w commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@ChristopherBiscardi any thoughts on this? I love the zed agent and this would bring it up to speed with the other ACP agents

@e-r-w
e-r-w force-pushed the agent-ask-user-elicitation branch from e508dc1 to edc45c1 Compare August 7, 2026 02:47

@ChristopherBiscardi ChristopherBiscardi left a comment

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.

Thank you! This works wonderfully.

Image

@ChristopherBiscardi
ChristopherBiscardi added this pull request to the merge queue Aug 17, 2026
Merged via the queue into zed-industries:main with commit 632d805 Aug 17, 2026
36 checks passed
@pedropaulocs

Copy link
Copy Markdown

Until finally huehuehue Tks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants