Mar 7, 2025

/

livestream

Refactoring Rails AI With Active Agent on thoughtbot (Live Coding)

Yesterday, I joined thoughtbot’s AI in Focus livestream to put Active Agent to the test in a real-world Rails project.

Hosted by thoughtbot CEO Chad Pytel, the episode focused on refactoring an existing retrieval-augmented generation (RAG) system—one that allows users to query internal documentation—using Active Agent instead of a custom-built AI integration.


Why Use Active Agent?

Active Agent is an open source framework designed to simplify AI-powered workflows in Rails applications. Instead of writing scattered AI logic across controllers, services, and background jobs, Active Agent allows you to define AI agents like Rails controllers, handling prompts, responses, and function calls in a structured way.

The livestream aimed to demonstrate how Active Agent can replace manual prompt engineering and API handling with a Rails-friendly abstraction.


Live Coding Recap

Chad and I worked through migrating a Rails application that already implemented a RAG system, fetching relevant documentation using Elasticsearch and passing it to an LLM for question-answering.

What We Achieved:

✅ Installed Active Agent and set up an AI agent

✅ Defined a QuestionAgent that could handle user queries

✅ Integrated it into the controller, replacing the existing custom prompt logic

✅ Explored function calling and contextual retrieval

✅ Debugged a Rails controller issue that caused unexpected behavior

Watch the Recording:

Highlights:

🔹 Live troubleshooting – The session gave a real-world look at debugging and integrating AI into a production Rails app.

🔹 Showcasing Active Agent’s Rails-native approach – We refactored a complex AI workflow into a cleaner, more maintainable Rails agent.

🔹 Community participation – Viewers asked great questions about function calling, AI workflows, and best practices.

Lessons Learned/Takeaways:

While the session highlighted the benefits of Active Agent, we also encountered a Rails-specific controller issue that didn’t appear when running the same code in the Rails console. This was a reminder that Rails controllers have their own context, and future integrations should account for potential method conflicts.

For future streams, I'll start with a pre-built demo to show the end result, then dive into live coding. (Unfortunately, I wasn't able to show the pre-built demo I had prepared due to issues with screen sharing on the stream.)


What’s Next for Active Agent?

I am currently working on a new release to address some of the issues we encountered in the livestream, ensuring even better integration with Rails controllers.

Beyond that, I’m moving quickly to expand the robust features of Active Agent. Sign up for my newsletter, join the Active Agent Discord, or follow me on social for updates! And if you’re using Active Agent, I’d love to hear your feedback. (PRs & issues are also welcome.)


Get Involved

Here’s how you can connect with me or get involved with Active Agent…

🛠️ Try it out (and open issues or submit a PR)

💬 Join the Active Agent Discord

Hire me to work on your AI project (10% off contracts signed Feb-March 2025)

📩 Email me at justin@activeagents.ai or schedule a call

🐙 Find me on Bluesky, X, LinkedIn, Github

Read More

Check out more content about new releases and AI concepts, written by Active Agent creator Justin Bowen.

Check out more content about new releases and AI concepts, written by Active Agent creator Justin Bowen.

Mar 15, 2025

More than an AI gem, Active Agent brings AI development in line with MVC conventions with AI agents as controllers.

Mar 15, 2025

More than an AI gem, Active Agent brings AI development in line with MVC conventions with AI agents as controllers.

Mar 15, 2025

More than an AI gem, Active Agent brings AI development in line with MVC conventions with AI agents as controllers.

Mar 15, 2025

More than an AI gem, Active Agent brings AI development in line with MVC conventions with AI agents as controllers.

Mar 12, 2025

Build AI agent apps in Rails with Active Agent. New release includes improvements to streaming, less config, and bug fixes.

Mar 12, 2025

Build AI agent apps in Rails with Active Agent. New release includes improvements to streaming, less config, and bug fixes.

Mar 12, 2025

Build AI agent apps in Rails with Active Agent. New release includes improvements to streaming, less config, and bug fixes.

Mar 12, 2025

Build AI agent apps in Rails with Active Agent. New release includes improvements to streaming, less config, and bug fixes.

Mar 7, 2025

Watch as we refactor a Rails RAG system on thoughtbot’s livestream, replacing custom AI logic with Active Agent for a cleaner, Rails-native approach.

Mar 7, 2025

Watch as we refactor a Rails RAG system on thoughtbot’s livestream, replacing custom AI logic with Active Agent for a cleaner, Rails-native approach.

Mar 7, 2025

Watch as we refactor a Rails RAG system on thoughtbot’s livestream, replacing custom AI logic with Active Agent for a cleaner, Rails-native approach.

Mar 7, 2025

Watch as we refactor a Rails RAG system on thoughtbot’s livestream, replacing custom AI logic with Active Agent for a cleaner, Rails-native approach.

Feb 20, 2025

NEW: Active Agent 0.2, a production-ready release candidate so you can start building AI features or refactoring your Rails apps today.

Feb 20, 2025

NEW: Active Agent 0.2, a production-ready release candidate so you can start building AI features or refactoring your Rails apps today.

Feb 20, 2025

NEW: Active Agent 0.2, a production-ready release candidate so you can start building AI features or refactoring your Rails apps today.

Feb 20, 2025

NEW: Active Agent 0.2, a production-ready release candidate so you can start building AI features or refactoring your Rails apps today.

Sep 10, 2024

In most cases, integrating AI isn’t as simple as just plugging in ChatGPT’s API—and without proper implementation, it can lead to critical business mistakes.

Sep 10, 2024

In most cases, integrating AI isn’t as simple as just plugging in ChatGPT’s API—and without proper implementation, it can lead to critical business mistakes.

Sep 10, 2024

In most cases, integrating AI isn’t as simple as just plugging in ChatGPT’s API—and without proper implementation, it can lead to critical business mistakes.

Sep 10, 2024

In most cases, integrating AI isn’t as simple as just plugging in ChatGPT’s API—and without proper implementation, it can lead to critical business mistakes.

Ready to build AI products with Rails?

Copyright © 2025 Active Agent / Justin Bowen

Website & marketing by Sea Foam Media, the premiere agency for AI products & dev tools.

Active Agents Newsletter

Subscribe to receive occasional updates, news, and content from Active Agents.

Ready to build AI products with Rails?

Copyright © 2025 Active Agent / Justin Bowen

Website & marketing by Sea Foam Media, the premiere agency for AI products & dev tools.

Active Agents Newsletter

Subscribe to receive occasional updates, news, and content from Active Agents.

Ready to build AI products with Rails?

Copyright © 2025 Active Agent / Justin Bowen

Website & marketing by Sea Foam Media, the premiere agency for AI products & dev tools.

Active Agents Newsletter

Subscribe to receive occasional updates, news, and content from Active Agents.