← Blog

Add an AI chat agent to your website in 3 lines of code

CognitionDesk Team··2 min read

Your website should answer questions while you sleep. Here is the fastest way to get a real AI agent — one that actually knows your business, not a canned FAQ bot — running on any site.

1. Create your agent

Sign up at app.cognitiondesk.com (free tier included), create an assistant, and upload your documents: price lists, service descriptions, opening hours, policies — PDFs, docs or plain text. The platform chunks, embeds and indexes them automatically. From that moment your agent answers from your content (this is RAG — retrieval-augmented generation — without you having to build any of it).

Grab two values from the assistant page: your assistant ID and a public widget key.

2. Drop in the widget

Add this to any HTML page:

<script src="https://cdn.jsdelivr.net/npm/@cognitiondesk/widget@latest/dist/widget.js"></script>
<script>
  CognitionDeskWidget.init({ assistantId: "YOUR_ASSISTANT_ID", apiKey: "YOUR_PUBLIC_KEY" });
</script>

Using React or Next.js? Install the package instead:

npm install @cognitiondesk/widget
import { CognitionDeskWidget } from "@cognitiondesk/widget";

export default function App() {
  return <CognitionDeskWidget assistantId="YOUR_ASSISTANT_ID" apiKey="YOUR_PUBLIC_KEY" />;
}

That's it. A floating chat bubble appears, styled to be unobtrusive, and visitors can ask anything: "do you have availability on Friday?", "how much is a consultation?", "what's your refund policy?" — answered from your documents, in your language.

3. Make it yours

Everything is configurable from the panel, no redeploy needed:

  • Persona and tone — the system prompt lives server-side, so you can tune it anytime.
  • Appointments — enable the booking tool and the agent schedules visits with reminders.
  • Inventory — connect your product catalog and the agent answers stock and price questions.
  • Human handoff — the agent detects when a real person should take over.
  • Model choice — GPT, Claude, Gemini or local models. Your agent, your rules.

What you just shipped

Not a chatbot with hardcoded replies — a real agent with retrieval over your knowledge base, tools it can call, and memory of each conversation. The same agent can later answer on WhatsApp Business without rebuilding anything: one brain, many channels.

Questions? Ask the widget on this very site — it runs on CognitionDesk, of course.

Comments and corrections

Build your first AI agent today

RAG over your documents, tools, workflows and a web widget — free tier included.

Get started free