How to add an AI agent to your website that does real work
The script, the signed-in user, the actions, and the two things that break an agent on a real website most often.
Quick answer
Adding an AI agent to a website is three jobs. Put it on the page, usually with one script tag. Tell it who the visitor is with a short-lived token signed by your server, never an ID the browser sends. Give it actions to call through the API your site already uses, as that user, with a confirmation before anything changes. Then check the two things that break it most often: your Content Security Policy blocking the script, and bots using a public agent as a free AI model.
Putting a chat box on a website takes ten minutes. Putting an agent there that does real work for the person using the site, changing their settings, creating their records, finishing their setup, takes a few more decisions. Here they are in order, with the two failures I have actually hit on this site.
1. Decide what visitors should get done
Start with the work, not the widget. A visitor who is not signed in can only do what any stranger could: read, compare, book a demo. A signed-in user can do everything their account allows, and that is where an agent earns its place: the long setup, the setting three screens deep, the task that combines two features. Write down five things users ask for, in their words. They are your test cases.
2. Put it on the page
Almost every embeddable agent is one script tag in your site's HTML. That part is easy. What breaks it is your Content Security Policy, if your site sends one: the browser refuses any script, connection or frame from an origin the policy does not list, and nothing tells you except an error in the browser console.
It happened here. When I switched on a bot check for the assistant on askverb.com, the policy did not list the bot-check provider, the browser refused it, and the assistant stopped answering every visitor who was not signed in, while the page itself looked perfectly fine. The fix is to list the agent's origins under script-src and connect-src, and under frame-src for anything that draws a challenge. This post has the details.
3. Tell it who is visiting
An agent that acts for a user has to know who the user is, and it must never take the browser's word for it. If the page could simply say "I am user 42", anyone could. Instead your server, which already knows who is signed in, signs a short-lived token saying so, and the agent checks the signature before trusting it. When the user signs out, the agent forgets them, so the next person at that computer does not see their conversation. Telling an embedded assistant who is signed in walks through it.
4. Give it actions, as the user
The agent should work through the same API your own pages call, carrying the signed-in user's own access. Then it can do exactly what that person could do by hand and nothing more, and your existing permissions apply without being rebuilt. Anything that changes data should show the user what is about to happen, with the real values, and wait for a yes.
5. Protect it from the public
A public agent is a free AI model to anyone who finds it, and bots find it quickly. Give visitors who are not signed in a smaller allowance, put a bot check in front of them, and cap how much the agent can be used in a day. Protecting an AI agent on your website covers abuse and jailbreak attempts in full.
6. Try it on a copy first
Run your five sentences from step 1 against a test copy of your site with test data, then the ones that should fail: something the user is not allowed to do, a date that does not exist, a request in another language. Only then put it in front of real users.
The verdict
One script tag, a signed token for who is visiting, actions through your own API as that user, and a policy that lets the script load. Verb does all of this for you: you describe what it may do, try it on a test copy, and add the tag. It is integrated in under an hour in most cases, and the docs walk through each step. If you are still deciding what kind of AI your product needs, how to add AI to an app you already have starts a step earlier.
Frequently asked questions
How do I add an AI agent to my website?
Add the agent's script tag to your pages, have your server tell it who is signed in with a short-lived signed token, and give it the actions it may take through your site's own API. With Verb that is integrated in under an hour in most cases.
Why does my AI chat widget not load on my site?
Most often your Content Security Policy blocks it. The browser refuses any script, connection or frame from an origin the policy does not list, and the only sign is an error in the browser console. Add the widget's origins to script-src and connect-src, and to frame-src if it uses a challenge such as Turnstile.
Can visitors who are not signed in use the agent?
They can, with a smaller allowance and a bot check, and they can only do what a signed-out visitor could do on the site anyway. Anything that touches an account needs the visitor to be signed in, so the agent acts as them.
Is it safe to let an AI agent take actions on my website?
It is when the agent can only do what the signed-in user could do by hand, works through your own API so your existing permissions apply, and shows the user what it is about to change and waits for a yes.

Vishnu, founder of AskVerb @itsvishnups
Building the AI agent that lives inside a SaaS product and does the work its users ask for. Writing down what I learn along the way, including the parts I got wrong first.