Skip to content

fix: format AskUserQuestion tool_result per SDK spec using LLM answer…#54

Merged
hilr merged 1 commit into
mainfrom
fix/ask-user-question-response-format
Jun 16, 2026
Merged

fix: format AskUserQuestion tool_result per SDK spec using LLM answer…#54
hilr merged 1 commit into
mainfrom
fix/ask-user-question-response-format

Conversation

@quick-sort

Copy link
Copy Markdown
Owner

… parser

Use an LLM (haiku) to map the user's free-text IM reply to the structured answers format required by the Agent SDK docs:
{"questions": [...], "answers": {"": ""}}

Previously the tool_result content was a plain string, which doesn't match the documented response format. Falls back to the response field if the LLM parse fails.

Also saves the questions array in _pending_ask so the parser has the option labels as context, and removes a duplicate import re.

… parser

Use an LLM (haiku) to map the user's free-text IM reply to the structured
answers format required by the Agent SDK docs:
  {"questions": [...], "answers": {"<question>": "<label>"}}

Previously the tool_result content was a plain string, which doesn't match
the documented response format. Falls back to the `response` field if the
LLM parse fails.

Also saves the `questions` array in `_pending_ask` so the parser has the
option labels as context, and removes a duplicate `import re`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hilr
hilr merged commit 6e23e13 into main Jun 16, 2026
1 check passed
@hilr
hilr deleted the fix/ask-user-question-response-format branch June 16, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants