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.
- Claude
- n8n
- Supabase
- Cal.com
- Telegram
- Google Sheets
- Gmail
- Stripe
Two patterns, one rule
Every build below is one of two patterns, and both stop for your yes.
- 1
RAG chatbots
They search your documents first, then answer from what they found, with the source.
- 2
AI agents
They take a goal, pick their own tools and finish the job, checking as they go.
- 3
Your yes
Anything that reaches a customer or moves money waits for your approval.
Search first, then answer
Documents are prepared once. Every question then searches them before Claude says a word. Click any step.
- Your documents (Docs, PDFs, Sheets), uses Docs, PDFs, Google Sheets, then Split into chunks
- Split into chunks (A few paragraphs each), then Embed
- Embed (Embeddings model), then Store
- Store (Supabase pgvector)
- A question (Chat, Telegram, Gmail), uses Chat window, Telegram, Gmail, then Embed the question
- Embed the question (Same model), then Search
- Search (Top 5 passages), then Claude answers
- Claude answers (From the passages), then Sure?
- Sure? (A source was found), then Reply with source if yes; Hand to a person if no
- Reply with source (Cites the passage), then Offer a call if ready to buy
- Offer a call (Cal.com)
- Hand to a person (With the chat so far)
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.
- Something happens (Event or schedule), uses Gmail, Stripe, Form, Schedule, then Claude plans
- Claude plans (Picks the next step), then Use a tool
- Use a tool (One call at a time), uses Gmail, Stripe, Supabase, Google Sheets, Cal.com, Web page, then Check the result
- Check the result (Done yet?), then Needs your yes? if done; Claude plans if not done yet
- Needs your yes? (Customers or money), then Your yes if yes; Act and log if internal only
- Your yes (Approve in Telegram), then Act and log if approved; Claude plans if change it
- Act and log (Send, then log it), uses Gmail, Google Sheets
Eight sample builds
Examples of what I build on this stack. Show any one’s route on its diagram.
RAG chatbots
- SAMPLE BUILDRAG chatbot
Help-desk RAG bot
For Harbor & Pine Moving Co. · moving company
Answers Harbor & Pine Moving Co.’s customers from the pricing guide and FAQ; damage claims go to a person.
- Asked
- Do you move pianos, and what does it add?
- Answer
- Yes. Uprights add $150; baby grands need a walkthrough first. (Pricing guide §4)
- SAMPLE BUILDRAG chatbot
Team knowledge bot
For Ironline Utility Infrastructure · utility contractor
Ironline Utility Infrastructure’s crews ask in Telegram; it answers from the field SOPs and equipment sheet.
- Asked
- A locate mark is missing at the dig site. What do I do?
- Answer
- Stop, fill in form LM-2 and call the office before you dig. (Field SOP §3.1)
- SAMPLE BUILDRAG chatbot
Website sales bot
For Meridian Energy Infrastructure · commercial solar
Answers Meridian Energy Infrastructure visitors’ cost and fit questions, then offers a site assessment.
- Asked
- What would rooftop solar save on our distribution warehouse?
- Answer
- Typically 18–27% below your blended retail rate (Solutions guide). Book a free site assessment?
- SAMPLE BUILDRAG chatbot
Document Q&A bot
For Westmere · residential developer
Westmere’s sales team asks about a buyer’s contracts; it answers with the page, or says it isn’t there.
- Asked
- When does the buyer’s deposit on the Orchard sale stop being refundable?
- Answer
- When the 17-day inspection period ends. (Purchase agreement, page 7, §12.2)
AI agents
- SAMPLE BUILDAI agent
Inbox triage agent
For Meridian Werks · automotive workshop
Sorts Meridian Werks’ booking and reschedule emails and drafts replies; urgent ones go to a person.
- Trigger
- New email: “Can I move Thursday’s brake service to next week?”
- Result
- A reply with three open Cal.com times, drafted and waiting for your yes.
- SAMPLE BUILDAI agent
Billing follow-up agent
For Harbor & Pine Moving Co. · moving company
Spots Harbor & Pine Moving Co.’s overdue invoices in Stripe, drafts a polite reminder and logs it.
- Trigger
- Stripe: office-move invoice HP-0142 is 14 days overdue.
- Result
- A friendly reminder with the payment link, drafted and waiting for your yes.
- SAMPLE BUILDAI agent
Lead research agent
For Meridian Energy Infrastructure · commercial solar
Reads each firm asking Meridian Energy Infrastructure for an assessment, scores the fit, drafts a reply.
- Trigger
- New assessment request from a 300,000 sq ft cold-storage site.
- Result
- Fit 8 of 10, saved to the CRM, first email drafted for your yes.
- SAMPLE BUILDAI agent
Weekly report agent
For Meridian Werks · automotive workshop
Every Monday it turns Meridian Werks’ Stripe revenue and jobs sheet into a summary for the owner.
- Trigger
- Monday, 8 am.
- Result
- “Revenue up 12% on last week; 3 jobs waiting on parts.” Emailed to the owner.
Four rules every build follows
They are what make a bot safe to put in front of customers.
- G1
Answers only from the sources
A RAG bot answers from the passages it found and shows which ones. No source, no answer.
- G2
“I don’t know” beats a guess
When the search comes back thin, it says so and hands the chat to a person.
- G3
Customers and money wait for your yes
Anything that reaches a customer or moves money stops for your approval in Telegram.
- G4
Every run is logged
Each question, tool call and decision lands in a log you can read later.
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.