Back

How to Build an AI Agent From Your Website: With an AI Model or on Chatbase

There are two ways to build an AI agent from your website. You can have a coding tool such as Claude Code or Codex write the code for you from the prompts below, or you can add your site to Chatbase, which takes four steps and already includes what you'd otherwise build for real traffic: usage plans, spam protection and handoff to a person.

How to Build AI From Website URLs?

An AI agent built from your website reads your pages, finds the ones that match each question and answers from them, rather than being trained from scratch. The two routes differ in who builds and runs that part.

How Do You Build It With an AI Model, Step by Step?

You need a terminal (the command-line app on your computer), a Claude account (Claude Code) or a ChatGPT account (Codex), and an OpenAI API key. The prompts follow the approach in OpenAI's website Q&A tutorial.

Step 1: Open Claude Code or Codex

Make an empty folder, open a terminal in it, then install one of the tools and start it:

  • Claude Code: run curl -fsSL https://claude.ai/install.sh | bash (Mac and Linux; Windows steps are on its quickstart), then run claude and log in when it asks.
  • Codex: run curl -fsSL https://chatgpt.com/codex/install.sh | sh or npm install -g @openai/codex, then run codex and choose Sign in with ChatGPT (Codex CLI).

Step 2: Get an OpenAI API key

An API key is the password that lets your code use OpenAI's AI. Create one in the OpenAI dashboard and save it in your terminal with export OPENAI_API_KEY="your_key". Never paste it into a prompt.

Step 3: Ask it to build the chatbot

Paste this, with your own website address:

1Build a chatbot that answers questions using
2the pages on my website, https://yoursite.com.
3Read every page on the site (same domain only,
4skip login pages and respect robots.txt) and
5answer only from what those pages say. If the
6answer isn't on the site, say "I don't know".
7End every answer with links to the pages you
8used. Use OpenAI for the AI part, with my key
9from the OPENAI_API_KEY environment variable.
10Run it and show me a test question.

Step 4: Put it in a chat window

1Put the chatbot in a simple chat window on a
2web page, and tell me how to run it on my
3computer.

Before it goes on your site, you'll need somewhere to host it and a limit on how many questions each visitor can ask, because every question uses your OpenAI key.

Step 5: Test it

1Ask the chatbot 10 questions my customers
2really ask and 3 questions my website can't
3answer, and show me each answer and the pages
4it used.

The 3 unanswerable questions should come back "I don't know".

Step 6: Keep it up to date

1Add a command that re-reads my website,
2updates only the pages that changed and
3removes pages that are gone. Show me how to
4run it every week.

That's a working prototype, and you now own the code that reads your site, the search, the chat window, the hosting and the weekly update.

What Changes When Volume Goes Up?

A prototype is fine for a handful of questions. With real traffic, you also have to run these:

What you needBuilding it yourselfOn Chatbase
Reading your site and keeping it currentYour own code and a weekly update (steps 3 and 6)Add website with Exclude paths, then Resync now or, on Basic and up, a weekly Auto-resync that refreshes only changed pages
Searching your pages and answeringYour own code to store and search the pages (step 3)Nothing to build: each source syncs and the agent uses it as soon as it does, with no retraining step
Chat windowYour own page and hosting (step 4)The Chat Bubble, with an embed script you paste into your site
AI usage limitsYour OpenAI account's rate limits and spend limits, which depend on your usage tierPlans include 700, 4,000 or 15,000 message credits a month (Hobby, Basic, Business), and Enterprise is priced on a commitment sized to your expected volume
Spam and abuseYour own limit per visitor and spam handlingGuardrails: a message limit per visitor on the web channels (20 every 240 seconds by default), spam detection and country blocking. Abusive messages get no reply and use no credits
When the AI can't helpYour own handoff to a personEscalations to the Chatbase Helpdesk, or to tickets in Zendesk, Salesforce, Intercom or Freshdesk

How Do You Set It Up on Chatbase?

Do these four steps in order:

  • In your dashboard, click New AI Agent and enter your website under Your website. Chatbase extracts information from the pages on that domain.
  • To use a Sitemap or Individual link instead of a full crawl, or to skip paths such as /blog or /careers, open Data Sources and use the tabs and Advanced options. A Shopify store should use its /sitemap.xml.
  • Check the Fetched links tab for pages that were Not found or Excluded, then ask the agent a question from one of the pages in the Playground.
  • Go to Channels, click Manage on the Chat Bubble, choose Deploy and Website widget, click Enable Chat Bubble and paste the embed script into your site.

When Does Building It Yourself Win?

Building it yourself is the better call when:

When Is Chatbase the Right Fit?

Chatbase fits when you:

  • Expect real traffic and want usage plans, spam protection and a Helpdesk instead of code you maintain.
  • Want an agent answering from your site without running your own code, hosting or weekly update.
  • Run a Shopify store: crawl its /sitemap.xml, upload the sizing guide as a PDF and add the returns window as a Q&A, so one agent has the exact answer.

Which Plan Do You Need?

About the author

Sia Karpenko

Sia Karpenko is a Senior Growth and Marketing Lead at Chatbase. She writes about practical strategies for businesses building with AI agents and what growth looks like for AI-first companies.

Build AI agents for free with Chatbase

Upload files, connect sources like Notion or URLs, and go live in minutes.

Frequently asked questions

There are two ways. You can have an AI model such as Claude Code or Codex write the code from plain-English prompts, which gives you a prototype you host and maintain yourself. Or you can add your website to Chatbase in four steps: click New AI Agent, enter your website, check which pages were read, and paste the Chat Bubble embed script into your site.

A prototype built with a coding agent runs on your own OpenAI account's limits and your own hosting, and you add the visitor limits and handoff yourself. On Chatbase, plans run from 700 to 15,000 message credits a month, Enterprise is sized to the volume you expect, and spam guardrails, Helpdesk handoff and Auto-resync come with the agent.

Chatbase trains an AI agent on your public pages through Crawl links, Sitemap or Individual link. It can also read login-protected pages (Business and up), files, text, Q&A and Notion pages, and it learns each change within a minute.

For a site that changes, letting the AI look up your current pages when a question arrives is usually the practical first step. That approach is called RAG, or retrieval-augmented generation, and it means a changed page needs a refresh, not a retrained model. In Chatbase there is no retrain step, and the agent learns an edit within a minute.

Choose the Sitemap tab and point to your XML sitemap. Pages that leave the sitemap drop out on the next weekly Auto-resync, and a Shopify store can use its /sitemap.xml.

The world’s best customer experiences run on Chatbase

Join thousands of teams using Chatbase to build AI agents that deliver exceptional support at scale — across chat, email, and voice.