Forevervm
概覽
什麼是 ForeverVM?
ForeverVM 是一個強大的工具,旨在安全地在無限運行的有狀態沙盒中運行 AI 生成的代碼。這個創新的平台允許開發者在受控環境中測試和部署他們的代碼,確保應用程序平穩運行,無需擔心崩潰或數據丟失。使用 ForeverVM,使用者可以利用 AI 的能力,同時保持高水平的安全性和可靠性。
ForeverVM 的特點
- 有狀態沙盒:每個沙盒保留其狀態,允許持久數據存儲和無縫執行長時間運行的過程。
- AI 代碼執行:ForeverVM 專為運行 AI 生成的代碼而設計,提供優化的環境以提高性能和可靠性。
- 安全性:該平台優先考慮安全性,確保代碼執行是隔離的,並受到外部威脅的保護。
- 用戶友好的界面: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,
})
伺服器配置
{
"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"
}
}
}
}