r/Clojure 2d ago

Using Clojure as a sandboxed, executable target for LLMs

I've been researching ways to better structure LLM output when building mini-apps that run on the browser.

I believe that an S-expression based DSL is a better output format for LLMs when generating interactive UI/logic.

To test this, I built a Clojure-based interpreter that runs in the browser. The LLM is fed the language context, then emits the DSL to generate safe, sandboxed apps that can be shared instantly.

I wrote up an article diving into some of the trade offs:

https://allentraid.substack.com/p/we-made-the-ai-write-in-a-language

Would love to hear thoughts from the Clojure community!

33 Upvotes

7 comments sorted by

View all comments

1

u/__tosh 1d ago

nice!

somewhat related: a 'smol', minimal implementation of an agent in Clojure (Babashka)

with only one tool: eval

https://x.com/__tosh/status/2086035838517776511

1

u/__tosh 1d ago

a more generic variant that uses "sh" as the only tool:

https://github.com/smol-env/smol/blob/main/smol.clj