Resources
Latest
Frameworks
SDKs
Other
Execute Python code in a sandboxed environment using Vercel Sandbox. Run calculations, data processing, and other computational tasks safely in an isolated environment with Python 3.13.
pnpm add ai-sdk-tool-code-execution
npm install ai-sdk-tool-code-execution
yarn add ai-sdk-tool-code-execution
bun add ai-sdk-tool-code-execution
# Add to your .env file VERCEL_OIDC_TOKEN=your_api_key_here
import { generateText, isStepCount } from 'ai'; import { executeCode } from 'ai-sdk-tool-code-execution'; const { text } = await generateText({ model: 'openai/gpt-5.1-codex', prompt: 'What is 5 + 5 minus 84 cubed?', tools: { executeCode: executeCode(), }, stopWhen: isStepCount(5), }); console.log(text);