Forevervm
概览
什么是 ForeverVM?
ForeverVM 是一个强大的工具,旨在安全地在无限期运行的有状态沙箱中执行 AI 生成的代码。这个创新平台允许开发者在受控环境中测试和部署他们的代码,确保应用程序平稳运行,避免崩溃或数据丢失的风险。通过 ForeverVM,用户可以利用 AI 的能力,同时保持高水平的安全性和可靠性。
ForeverVM 的特点
- 有状态沙箱:每个沙箱保留其状态,允许持久数据存储和无缝执行长时间运行的进程。
- AI 代码执行:专为运行 AI 生成的代码而设计,ForeverVM 提供了一个优化的环境,增强了性能和可靠性。
- 安全性:该平台优先考虑安全性,确保代码执行是隔离的,并受到外部威胁的保护。
- 用户友好的界面:ForeverVM 提供直观的界面,简化了部署和管理代码的过程,使新手和经验丰富的开发者都能轻松使用。
- 可扩展性:系统旨在可扩展,能够适应不同的工作负载和用户需求,而不影响性能。
如何使用 ForeverVM
- 注册:在 ForeverVM 网站上创建一个账户以开始使用。
- 创建沙箱:登录后,您可以创建一个新的沙箱环境,以满足您的项目需求。
- 上传代码:将您的 AI 生成的代码上传到沙箱中进行执行。
- 运行和测试:在沙箱中执行您的代码,监控其性能,并进行必要的调整。
- 保存和部署:一旦对结果满意,保存您的配置并根据需要部署您的应用程序。
常见问题解答
问:我可以在 ForeverVM 上运行什么类型的代码?
答:ForeverVM 旨在运行 AI 生成的代码,但也可以支持各种编程语言和框架,具体取决于沙箱配置。
问:ForeverVM 安全吗?
答:是的,安全性是 ForeverVM 的首要任务。每个沙箱在隔离中运行,保护您的代码和数据免受潜在威胁。
问:我可以从任何地方访问我的沙箱吗?
答:是的,ForeverVM 是基于云的,允许您从任何有互联网连接的设备访问您的沙箱。
问:ForeverVM 如何处理代码执行中的错误?
答:ForeverVM 提供详细的日志和错误信息,帮助您快速有效地排除问题。
问:我的代码可以运行多长时间?
答:没有,ForeverVM 允许您的代码无限期运行,非常适合长时间运行的进程和应用程序。
详情
foreverVM
| repo | version |
|--||
| cli | |
| sdk |
|
foreverVM provides an API for running arbitrary, stateful Python code securely.
The core concepts in foreverVM are machines and instructions.
Machines represent a stateful Python process. You interact with a machine by running instructions (Python statements and expressions) on it, and receiving the results. A machine processes one instruction at a time.
Getting started
You will need an API token (if you need one, reach out to paul@jamsocket.com).
The easiest way to try out foreverVM is using the CLI. First, you will need to log in:
npx forevervm login
Once logged in, you can open a REPL interface with a new machine:
npx forevervm repl
When foreverVM starts your machine, it gives it an ID that you can later use to reconnect to it. You can reconnect to a machine like this:
npx forevervm repl [machine_name]
You can list your machines (in reverse order of creation) like this:
npx forevervm machine list
You don't need to terminate machines -- foreverVM will automatically swap them from memory to disk when they are idle, and then automatically swap them back when needed. This is what allows foreverVM to run repls “forever”.
Using the API
import { ForeverVM } from '@forevervm/sdk'
const token = process.env.FOREVERVM_TOKEN
if (!token) {
throw new Error('FOREVERVM_TOKEN is not set')
}
// Initialize foreverVM
const fvm = new ForeverVM({ token })
// Connect to a new machine.
const repl = fvm.repl()
// Execute some code
let execResult = repl.exec('4 + 4')
// Get the result
console.log('result:', await execResult.result)
// We can also print stdout and stderr
execResult = repl.exec('for i in range(10):\n print(i)')
for await (const output of execResult.output) {
console.log(output.stream, output.data)
}
process.exit(0)
Working with Tags
You can create machines with tags and filter machines by tags:
import { ForeverVM } from '@forevervm/sdk'
const fvm = new ForeverVM({ token: process.env.FOREVERVM_TOKEN })
// Create a machine with tags
const machineResponse = await fvm.createMachine({
tags: {
env: 'production',
owner: 'user123',
project: 'demo'
}
})
// List machines filtered by tags
const productionMachines = await fvm.listMachines({
tags: { env: 'production' }
})
Memory Limits
You can create machines with memory limits by specifying the memory size in megabytes:
// Create a machine with 512MB memory limit
const machineResponse = await fvm.createMachine({
memory_mb: 512,
})
Server配置
{
"mcpServers": {
"mcp-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--jamsocket--forevervm--mcp-server",
"npm run start"
],
"env": {
"FOREVERVM_TOKEN": "forevervm-token"
}
}
}
}