TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

ForeverVM: Run AI-generated code in stateful sandboxes that run forever

184 pointsby paulgb3 months ago
Hey HN! We started Jamsocket a few years ago as a way to run ephemeral servers that last for as long as a WebSocket connection. We sandboxed those servers, so with the rise of LLMs we started to see people use them for arbitrary code execution.<p>While this works, it was clunkier than what we would have wanted in a first-principles code execution product. We built ForeverVM from scratch to be that product.<p>In particular, it felt clunky for app developers to have to think about sandboxes starting and stopping, so the core tenet of ForeverVM is using memory snapshotting to create the abstraction of a Python REPL that lives forever.<p>When you go on our site, you are given a live Python repl, try it out!<p>---<p>Edit: here&#x27;s a bit more about why&#x2F;when&#x2F;how this can be used:<p>LLMs are often given extra abilities through &quot;tools&quot;, which are generally wrappers around API calls. For a lot of tasks (sending an email, fetching data from well-known sources), the LLM knows how to write Python code to accomplish the same.<p>Any time the LLM needs to do a specific calculation or process data in a loop, we find it is better to generate code than try to do this in the LLM itself.<p>We have an integration with Anthropic&#x27;s Model Context Protocol, which is also supported by a lot of IDEs like Cursor and Windsurf. One surprising thing we&#x27;ve found is that once installed, when we ask a question about Python, the LLM will see that ForeverVM is available as a tool and verify it automatically! So we cut down on hallucinations that way.

16 comments

bluecoconut3 months ago
I tried to do this myself about ~1.5 years ago, but ran into issues with capturing state for sockets and open files (which started to show up when using some data science packages, jupyter widgets, etc.)<p>What are some of the edge cases where ForeverVM works and doesn&#x27;t work? I don&#x27;t see anything in the documentation about installing new packages, do you pre-bake what is available, and how can you see what libraries are available?<p>I do like that it seems the ForeverVM REPL also captures the state of the local drive (eg. can open a file, write to it, and then read from it).<p>For context on what I&#x27;ve tried: I used CRIU[1] to make the dumps of the process state and then would reload them. It worked for basic things, but ran into the issues stated above and abandoned the project. (I was trying to create a stack &#x2F; undo context for REPLs that LLMs could use, since they often put themselves into bad states, and reverting to previous states seemed useful). If I remember correctly, I also ran into issues because capturing the various outputs (ipython capture_output concepts) proved to be difficult outside of a jupyter environment, and jupyter environments themselves were even harder to snapshot. In the end I settled for ephemeral but still real-server jupyter kernels where I via wrapper managed locals() and globals() as a cache, and would re-execute commands in order to rebuild state after the server restarts &#x2F; crashes. This allowed me to also pip install new packages as well, so it proved more useful than simply static building my image&#x2F;environment. But, I did lose the &quot;serialization&quot; property of the machine state, which was something I wanted.<p>That said, even though I personally abanonded the project, I still hold onto the dream of a full Tree&#x2F;Graph of VMs (where each edge is code that is executed), and each VM state can be analyzed (files, memory, etc.). Love what ForeverVM is doing and the early promise here.<p>[1] <a href="https:&#x2F;&#x2F;criu.org&#x2F;Main_Page" rel="nofollow">https:&#x2F;&#x2F;criu.org&#x2F;Main_Page</a>
评论 #43188140 未加载
评论 #43189774 未加载
评论 #43199608 未加载
taylorwc3 months ago
Disclosure, I’m an investor in Jamsocket, the company behind this… but I’d be remiss if I didn’t say that every time Paul and Taylor launch something they have been working on, I end up saying “woah.” In particular, using ForeverVM with Clause is so fun.
评论 #43186477 未加载
great_psy3 months ago
Why would you want to have an ever growing memory usage for your Python environment?<p>Since LLM context is limited, at some point the LLM will forget what was defined at the beginning so you will need to reset&#x2F; remind the LLM whats in memory.
评论 #43186997 未加载
评论 #43187445 未加载
评论 #43186798 未加载
lumost3 months ago
Is it possible to reuse the same paused VM multiple times from the same snapshot?
评论 #43187013 未加载
评论 #43195719 未加载
eterps3 months ago
Why&#x2F;when does someone want to use this?
评论 #43186409 未加载
评论 #43186766 未加载
hatf03 months ago
This is neat! I’m assuming that this is Firecracker (or some other microVM hypervisor) underneath the hood?
评论 #43190643 未加载
benatkin3 months ago
It’s trivial to build something that does what this describes. I’m sure there’s more too it, but based on the description the pieces are already there under permissive open source licenses.<p>For a clean implementation I’d look at socket-activated rootless podman with a wasi-sdk build of Python.
评论 #43187537 未加载
评论 #43187559 未加载
deepsquirrelnet3 months ago
Is it possible to run cython code with this as well? Since you can run a setup.py script could you compile cython and run it?<p>Looking at the docs, it seems only suited for interpreted code, but I’d be interested to know if this was feasible or almost feasible with a little work.
评论 #43186878 未加载
评论 #43186843 未加载
laserpistus3 months ago
Great, we are looking into microVM&#x2F;firecracker-like solutions for both code execution and hosting of our students very low traffic sites, so adding this to the list of things to check out.
thehamkercat3 months ago
I have a question, why are you allowing network requests in the VM? (Tested in the python REPL which is available on your homepage)<p>What are you doing to prevent the abuse?
评论 #43188358 未加载
amelius3 months ago
Does this use CRIU? <a href="https:&#x2F;&#x2F;criu.org&#x2F;Main_Page" rel="nofollow">https:&#x2F;&#x2F;criu.org&#x2F;Main_Page</a>
评论 #43193654 未加载
carlosdp3 months ago
I was looking for this the other day, looks great!
lopuhin3 months ago
Congrats on the launch! How much does it cost? And what is the sandboxing technology?
autocole3 months ago
I love this. Congrats on the launch. You all are always building something interesting
monkeynotes3 months ago
What has AI got to do with this? It&#x27;s in the headline but I don&#x27;t see why.
评论 #43186442 未加载
评论 #43186642 未加载
TZubiri3 months ago
How is this different than chatgpt&#x27;s python code execution?
评论 #43189015 未加载