← Justine Acosta · PortfolioAI AGENTS AND RAG CHATBOTS

How I build AI agents and RAG chatbots

Eight sample builds on one stack, and the two patterns underneath every one of them.

Sample builds for the fictional businesses used across this portfolio, not client projects.

Tools on this page
  • Claude
  • n8n
  • Supabase
  • Cal.com
  • Telegram
  • Google Sheets
  • Gmail
  • Stripe
AT A GLANCE

Two patterns, one rule

Every build below is one of two patterns, and both stop for your yes.

HOW A RAG CHATBOT WORKS

Search first, then answer

Documents are prepared once. Every question then searches them before Claude says a word. Click any step.

A RAG chatbot · 4 ways through

  1. Your documents (Docs, PDFs, Sheets), uses Docs, PDFs, Google Sheets, then Split into chunks
  2. Split into chunks (A few paragraphs each), then Embed
  3. Embed (Embeddings model), then Store
  4. Store (Supabase pgvector)
  5. A question (Chat, Telegram, Gmail), uses Chat window, Telegram, Gmail, then Embed the question
  6. Embed the question (Same model), then Search
  7. Search (Top 5 passages), then Claude answers
  8. Claude answers (From the passages), then Sure?
  9. Sure? (A source was found), then Reply with source if yes; Hand to a person if no
  10. Reply with source (Cites the passage), then Offer a call if ready to buy
  11. Offer a call (Cal.com)
  12. Hand to a person (With the chat so far)
HOW AN AGENT WORKS

Plan, use a tool, check, repeat

A trigger starts it. Claude plans, uses one tool at a time and checks the result until the job is done. Click any step.

An agent · 4 ways round

  1. Something happens (Event or schedule), uses Gmail, Stripe, Form, Schedule, then Claude plans
  2. Claude plans (Picks the next step), then Use a tool
  3. Use a tool (One call at a time), uses Gmail, Stripe, Supabase, Google Sheets, Cal.com, Web page, then Check the result
  4. Check the result (Done yet?), then Needs your yes? if done; Claude plans if not done yet
  5. Needs your yes? (Customers or money), then Your yes if yes; Act and log if internal only
  6. Your yes (Approve in Telegram), then Act and log if approved; Claude plans if change it
  7. Act and log (Send, then log it), uses Gmail, Google Sheets
EIGHT SAMPLE BUILDS

Eight sample builds

Examples of what I build on this stack. Show any one’s route on its diagram.

RAG chatbots

AI agents

GUARDRAILS

Four rules every build follows

They are what make a bot safe to put in front of customers.

PLAIN ENGLISH

Every term on this page, in one line

Plain English for the technical words above.

RAG
Retrieval-augmented generation: search your own documents first, then answer from what was found.
Chunk
A passage of a few paragraphs cut from a longer document, so a search can return just that part.
Embedding
A list of numbers that captures what a piece of text means, so similar ideas sit close together.
Vector search
Finding the stored passages whose embeddings sit closest to the question’s.
pgvector
A Postgres add-on that stores embeddings and runs vector search, here inside Supabase.
Passage
One chunk, as the search returns it and the answer cites it.
Hand-off
Passing the chat to a person, with everything said so far.
Agent
An AI that takes a goal, picks its own tools and works step by step until the job is done.
Trigger
The event that starts a run: an email, a payment, a form or a set time.
Tool call
One action an agent asks for, like drafting an email or reading a sheet.
Loop-back
A cable back to an earlier step: the agent tries again, or redoes a draft you sent back.
Approval gate
A point where the run stops until a person says yes.
Claude
Anthropic’s AI model. It plans, reads and writes in every build here.
n8n
The workflow tool that runs each build: it listens for triggers and makes the tool calls.
Supabase
A hosted Postgres database, used here for the document store and the CRM.