daytona

其他源码 2025-08-04

daytona -logotype -White.png“>”> daytona -logotype -black.png“>

运行AI代码。
安全和弹性基础架构用于运行AI生成的代码。

文档·报告错误·请求功能


安装

Python SDK

pip install daytona

打字稿SDK

npm install @ daytona io/sdk

特征

  • 闪电般的基础架构:从代码到执行的90ms沙盒创建子。
  • 分离和隔离运行时:执行AI生成的代码,对基础架构的风险为零。
  • 并发AI工作流的大规模并行化:叉沙盒文件系统和内存状态(即将发布!)
  • 程序化控制:文件,git,lsp和execute api
  • 无限的持久性:您的沙箱可以永远活着
  • OCI/Docker兼容性:使用任何OCI/Docker图像创建沙箱

快速开始

  1. 在https://app.**d*aytona.io上创建一个帐户
  2. 生成新的API键
  3. 关注入门文档开始使用daytona SDK

创建您的第一个沙箱

Python SDK

daytona , daytona Config, CreateSandboxParams # Initialize the daytona client daytona = daytona ( daytona Config(api_key="YOUR_API_KEY")) # Create the Sandbox instance sandbox = daytona .create(CreateSandboxParams(language="python")) # Run code securely inside the Sandbox response = sandbox.process.code_run('print("Sum of 3 and 4 is " + str(3 + 4))') if response.exit_code != 0: print(f"Error running code: {response.exit_code} {response.result}") else: print(response.result) # Clean up the Sandbox daytona .remove(sandbox)">
 from daytona import daytona , daytona Config , CreateSandboxParams

# Initialize the daytona client
daytona = daytona ( daytona Config ( api_key = "YOUR_API_KEY" ))

# Create the Sandbox instance
sandbox = daytona . create ( CreateSandboxParams ( language = "python" ))

# Run code securely inside the Sandbox
response = sandbox . process . code_run ( 'print("Sum of 3 and 4 is " + str(3 + 4))' )
if response . exit_code != 0 :
    print ( f"Error running code: { response . exit_code } { response . result } " )
else :
    print ( response . result )

# Clean up the Sandbox
daytona . remove ( sandbox )

打字稿SDK

daytona io/sdk' async function main() { // Initialize the daytona client const daytona = new daytona ({ apiKey: 'YOUR_API_KEY', }) let sandbox try { // Create the Sandbox instance sandbox = await daytona .create({ language: 'python', }) // Run code securely inside the Sandbox const response = await sandbox.process.codeRun('print("Sum of 3 and 4 is " + str(3 + 4))') if (response.exitCode !== 0) { console.error('Error running code:', response.exitCode, response.result) } else { console.log(response.result) } } catch (error) { console.error('Sandbox flow error:', error) } finally { if (sandbox) await daytona .remove(sandbox) } } main().catch(console.error)">
 import { daytona } from '@ daytona io/sdk'

async function main ( ) {
  // Initialize the daytona client
  const daytona = new daytona ( {
    apiKey : 'YOUR_API_KEY' ,
  } )

  let sandbox
  try {
    // Create the Sandbox instance
    sandbox = await daytona . create ( {
      language : 'python' ,
    } )
    // Run code securely inside the Sandbox
    const response = await sandbox . process . codeRun ( 'print("Sum of 3 and 4 is " + str(3 + 4))' )
    if ( response . exitCode !== 0 ) {
      console . error ( 'Error running code:' , response . exitCode , response . result )
    } else {
      console . log ( response . result )
    }
  } catch ( error ) {
    console . error ( 'Sandbox flow error:' , error )
  } finally {
    if ( sandbox ) await daytona . remove ( sandbox )
  }
}

main ( ) . catch ( console . error ) 

贡献

daytona是GNU Affero通用公共许可证的开源,并且是其贡献者的版权。如果您想为该软件做出贡献,请阅读“开发人员证书1.1”(https://d*evelope**rcercertificate.org/)。之后,导航到贡献指南开始。

下载源码

通过命令行克隆项目:

git clone https://github.com/daytonaio/daytona.git