Guide
How to add AI to your website
Most websites add AI in one of three ways: a chat assistant that answers questions, an agent that does work inside the application, or a custom build on a model provider's API. This guide compares them and shows how to install an in-app agent on a site you already run.
The three common options
The options are not exclusive. Many teams start with one and add another later.
| Option | Good for | What you take on |
|---|---|---|
| Answer-only chat assistant | Questions about your product, docs or help center. | Keeping its source content current. It cannot do work in your application unless you wire up actions. |
| In-app agent | Doing tasks for a signed-in user with the features your application already has. | Deciding who the user is, what the agent may do, what it may read and which actions need approval. |
| Custom build on a model API | Full control over prompts, tools, providers and the interface. | Tool definitions, authentication, sandboxing model-written code, defenses against untrusted page content, usage metering and the UI, all maintained by your team. |
Questions that decide the choice
- Answer or act? If users mainly ask questions, an answer-only assistant may be enough. If they want something done, such as filtering a report or updating a record, they need an agent that can use your application.
- Who are the users? Signed-in users need the agent to act as them, with your existing authentication. Public pages need limits on anonymous use.
- Where does authorization live? Keep it in your backend. An agent working through your application's own interface and API should face the same server-side checks as a user clicking through it.
- What may the model read? Decide which parts of the page are private before anything is sent to a model.
- How is it paid for? Model usage is metered by tokens. Check how costs are capped and who carries them, especially for anonymous traffic.
Adding an in-app agent with Bunkhouse
Bunkhouse adds an AI assistant to a web application you already run. One script tag loads an Assistant launcher and side pane on your page:
<script src="https://embed.bunkhouse.ai/embed.js" data-public-key="pk_YOUR_SITE_PUBLIC_KEY"></script>Place it before your application's entry script. The dashboard generates the complete snippet for your site; signed-in applications also add an identity endpoint.
When a user opens the pane, the assistant works with what the page already offers:
- Your existing UI: buttons, links, form fields and tables on the current page.
- Requests your app makes: API calls observed after the loader runs.
- Hints you publish: a JSON file describing operations discovery cannot see.
- WebMCP tools: tools your page declares for agents.
The model writes small programs that run in a sandbox on the embed origin, not in your page. They can only call capabilities the assistant has discovered and your configuration allows. Write actions are shown to the user for review before they run, and the model never sees credentials. The skills and discovery guide explains each source.
Connecting your users
- Identity token (recommended): your backend signs a short-lived token for the user it has already authenticated.
- Server mint: your backend creates the session with a server-only mint key.
- Anonymous: for public pages, off until you enable it with monthly token and spend limits.
Signing secrets and mint keys never reach the browser. The installation guide covers each mode and the Content Security Policy sources to add, and the framework integration guides show the installation in 30 frameworks, including Next.js, Django, Rails, Laravel and Spring Boot.
Limitations to plan for
- Discovery cannot see server-only routes, workflows the user has not visited, closed shadow roots or cross-origin frames. Describe those with a hints file.
- Some controls need a real user gesture; the assistant then asks the user to complete that step.
- Password, payment and file fields are never read. Mark anything else private with
data-agent-private; see the security guide. - Production use needs a subscription: $49 per month, including $20 of usage credit per paid billing period, then $1 per million input tokens and $3 per million output tokens. See billing.
Try it before you sign up
If you use a coding agent such as Claude Code, Codex or Cursor, it can run a free, disposable agent trial on a dummy page of yours. No account, card or model API key is needed: your coding agent acts as the assistant's model. A trial lasts 24 hours and allows 100 turns. Give your agent this instruction:
Read https://api.bunkhouse.ai/agent-trial.md and follow it to run a Bunkhouse agent trial on my dummy page at http://localhost:3000.Use a page with disposable data: everything the assistant reads is sent to your agent.
Building an agent-ready site goes beyond an assistant pane. The guide to making an existing website agent-ready covers crawlers, page structure and tools for outside agents.