Python
TypeScript

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

from daytona import Daytona

# Untrusted code from your LLM

generated_code = """
import math

def estimate_pi(n):

inside = 0

for i in range(n):

x, y = (i * 0.61803) % 1, (i * 0.31831) % 1

if x*x + y*y <= 1: inside += 1

return 4 * inside / n

print(f"pi ~ {estimate_pi(50000):.5f}")

"""

daytona = Daytona()

sandbox = daytona.create()

response = sandbox.process.code_run(generated_code)

Console

Copy prompt
Run
Press Run button to start
13:24:01SYSCreating sandbox sb_8f2c1a…
13:24:01SYSSandbox booted in 87ms
13:25:01SYSExecuting generated code…
13:26:02STDOUTpi ~ 3.14152
13:26:02SYSProcess exited with code 0 in 142ms
Copied to clipboard