Skip to content

Can't use any provider-defined tools with xAI #11492

@kenmueller

Description

@kenmueller

Description

AI SDK Warning (xai.chat / grok-4): The feature "provider-defined tool code_execution" is not supported.

import { xai } from "@ai-sdk/xai";
import { streamText } from "ai";

const response = streamText({
  model: xai.responses("grok-4"),
  prompt:
    "Call the web_search tool with the query 'What is the capital of France?'",
  tools: {
    web_search: xai.tools.webSearch(),
    code_execution: xai.tools.codeExecution(),
  },
});

for await (const chunk of response.fullStream) {
  console.dir(chunk, { depth: null });
}

AI SDK Version

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions