RFC / architectural convergence: unified prompt rendering, lazy execution, and typed schemas across Rails AI frameworks #400
Closed
Alexander-Senko
started this conversation in
Show and tell
Replies: 1 comment 1 reply
|
Have you reviewed ActiveAgents and the docs? The current version of the gem supports these features |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
Over the last year, I’ve been developing Action AI, an open-source framework exploring an Action Mailer / Action Controller mental model for LLM interactions in Rails.
As Active Agent grows and gains mindshare, it's clear that both libraries share a fundamental goal: preventing raw LLM provider calls from cluttering Rails controllers, jobs, and models by establishing a dedicated, maintainable interaction layer.
However, we are currently facing a classic open-source challenge: duplicating core responsibilities and controller dispatch abstractions. Both libraries implement their own controller/agent wrappers, action dispatches, and provider bindings. Having two distinct framework layers doing ~80% of the same structural routing runs the risk of fragmenting developer efforts across the Rails ecosystem.
Rather than running parallel tracks or forcing users into an either/or choice, I’d like to open a discussion on whether we can combine our efforts and converge on a unified standard for Rails AI interactions.
Key architectural strengths & innovations from Action AI
In Action AI, I’ve focused heavily on three specific capabilities that complement the broader AI ecosystem:
View-backed prompt engineering (ERB templates):
Instead of defining prompts as Ruby strings or heavy configuration blocks, Action AI routes actions directly to standard Action View templates in
app/ai/prompts/*.erb. Instance variables initialized in agent actions (@task,@user) are passed directly into the ERB context. This keeps complex multi-line prompt formatting, partials, and view helpers cleanly separated from application logic.Lazy execution & chainable proxies:
Calling an action method returns a lazy execution proxy. The prompt execution is deferred until
#content,#parsed,#object, or#runis explicitly invoked. This makes it straightforward to chain actions or apply middleware-style modifications prior to dispatching:Action AI includes native type-mapping utilities (
returns Personorreturns [Person]) that automatically generate JSON schema contracts from Active Model attributes and wrap the returned structured output back into typed model instances.The challenge: avoiding redundant controller layers
Because both Active Agent and Action AI treat the entry point as a controller/agent class, trying to turn Action AI into an external plugin for Active Agent creates an unnecessary double-wrapping problem. If Action AI loses its action routing, it gets stripped down to a plain set of small features like template renderer and schema wrapper. Conversely, wrapping Active Agent underneath Action AI creates two competing DSLs in the same project.
Proposal for discussion: How do we combine forces?
Instead of maintaining separate framework dispatches, how can we best bring these patterns together into Active Agent?
First-class view/template backend:
Can Active Agent natively support Action AI's ActionView-backed template resolution (
app/ai/prompts/...) so prompts can be written as clean templates rather than inline strings?Standardized schema contracts:
Can we unify structured output parsing so Active Model schemas, JSON Schema generation, and typed object instantiation are standardized across the gem?
Execution pipeline:
Can we integrate lazy execution proxies to allow method chaining before triggering provider calls?
I am open to contributing these patterns, PRs, and architectural ideas directly into Active Agent so we can build a single, idiomatic, and robust AI standard for the Ruby on Rails community.
Would love to hear your thoughts on how we can structure this collaboration!
All reactions