Use case

A RAG chatbot, in one file.

pgvector for storage. ActionCable for streaming. Rails Agent for the glue. No Python, no new services.

Ingest your docs

RailsAgent::Corpus.create!(name: "help_center") do |c|
  c.source :markdown, path: Rails.root.join("docs/**/*.md")
  c.embed  model: "text-embedding-3-small"
end

Define the agent

class HelpBot < RailsAgents::Base
  model "gpt-4o-mini"
  retrieves_from :help_center, k: 6
  stream :tokens
  instructions "Answer using only the retrieved docs. Cite sources."
end

Render in a Turbo Stream

  • Rails Agent ships an `<agent-stream>` custom element
  • Renders tokens as they arrive over ActionCable
  • Zero JS to write on your end