Skip to content

[FEAT]: add missing prepareStep callback from AI SDK #1187

@sapkra

Description

@sapkra

Is your feature request related to a problem? Please describe.

i need this to add or remove tools from steps to control what the agent can do in each step

e.g.

// Step 0: model may call data tools (toolChoice: auto).
// Step 1+: force text-only — no more tool calls. The output schema
// then ensures the text is valid structured JSON. This guarantees a
// response even when step 0 called tools, without any tool-as-output hack.
prepareStep: ({ steps }) => (steps.length > 0 ? { toolChoice: 'none' } : {}),

Describe alternatives you've considered

No response

Additional context

No response

Describe the thing to improve

https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling#preparestep-callback

prepareStep is missing in Agent options

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions