Quick Start
When to Use Code Runner
Code Runner is the right tool when you need exact answers — not approximations:| Category | Examples |
|---|---|
| Financial modeling | Compound interest, Sharpe ratio, option pricing, portfolio optimization |
| Statistical analysis | t-tests, regression, correlation, probability distributions |
| Scientific computing | Differential equations, simulations, numerical methods |
| Data processing | Aggregations, transformations, and computations on datasets |
| Precise arithmetic | Any calculation where rounding or estimation isn’t acceptable |
Iterative Execution
Code Runner doesn’t just run code once — it runs iteratively. The model writes code, executes it, inspects the output, and can run additional computations to refine the analysis:Working with Uploaded Data
Code Runner can analyze data from your uploaded files or from other tools in the same request:Saving Results
Code Runner can persist its outputs as tables and files in your Space. When you ask to “simulate and save” or “compute and create a table,” Code Runner handles both the computation and the saving in a single step:Streaming
Python
Streaming Events
| Event | Description |
|---|---|
ai_chunk | Incremental text with computation results and analysis |
ai_complete | Final response with complete results |
When to Use Code Runner vs Other Tools
| Want to… | Use |
|---|---|
| Query or filter existing data | Database Queries |
| Modify table structure (add/rename columns, merge) | Table Workshop |
| Run precise calculations, statistics, or simulations | Code Runner |
| Build a script or app to keep and reuse | Artifact Creator |