# Daytona — Secure Sandboxes for AI Code Execution > Elastic infrastructure for running AI-generated code safely. SDKs for Python, TypeScript, Go. By Daytona. 71K+ GitHub stars. ## Install Copy the content below into your project: # Daytona — Secure Sandboxes for AI Code Execution ## Quick Use ```bash pip install daytona-sdk ``` ```python from daytona_sdk import Daytona daytona = Daytona() # Create a sandboxed environment sandbox = daytona.create() # Execute AI-generated code safely response = sandbox.process.code_run('print("Hello from sandbox!")') print(response.result) # File operations in the sandbox sandbox.fs.upload_file('/app/script.py', 'print(42 * 42)') result = sandbox.process.code_run(open('/app/script.py').read()) # Clean up daytona.remove(sandbox) ``` TypeScript: ```bash npm install @daytonaio/sdk ``` ```typescript import { Daytona } from '@daytonaio/sdk'; const daytona = new Daytona(); const sandbox = await daytona.create(); const result = await sandbox.process.codeRun('console.log("Hello!")'); console.log(result.result); ``` --- ## Intro Daytona is an open-source infrastructure platform with 71,000+ GitHub stars for securely running AI-generated code. It provides programmatic SDKs (Python, TypeScript, Go, Ruby) to create isolated sandbox environments where untrusted code can execute safely without affecting your host system. Originally a dev environment manager, Daytona evolved into the go-to infrastructure layer for AI agents, coding assistants, and LLM-powered applications that need to run arbitrary code. Each sandbox is fully isolated with its own filesystem, network, and process space. Works with: Python, TypeScript, Go, Ruby, any AI agent framework (LangChain, CrewAI, AutoGen). Best for teams building AI agents that execute code or AI-powered development tools. Setup time: under 5 minutes. --- ## Daytona Sandbox Architecture ### Core Concepts | Concept | Description | |---------|-------------| | **Sandbox** | Isolated execution environment with its own filesystem and processes | | **Code Execution** | Run Python, Node.js, or shell commands safely | | **File System** | Upload, download, and manage files in the sandbox | | **Git Integration** | Clone repos directly into sandboxes | | **LSP** | Language Server Protocol for IDE-like features | ### AI Agent Integration ```python from daytona_sdk import Daytona def ai_coding_agent(task: str) -> str: daytona = Daytona() sandbox = daytona.create(language="python") # Let the LLM generate code code = llm.generate(f"Write Python code to: {task}") # Execute safely in sandbox result = sandbox.process.code_run(code) if result.exit_code == 0: return result.result else: # Let LLM fix the error fixed = llm.generate(f"Fix this error: {result.result}") return sandbox.process.code_run(fixed).result ``` ### Security Features - **Process isolation** — Each sandbox runs in its own container - **Network isolation** — Configurable network access per sandbox - **Resource limits** — CPU, memory, and disk quotas - **Ephemeral by default** — Sandboxes are destroyed after use - **No host access** — Sandboxed code cannot reach your host system ### Multi-Language Support ```python # Python execution sandbox.process.code_run('import pandas as pd; print(pd.__version__)') # Node.js execution sandbox.process.code_run('console.log(process.version)', language='javascript') # Shell commands sandbox.process.exec('ls -la /app') sandbox.process.exec('pip install requests') ``` --- ## FAQ **Q: What is Daytona?** A: Daytona is an open-source platform with 71,000+ GitHub stars for creating secure sandboxed environments to run AI-generated code safely, with SDKs for Python, TypeScript, Go, and Ruby. **Q: How is Daytona different from E2B?** A: Both provide code execution sandboxes. Daytona is fully open-source (AGPL-3.0) and self-hostable. E2B is primarily a cloud service. Daytona also offers Git integration and LSP support for IDE-like features. **Q: Is Daytona free?** A: Yes, open-source under AGPL-3.0. Self-host for free. Daytona also offers a managed cloud service. --- ## Source & Thanks > Created by [Daytona](https://github.com/daytonaio). Licensed under AGPL-3.0. > > [daytona](https://github.com/daytonaio/daytona) — ⭐ 71,000+ --- ## 快速使用 ```bash pip install daytona-sdk ``` ```python from daytona_sdk import Daytona daytona = Daytona() sandbox = daytona.create() result = sandbox.process.code_run('print(42 * 42)') print(result.result) ``` --- ## 简介 Daytona 是一个拥有 71,000+ GitHub stars 的开源基础设施平台,专为安全运行 AI 生成的代码而设计。提供 Python、TypeScript、Go、Ruby SDK,创建隔离的沙箱环境执行不受信任的代码。是 AI 代理和编码助手的理想基础设施层。 --- ## 来源与感谢 > Created by [Daytona](https://github.com/daytonaio). Licensed under AGPL-3.0. > > [daytona](https://github.com/daytonaio/daytona) — ⭐ 71,000+ --- Source: https://tokrepo.com/en/workflows/ab55b619-f3cc-4930-9de3-c99534b5afd3 Author: AI Open Source