How to Build an AI Agent for Your Website in 7 Steps

Build a website AI agent with approved sources, test its answers and actions, then publish the generated widget or iframe code safely.

Cover Image for How to Build an AI Agent for Your Website in 7 Steps

To build an AI agent for your website, start with one visitor job and a small set of approved answers. In Agentkit, add those sources, adjust the chat, test it in the Playground, then copy the embed code from Channels → Website embed. Publish only after a real page returns the answers you expect. You can add actions once the basic question-and-answer path works.

This guide covers a knowledge-backed website chat with optional actions. It does not promise that an agent can complete a booking, issue a refund or change an order merely because it can discuss those tasks.

1. Choose the job before choosing a model

Write down the request you want to handle first. For example: "Help visitors find our shipping policy and explain when an order qualifies for free delivery." Name the source of truth and the fallback route for questions the agent cannot answer. That gives you a way to judge the result later.

If you need a fixed decision tree with no generated answers, a scripted chat may fit better. If you need account-specific data or a transaction, plan the integration and its approval boundary before inviting visitors to use it. A website source alone cannot look up a private order or complete a purchase.

2. Create the agent and check its sources

Create an Agentkit account and start a new chatbot. The setup wizard accepts a website URL or manual sources, then shows the pages it found and takes you through design and AI settings. Available models and allowances depend on your current plan, so use the choices shown in your account and check current pricing before budgeting for public traffic.

For a website URL, the wizard shows discovered pages but does not let you remove individual ones there. After setup and training, open Sources → Website. Remove pages visitors should not rely on, including expired offers or old policy versions. Keep current product, policy and help pages. If the crawler misses a page, add it from Sources → Website after setup. You can also add files, text and Q&A entries from Sources. The website source guide explains the crawl controls.

Start with a few pages you can verify. A wider crawl is useful only when its pages are accurate and relevant. Do not put private documents in a public agent's sources simply because an upload control accepts them.

3. Set the chat's appearance and instructions

In the wizard, choose the design and AI settings that suit the visitor job. After creation, you can revisit the agent's design and instructions. A useful opening message names what the agent can answer: "Ask about delivery, returns or product care." Suggested questions can give visitors a starting point, but do not claim those prompts improve conversion without measuring your own site.

Give the agent a boundary it can follow. For the shipping example: "Use our published shipping and returns information. If a delivery date depends on a specific order, say you cannot see that order and direct the visitor to support." Include the actual support route. Instructions do not replace a correct source or a test of the response.

4. Test answers before adding actions

Use the Playground to ask questions against the approved pages. Record the question, source and expected answer. This small launch set makes later changes easier to check.

Test promptExpected resultFailure to fix
"When is shipping free?"States the current threshold from the published shipping page.Quotes an old threshold or invents one.
"Where is order 12345?"Says it cannot see a private order without a connected order lookup and gives the support route.Guesses a delivery date.
"Can you make an exception to the return policy?"Explains the published policy and refers exceptions to a person.Promises an exception.

The order number is an illustrative test, not a real customer record. If a response is wrong, inspect the source first. Update the stale page or add a precise Q&A entry, then repeat the same prompt. The training guide covers source maintenance and answer checks.

5. Add one action only when it has a clear result

Actions can collect a lead, show a button or connect a supported service. Choose an action that belongs to the visitor job, then test both its success path and its failure path in the Playground. For instance, a Collect Leads action can ask for an email so a person can follow up. A submitted lead is a contact request, not proof that a sale or appointment happened. The Collect Leads guide shows the setup.

If the action opens a booking provider, finish a test booking on that provider and verify its confirmation. If it needs account-specific data, check permissions and avoid promising a result until the integration returns it. You can leave actions off for a useful question-and-answer agent.

6. Copy the code that your account generates

When answers and any actions pass testing, open Channels → Website embed. Choose Chat widget for a floating bubble or Iframe for an inline panel. Enable the channel you intend to use. The two channels have separate switches. Agentkit notes that advanced features are unavailable in the iframe. If you added an action, test it in the channel you will publish.

For the widget, copy the complete generated code. It contains a small bootstrap script and an async widget script with your agent ID and the configured host. Put both tags once in your site's shared footer or HTML template, before </body>, then publish. For an inline panel, copy the generated iframe instead and give it enough height in your layout. Do not use a widget URL, iframe path or React package copied from an older article. The embed guide covers placement and troubleshooting. WordPress owners can follow the current WordPress guide.

7. Verify a public page and keep checking it

Open the published page in a fresh browser window. Confirm that the bubble or panel appears, opens, accepts a message and returns a source-backed answer to one of your launch prompts. Then ask a question it should decline or route to a person. Record what happened. A working embed only proves the chat loaded; it does not prove every answer is safe.

If the chat is missing, check that the correct channel is enabled and that the published page contains the full generated code or iframe. A site editor or cache may remove or delay scripts. If it loads but cannot answer, check source training status and the agent's settings. The domain restriction guide explains one possible embed block.

After launch, review real conversations for repeated unanswered questions. Correct the source, then rerun the affected launch prompt and a public-page check. Keep a normal contact path visible when the agent cannot help. That is the practical standard for a website agent: visitors can get a useful answer, see when it lacks one and reach the next person or page.

Get started freeNo credit card required