{"id":25905313,"url":"https://github.com/jamsocket/forevervm","last_synced_at":"2025-05-13T18:58:30.956Z","repository":{"id":273133719,"uuid":"918657398","full_name":"jamsocket/forevervm","owner":"jamsocket","description":"Securely run AI-generated code in stateful sandboxes that run forever.","archived":false,"fork":false,"pushed_at":"2025-02-26T20:56:58.000Z","size":599,"stargazers_count":53,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-26T21:29:10.956Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://forevervm.com","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamsocket.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-18T14:15:35.000Z","updated_at":"2025-02-26T20:42:19.000Z","dependencies_parsed_at":"2025-02-18T16:39:39.101Z","dependency_job_id":null,"html_url":"https://github.com/jamsocket/forevervm","commit_stats":null,"previous_names":["jamsocket/forevervm"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamsocket%2Fforevervm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamsocket%2Fforevervm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamsocket%2Fforevervm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamsocket%2Fforevervm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamsocket","download_url":"https://codeload.github.com/jamsocket/forevervm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241610972,"owners_count":19990506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-03T05:02:09.773Z","updated_at":"2025-05-13T18:58:30.949Z","avatar_url":"https://github.com/jamsocket.png","language":"Rust","funding_links":[],"categories":["Developer Tools","Rust","Code Execution","Cloud \u0026 DevOps"],"sub_categories":["CI/CD \u0026 DevOps"],"readme":"[foreverVM](https://forevervm.com)\n==================================\n\n[![GitHub Repo stars](https://img.shields.io/github/stars/jamsocket/forevervm?style=social)](https://github.com/jamsocket/forevervm)\n[![Chat on Discord](https://img.shields.io/discord/939641163265232947?color=404eed\u0026label=discord)](https://discord.gg/N5sEpsuhh9)\n\n| repo                                                | version                     |\n|-----------------------------------------------------|------------------------------|\n| [cli](https://github.com/jamsocket/forevervm) | [![npm](https://img.shields.io/npm/v/forevervm)](https://www.npmjs.com/package/forevervm) |\n| [sdk](https://github.com/jamsocket/forevervm) | [![npm](https://img.shields.io/npm/v/@forevervm/sdk)](https://www.npmjs.com/package/@forevervm/sdk) |\n\nforeverVM provides an API for running arbitrary, stateful Python code securely.\n\nThe core concepts in foreverVM are **machines** and **instructions**.\n\n**Machines** represent a stateful Python process. You interact with a machine by running **instructions**\n(Python statements and expressions) on it, and receiving the results. A machine processes one instruction\nat a time.\n\nGetting started\n---------------\n\nYou will need an API token (if you need one, reach out to [paul@jamsocket.com](mailto:paul@jamsocket.com)).\n\nThe easiest way to try out foreverVM is using the CLI. First, you will need to log in:\n\n```bash\nnpx forevervm login\n```\n\nOnce logged in, you can open a REPL interface with a new machine:\n\n```bash\nnpx forevervm repl\n```\n\nWhen 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:\n\n```bash\nnpx forevervm repl [machine_name]\n```\n\nYou can list your machines (in reverse order of creation) like this:\n\n```bash\nnpx forevervm machine list\n```\n\nYou don't need to terminate machines -- foreverVM will automatically swap them from memory to disk when they are idle, and then\nautomatically swap them back when needed. This is what allows foreverVM to run repls “forever”.\n\nUsing the API\n-------------\n\n```typescript\nimport { ForeverVM } from '@forevervm/sdk'\n\nconst token = process.env.FOREVERVM_TOKEN\nif (!token) {\n  throw new Error('FOREVERVM_TOKEN is not set')\n}\n\n// Initialize foreverVM\nconst fvm = new ForeverVM({ token })\n\n// Connect to a new machine.\nconst repl = fvm.repl()\n\n// Execute some code\nlet execResult = repl.exec('4 + 4')\n\n// Get the result\nconsole.log('result:', await execResult.result)\n\n// We can also print stdout and stderr\nexecResult = repl.exec('for i in range(10):\\n  print(i)')\n\nfor await (const output of execResult.output) {\n  console.log(output.stream, output.data)\n}\n\nprocess.exit(0)\n```\n\nWorking with Tags\n----------------\n\nYou can create machines with tags and filter machines by tags:\n\n```typescript\nimport { ForeverVM } from '@forevervm/sdk'\n\nconst fvm = new ForeverVM({ token: process.env.FOREVERVM_TOKEN })\n\n// Create a machine with tags\nconst machineResponse = await fvm.createMachine({\n  tags: { \n    env: 'production', \n    owner: 'user123',\n    project: 'demo'\n  }\n})\n\n// List machines filtered by tags\nconst productionMachines = await fvm.listMachines({\n  tags: { env: 'production' }\n})\n```\n\nMemory Limits\n----------------\n\nYou can create machines with memory limits by specifying the memory size in megabytes:\n\n```typescript\n// Create a machine with 512MB memory limit\nconst machineResponse = await fvm.createMachine({\n  memory_mb: 512,\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamsocket%2Fforevervm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamsocket%2Fforevervm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamsocket%2Fforevervm/lists"}