Building an AI agent inside a 7-year-old Rails monolith

(catalinionescu.dev)

46 points | by cionescu1 4 hours ago ago

14 comments

  • midnightclubbed an hour ago ago

    What does the end user do with the AI chat? It sounds like they can just use it to do searches of client information… which the existing site would already do.

    • venturecruelty an hour ago ago

      But not without using a thousand gallons of water and propping up Nvidia shares.

      • sgt 32 minutes ago ago

        And there's still a lot of water left. We're just getting started, boys!

  • pell 2 hours ago ago

    Was there any concern about giving the LLM access to this return data? Reading your article I wondered if there could be an approach that limits the LLM to running the function calls without ever seeing the output itself fully, e.g., only seeing the start of a JSON string with a status like “success” or “not found”. But I guess it would be complicated to have a continuous conversation that way.

    • aidos 34 minutes ago ago

      > No model should ever know Jon Snow’s phone number from a SaaS service, but this approach allows this sort of retrieval.

      This reads to me like they think that the response from the tool doesn’t go back to the LLM.

      I’ve not worked with tools but my understanding is that they’re a way to allow the LLM to request additional data from the client. Once the client executes the requested function, that response data then goes to the LLM to be further processed into a final response.

  • Lio an hour ago ago

    It's interesting the use of RubyLLM here. I'm trying to contrast that with my own use of DSPy.rb, which so far I've been quite happy with for small experiments.

    Does anyone have a comparison of the two, or any other libraries?

  • rahimnathwani an hour ago ago

    The article is dated December 2025, but:

      I checked a few OpenAI models for this implementation: gpt-5, gpt-4o, gpt4.
    
    Seems like a weird list. None of these are current generation models and none are on the Pareto frontier.
  • tovej 2 hours ago ago

    If all this does is give you the data from a contact API, why not just let the users directly interact with the API? The LLM is just extra bloat in this case.

    Surely a fuzzy search by name or some other field is a much better UI for this.

    • bitmasher9 28 minutes ago ago

      By interact directly with the API, are you having the user to make curl calls to your backend?

      We build front ends for the API to make our applications easier to use. This is just another type of front end.

  • MangoToupe 2 hours ago ago

    Bruh this cannot seriously be considered interesting by hacker news guidelines. Where's the beef? Can i submit my instagram client for points next?

    • nomilk 2 hours ago ago

      I found it interesting because they:

      - Made a RAG in ~50 lines of ruby (practical and efficient)

      - Perform authorization on chunks in 2 lines of code (!!)

      - Offload retrieval to Algolia. Since a RAG is essentially LLM + retriever, the retriever typically ends up being most of the work. So using an existing search tool (rather than setting up a dedicated vector db) could save a lot of time/hassle when building a RAG.

    • Labo333 an hour ago ago

      I built a similar system for php and I can tell you what is the smart thing here: accessing data using tools.

      Of course tool calling and MCP are not new. But the smart thing is that by defining the tools in the context of an authenticated request, one can easily enforce the security policy of the monolith.

      In my case (we will maybe write a blog post one day), it's even neater as the agent is coded in Python so the php app talks with Python through local HTTP (we are thinking about building a central micro service) and the tool calls are encoded as JSON RPC, and yet it works.

      • kmarc 39 minutes ago ago

        I had to do something similar. Ruby is awful and very immature compared to python, so I "outsourced" the machine learning / LLM interaction to python. The rails service talks to it through grpc / protobuf and it works wonderfully.

  • sidd22 2 hours ago ago

    Hey, interesting read. I am working on product in Agent <> Tool layer. Would you be open for a quick chat ?