Adding a chat box to a website is the easy part. The difficult work is deciding what the assistant knows, what it may do, which data it uses and how it behaves when it cannot answer safely.
Short answer: Before an AI assistant goes live, it needs a specific use case, approved knowledge sources, restricted capabilities, isolation for each website, personal-data rules, a human escalation route and repeatable test scenarios. A prompt alone is not a sufficient boundary.
Define the role before choosing the model
The first question is not “which model should we use?”. It is “which job should the assistant perform for the visitor?”.
An assistant might help people find services, explain published information, direct them to the right form or collect a limited lead. These are separate capabilities. Each needs its own data source, interface states and failure rules.
A useful capability profile records:
- the subjects the assistant may cover,
- the functions it must not imply,
- the supported languages,
- the actions it can genuinely complete,
- the cases that must go to a person,
- the owner of each knowledge source.
If a website does not support orders or online booking, the assistant should not display those prompts because another client or demo configuration had them.
Website knowledge is data, not instruction
Content retrieved from pages, files or a CMS should be treated as reference material. It must not be able to change system rules, request secrets or activate tools that have not been permitted.
This matters especially when knowledge is refreshed automatically. A page can contain old copy, an incorrect fact or a malicious instruction. Retrieval does not turn content into trusted policy; it only places that content in context.
In practice, the system needs two distinct layers:
- stable application rules that define scope, permissions and prohibitions,
- verified content that supplies the business facts used in an answer.
That separation reduces prompt-injection risk and makes knowledge updates easier to control.
Give each website an explicit identity and boundary
On a platform that serves more than one website, the tenant ID cannot be optional or fall back to a real customer. If the ID is missing or invalid, the widget should fail without loading another business’s name, content, links or settings.
Isolation extends beyond the database. It should cover:
- allowed origins for the embed,
- the knowledge source and conversation history,
- prompts and the capability profile,
- products or services the assistant may mention,
- branding and language,
- leads, logs and administration permissions.
In Karastamatis Web Engineering’ private AI-assistant platform, a missing valid tenant stops the embed from starting, origins are checked before public requests and unavailable states use tenant-neutral copy. These are application controls; they do not depend on the model remembering which customer is active.
Collect leads only for a defined purpose
An assistant does not need to request contact details in every conversation. Lead capture makes sense when the visitor wants a response and understands what will be sent, to whom and why.
Before it is enabled, define:
- the minimum necessary fields,
- the privacy information shown beside the form,
- the destination and people with access,
- the retention period,
- the behaviour when submission fails,
- the process for correcting or deleting a record.
Free-text fields should not encourage visitors to submit sensitive information. Account, payment, medical, legal and other sensitive cases should move to an appropriate secure channel instead of being improvised inside the conversation.
Tools increase the system’s responsibility
An assistant that only explains published content has a different risk profile from an agent that creates a booking, changes data or sends a message. Every tool introduces possible side effects.
The practical principle is least capability. A tool should accept restricted fields, enforce authorisation on the server and require confirmation before an external or difficult-to-reverse action. The model must not decide on its own whether a user may view or change a record.
OWASP uses Excessive Agency for cases where an LLM-based system has more functionality, permissions or autonomy than it needs. The primary controls belong in tool architecture, not in one more sentence added to a prompt.
Design the failure states
The assistant should remain useful when the model API is slow, retrieval returns no result, a quota is exhausted or an integration is temporarily unavailable.
A suitable fallback:
- does not present a guess as an answer,
- does not reveal technical details or internal identifiers,
- never uses another tenant’s information,
- briefly explains what could not be completed,
- offers a real alternative step when one exists.
“I don’t know” is an acceptable state. False confidence is not.
Test hostile and ordinary scenarios
Testing should go beyond ten easy questions copied directly from the website. Include scenarios for:
- ambiguous or incomplete wording,
- an out-of-scope request,
- an attempt to reveal the system prompt or another customer’s data,
- an instruction embedded in retrieved website content,
- a service or capability that does not exist,
- an incorrect or unsupported language,
- lost connectivity and rate limits,
- failed lead submission,
- keyboard, mobile and screen-reader use of the widget.
Each test needs an acceptable behaviour, not one mandatory sentence. Generative output varies, but scope, permissions, isolation and the safe failure path should remain stable.
Pre-release checklist
Before enabling the widget in production, confirm that:
- the use case and prohibited areas are documented,
- knowledge sources have an owner and update process,
- every tenant, origin and language is resolved explicitly,
- tools have server-side authorisation and restricted inputs,
- lead capture requests only necessary information,
- a human contact route and tenant-neutral fallbacks exist,
- adversarial, failure and accessibility tests have run,
- someone owns logs, corrections and knowledge changes after launch.
An AI assistant is not finished when it answers the first test correctly. It is ready when its behaviour remains within bounds in the difficult cases too.