artem
LLM with Livebook - any tips or workflows you recommend?
Hi All
I use AI with my elixir coding pretty successfully. Maybe it tells more about my elixir skills level, but I manage to get quite a lot of use from Cursor Composer agent mode which suggests changes to files and I can accept/reject with a click. And I can add hex docs of needed libraries to it, so it’s aware of APIs needed!
My current project is an RnD in Livebook and… I fail to figure out a good workflow for livebooks. Just editing running livebooks’s markdown file doesn’t work as it local changes will not be loaded and even more, any changes done in livebook UI will overwrite the file.
Good workflow
The best I was able to figure so far is to just chat with my livebook content in Cursor Composer and copy-paste content from chat to livebook and back. It works, but it tedious.
What do you use for AI in livebook?
- Same copy-paste between chats approach?
- Or is there an [easy] way to ask livebook session refresh itself from file instead of autosaving to file somehow?
- Or is there some agent tool able to edit livebook content in browser?
- Something else?
Marked As Solved
nulltree
Maybe take a look at @thmsmlr’s quite recent GitHub - thmsmlr/livebook_tools: Powertools for livebook.dev — AI Code Editing, MCP Servers, and Running Livebooks from the CLI
Also Liked
artem
artem
Self-answering of what worked for me okayish so far.
Tool I use
First of all Cursor Composer Agent is good and helps (with my level of elixir skills). Indeed it is not too knowledgeable on elixir idioms, so you may need to ask it to pay more attention to elixir idiomacy (e.g. more pattern matching, less branhing) + add some documentation on the libraries you use (e.g. to its list of docs you can just add links to hexdocs of Kinio, Tesla, etc). Sure it also sometimes makes stupid mistakes, but if I look after it, then it helps me code quite significantly. Except for this issue with LiveView ignoring and overwriting the underlying files.
So here’s what I used with some success:
Option for short notebooks: Just copy-pasting
You ask for Cursor agent suggestions, but do not apply to a file. Just copy-paste them to livebook editor manually. With small livebook notebooks it actually worked surprisingly well and wasn;t too annoying.
Option for large notebooks: Agent to edit file and then reconnect
Then my notebook grew from “just a small exploration” into "let’s make an externally accessible API out of it. Still RnD, but with some thinking of proper error handling, several secrets, Livebook Teams deployment, etc) and copy-pasting across many cells became painful. I figured the following process:
- Type next prompt to Cursor, discuss with it whatever you want. You notebook can be running meanwhile: As long as you type nothing in the livebook UI it doesn’t seem to overwrite the underlying file
- Close the session via notebook’s top of page button. It takes you to the Livebook home page
- Click open and notebook you just worked on will be on top of the Recent ones, so quick open
- From address bar copy session ID (that I’ll need in the end to send HTTP request)
- In sidebar open secrets (keyboard shortcut “ss”) and enable whichever secrets you need
- In sibebar open outline (keyboard shortcut “so”) click on the final section (or whichever section starts what you need to test and evaluate it"
- Eventually in postman (or whichever tool you use for sending http requests) replace old session id with the one copied on step 4 and you can send requests
It looks like a lot of things to do and I am not super-happy with the process indeed. However, once I did it several times it got to muscle memory and I am relatively fast with it - faster and more accurate than with copy-pasting indeed.
Any other options?
Does anybody have a better idea? After all what I am essentially doing it just close-recreate session for the same file (and reenable same secrets). Is there possibly some way e.g. to send message from IEex console to do it all in one go?
artem
Wow, if it works, that seems to be exactly what I was hoping for! Thanks, Leon, I’ll give it a try!








