Skip to main content
Google’s code execution tool runs Python in a sandboxed environment. State persists across turns, allowing multi-step computations and file generation.

Enable Code Execution

Multi-Turn Execution

State persists across conversation turns, enabling iterative workflows:

Generated Files

Files created during code execution (images, CSVs, etc.) are attached as DataPart instances on the assistant message:

Combined Tools

Enable both search and code execution for research + computation workflows:

Example