Build a chatbot for your website
What you'll build: a chatbot for acruxcore.com. AcruxCore reads the site's pages from its sitemap into a knowledge base. An agent searches those pages and answers a visitor's question, such as "Can I run AcruxCore on my own servers?", with a link to the page it used. A chat widget then puts the agent on the site. Replace the sitemap with your own to build the same chatbot for your site.
scripts/tutorials/build-a-chatbot-for-your-website/— the system prompt, plus a setup, an ask and a teardown script inbash/(curl)
Before you start
You need an AcruxCore account, an API key, and two models registered under
Gateway → Models: a chat model and an embedding model. This page uses an OpenAI
credential with the public names gpt-4o-mini and text-embedding-3-small.
Route calls through the gateway shows how to
add a credential and register a model.
- Dashboard
- curl
Nothing to install. Step 1 copies the prompt from
system-prompt.txt.
export ACRUXCORE_API_KEY=acx_sk_...
export ACRUXCORE_BASE_URL=https://api.acruxcore.com/api/v1 # or your own host
cd scripts/tutorials/build-a-chatbot-for-your-website/data
# Agents and knowledge bases take a model id; look it up by the name the dashboard shows.
MODELS=$(curl -sS --fail-with-body -H "Authorization: Bearer $ACRUXCORE_API_KEY" "$ACRUXCORE_BASE_URL/gateway/models")
CHAT_MODEL_ID=$(jq -c '[.[] | select(.publicName == "gpt-4o-mini") | .id][0]' <<<"$MODELS")
EMBED_MODEL_ID=$(jq -c '[.[] | select(.publicName == "text-embedding-3-small") | .id][0]' <<<"$MODELS")
The curl examples use jq to build JSON bodies and read
ids out of responses.
Each step shows two routes in one set of tabs. Dashboard is the click path, and curl calls the same endpoints from code.
1. Write the system prompt
The prompt keeps the agent to what the site says, and asks it to link the page it used:
You answer questions from visitors to the AcruxCore website, acruxcore.com.
Search the website before you answer, and answer only from the passages the search returns.
If the passages do not answer the question, say that you do not know, and point the visitor
to https://acruxcore.com/contact.
Keep each answer short: two to four sentences, or a short list.
When a passage you use has a url, end your answer with a Markdown link to that page.
- Dashboard
- curl
Open Prompts and click New prompt. Name it website-chatbot and click
Create prompt. Paste system-prompt.txt into the System message, then click
Commit new version.
The first version of a prompt becomes its production version, which the agent follows.
PROMPT_ID=$(curl -sS --fail-with-body -X POST "$ACRUXCORE_BASE_URL/prompts" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY" -H 'Content-Type: application/json' \
-d '{"name": "website-chatbot"}' | jq -r .id)
jq -n --rawfile system system-prompt.txt '{messages: [{role: "system", content: $system}]}' |
curl -sS --fail-with-body -X POST "$ACRUXCORE_BASE_URL/prompts/$PROMPT_ID/versions" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY" -H 'Content-Type: application/json' -d @-
2. Read the website into a knowledge base
A documents knowledge base holds the site's pages. Its sitemap tells the crawler which pages to read, and each page becomes one document with its URL.
- Dashboard
- curl
Open Knowledge and click New knowledge base:
- Kind: Documents
- Name:
Website chatbot pages. The model calls the base's search toolsearch_website_chatbot_pages, after this name. - Description:
The pages of acruxcore.com: what AcruxCore does, its features, pricing, security, self-hosting and how to contact the team.The model reads this text to decide when to search. - Embedding model:
text-embedding-3-small
Click Create, and open the base. In the Website section, set:
- Sitemap URL:
https://acruxcore.com/sitemap.xml - Page limit:
50 - Refresh: Weekly
Click Save and crawl. The pages appear under Documents as they are read.

Saving a new sitemap queues a crawl of every listed page. Poll the sitemap until its status
is no longer queued or running, then wait for the pages to finish embedding.
KB_ID=$(jq -n --argjson model "$EMBED_MODEL_ID" '{
name: "Website chatbot pages", embeddingModelId: $model,
description: "The pages of acruxcore.com: what AcruxCore does, its features, pricing, security, self-hosting and how to contact the team."
}' | curl -sS --fail-with-body -X POST "$ACRUXCORE_BASE_URL/knowledge-bases" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY" -H 'Content-Type: application/json' -d @- | jq -r .id)
curl -sS --fail-with-body -X PUT "$ACRUXCORE_BASE_URL/knowledge-bases/$KB_ID/sitemap" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY" -H 'Content-Type: application/json' \
-d '{"url": "https://acruxcore.com/sitemap.xml", "maxPages": 50, "refreshHours": 168}'
The crawl reads 19 pages. One of them has less than 50 words of main text, so it is marked Needs text. Leave it for now. Add a website to a knowledge base shows how to send that page's text through the API.
The weekly refresh re-reads only the pages whose <lastmod> date in the sitemap changed. A
page with no <lastmod> is never refreshed on its own; click Re-crawl whole site to update
it.
3. Create the agent
- Dashboard
- curl
Open Agents and click New agent:
- Name:
Website chatbot - Prompt:
website-chatbot. Alias then showsproduction (v1). - Model:
gpt-4o-mini
Under Knowledge, click Attach knowledge base, pick Website chatbot pages, and set
Results to return to 5. Click Create agent. The Tools panel lists
search_website_chatbot_pages.
AGENT_ID=$(jq -n --arg prompt "$PROMPT_ID" --argjson model "$CHAT_MODEL_ID" --arg kb "$KB_ID" '{
name: "Website chatbot", promptId: $prompt, modelId: $model,
knowledgeBases: [{knowledgeBaseId: $kb, topK: 5}]
}' | curl -sS --fail-with-body -X POST "$ACRUXCORE_BASE_URL/agents" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY" -H 'Content-Type: application/json' -d @- | jq -r .id)
4. Ask the agent
- Dashboard
- curl
On the agent's page, click Chat and ask:
How do I report a security problem?
Steps shows the search the model made and the pages it got back, each with its URL. The answer links the support address and ends with a link to the security page.

A run takes the agent's id or its name, percent-encoded. Without stream, the response is
the finished run.
curl -sS --fail-with-body -X POST "$ACRUXCORE_BASE_URL/agents/Website%20chatbot/runs" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY" -H 'Content-Type: application/json' \
-d '{"message": "How do I report a security problem?", "newConversation": true}' |
jq -r .output
5. Put the agent on your website
The widget is a chat button that runs the agent for your site's visitors. It runs only on the domains you list, and two limits bound what it can spend: messages per visitor per hour, and a daily spend cap.
- Dashboard
- curl
On the agent's page, click the Embed on website tab:
- Select Show this agent as a chat widget on my website.
- Allowed domains: your site, such as
example.com. Addlocalhostto try the widget on your own computer. - Title:
Ask AcruxCore. Greeting:Hi! Ask me anything about AcruxCore. - Messages per visitor per hour:
20. Daily spend cap (USD):2.
Click Save, then Copy code.
The response carries the widget's publicId, which goes in the script tag.
curl -sS --fail-with-body -X PUT "$ACRUXCORE_BASE_URL/agents/$AGENT_ID/embed" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY" -H 'Content-Type: application/json' \
-d '{"enabled": true, "allowedDomains": ["localhost", "example.com"], "title": "Ask AcruxCore",
"greeting": "Hi! Ask me anything about AcruxCore.", "messagesPerHour": 20, "dailyBudgetUsd": 2}' |
jq -r .publicId
Paste the tag before </body> on each page that should show the chat:
<script src="https://acruxcore.com/widget.js" data-agent="emb_..." async></script>
A visitor clicks the button in the bottom-right corner and asks a question. The answer shows its links, and a thumbs-up and a thumbs-down button to rate it.

On the agent's Chat page, conversations that visitors started are labelled Website. Embed an agent on your website covers the widget's settings, visitor ratings and costs in detail.
Run it
The scripts run steps 1 to 5 for you. Run the setup once, then ask as often as you like:
cd scripts/tutorials/build-a-chatbot-for-your-website
bash bash/setup_website_chatbot.sh
bash bash/ask_website_chatbot.sh
Crawled 19 pages: 18 added, 1 need their text, 0 failed
Agent Website chatbot (749cc96e-f5fb-484f-9673-8a624aa148da)
Paste before </body>:
<script src="https://acruxcore.com/widget.js" data-agent="emb_knAf5TUttnw9yCEpAfTcEgVt" async></script>
Q: Can I run AcruxCore on my own servers?
model calls search_website_chatbot_pages({"query":"self-hosting AcruxCore"})
A: Yes, you can run AcruxCore on your own servers. It is open-source under the Apache License 2.0, which means there is no license fee associated with self-hosting; you only need to cover your server costs. For more details on self-hosting, you can check the specific instructions [here](https://docs.acruxcore.com/docs/getting-started/self-host-with-docker).
status=succeeded cost=$0.00049364 trace=47fcbc2e-adb0-4912-ba38-c2fa7287f968
Q: Do I pay a markup on model tokens?
model calls search_website_chatbot_pages({"query":"model tokens markup AcruxCore"})
A: No, you do not pay a markup on model tokens when using AcruxCore. You connect your own provider credentials and pay the provider’s rates directly, as the gateway records the cost of each call without adding any additional fees. For more information, you can visit the FAQ page [here](https://acruxcore.com/faq).
status=succeeded cost=$0.00084464 trace=79098130-36a1-49ec-97f4-1bd90a146dba
Q: How do I report a security problem?
model calls search_website_chatbot_pages({"query":"report security problem AcruxCore"})
A: To report a security problem with AcruxCore, you should email [[email protected]](mailto:[email protected]) with steps to reproduce the issue and any relevant details. Security reports are prioritized, so you can expect them to handle your report with urgency. For more information on their security practices, you can visit their [security page](https://acruxcore.com/security).
status=succeeded cost=$0.00113309 trace=73a8670a-f727-4d6d-a679-19bf53c09b46
The setup reads the model names from CHAT_MODEL and EMBED_MODEL, which default to
gpt-4o-mini and text-embedding-3-small. Set SITEMAP_URL to your own sitemap and
SITE_DOMAINS to your own domains, separated by spaces. To start again, run the teardown
script, which deletes the agent, the prompt and the knowledge base with its pages.
What's next
- Add a website to a knowledge base covers the refresh rules, the pages that need their text, and the crawler's limits.
- Embed an agent on your website covers the widget's settings, visitor ratings and what limits its cost.
- Rerank and filter an agent's search results improves which pages the agent answers from.
- Build a help-desk agent from documents and a spreadsheet adds files and a spreadsheet to an agent's knowledge.