artem

artem

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?

Showing Posts 1 to 7

artem

artem OP

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:

  1. 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
  2. Close the session via notebook’s top of page button. It takes you to the Livebook home page
  3. Click open and notebook you just worked on will be on top of the Recent ones, so quick open
  4. From address bar copy session ID (that I’ll need in the end to send HTTP request)
  5. In sidebar open secrets (keyboard shortcut “ss”) and enable whichever secrets you need
  6. In sibebar open outline (keyboard shortcut “so”) click on the final section (or whichever section starts what you need to test and evaluate it"
  7. 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

artem OP

Wow, if it works, that seems to be exactly what I was hoping for! Thanks, Leon, I’ll give it a try!

artem

artem OP

The process for setting it up was a bit tough (e.g. I had to switch from Livebook desktop to versioned livebooks installed to asdf internals) and I had to learn how mcp servers work, but in the end it was a very good solution. Thanks, @nulltree !

nulltree

nulltree

Glad to hear it :slight_smile:

w0rd-driven

w0rd-driven

I’m curious how this works as I’ve seen videos but I’ve assumed there could be issues like this. Has any of this changed?

How are you getting on with it a month later? I’ve been a bit lost on just trying to find the right subscription because I hate canceling them. My day job gave us Copilot but I haven’t worked with agent or edit mode. I’ve gotten along decently well with just chats but its starting to feel slow. There’s now Tidewave but it doesn’t touch Livebook. Livebook is a Phoenix server under the hood though. My guess and hope is that it will eventually add tools for Livebook too.

artem

artem OP

  1. Reloading livebook on making changes to file
    This worked very well for me, just as you’d expect: you (or AI) changed something in the standalone editor and livebook’s reloaded.
    But then it stopped (I think after I started using different livebook versions or something like this). Now it throws some storage-related errors whenever tried reloading sessions. Quick research didn’t help and as my LiveBook-related task was about to finish, I didn’t have motivation to dig deeper or report a bug. Maybe will try again when working with LiveBook much next time.

  2. MCP tool for AI to read results of cells
    Didn’t find it particularly useful, but I experimented with it just a little bit. I had many cells and IMHO cursor was getting lost in where to look for the results in.

  3. Misc
    Cursor (on Claude Sonnet 3.5 mainly) was all the time getting lost with 3 VS 4 backtick formatting in livebook notebooks. That was giving headaches with manual fixing. Could be solved by better prompting probably.

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
jaybe78
Hello, I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter). The diffic...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New
aseigo
ICal is a library for interacting with iCalendar data. It parses iCalendars into typed Elixir structs via ICal.from_ics, and can prepare ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews