[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[AI SDK](/c/ai-sdk/62)

# Vercel AI SDK structured output and toolChoice compatibility limitations

50 views · 0 likes · 3 posts


Yuri (@yuripetusko) · 2026-03-02

I really love the new addition of allowing `output: Output.object({})` to any `generateText` calls aor `ToolLoopAgent`, this opened up a lot of new possibilities. But so many cool examples of conditional loop control conditions require to modify `toolChoice` during `prepareStep` or `prepareCall`, and in the past 14 months working with AI SDK heavily I honestly only had couple of simple cases where response can be unstructured data, as most serious use cases need a strict validation. 

## Problem
So I am wondering what is the actual underlying technical limitation of this? Is this just a limitation on the model provider’s side?

## Current Workaround
I know that there is a potential solution of just ignoring the response of main agent, and just adding a last tool that would return structured data and just looking at `result.steps` to find the last `tool_response` to get it, but this doesn’t feel right and the DX of this is pretty bad if i’m being honest.

## Question
Is there a future where `loopControl`/`toolChoice` conditions can be combined with structured output?


Yuri (@yuripetusko) · 2026-03-09

Related github issue: https://github.com/vercel/ai/issues/13075#issuecomment-4001207379


Pauline P. Narvas (@pawlean) · 2026-03-09

Thanks for sharing, Yuri! Let's continue the conversation there?