# Code Execution
> 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.

- **Package:** ai-sdk-tool-code-execution
- **Author:** Vercel
- **Tags:** code-execution, sandbox

## Environment Variables
- `VERCEL_API_KEY`

## Included Tools
- **executeCode:** Execute Python code in a sandboxed Vercel Sandbox environment

## Installation
```bash
npm install ai-sdk-tool-code-execution
```

## Usage
```typescript
import { generateText, stepCountIs } 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: stepCountIs(5),
});

console.log(text);
```

## Links
- [Documentation](https://vercel.com/docs/vercel-sandbox)
- [npm](https://www.npmjs.com/package/ai-sdk-tool-code-execution)
- [GitHub](https://github.com/vercel/sandbox)

---
[Full Library Index](/library.md)