
To build your first AI chatbot, define a narrow purpose, write a clear system prompt describing its role, tone and limits, give it a small knowledge base, then build it with a no-code chatbot builder or a short Python script that calls an AI model's API. Test it with tricky questions, add a handover to a human, and keep data private.
Step 1: Choose a narrow purpose
Chatbots that try to do everything do nothing well. Good first chatbots:
- a revision quiz bot for one subject,
- a school club FAQ bot,
- a shop assistant that answers questions about opening times and products,
- a recipe helper for family recipes.
Step 2: Write a system prompt
The system prompt sets the chatbot's behaviour:
"You are the FAQ assistant for the Robotics Club at City School. Answer questions about meeting times, joining, fees and competitions using only the information provided. Be friendly and brief. If you do not know, say so and suggest emailing the club captain. Never ask for personal information."
Include: role, audience, tone, what it should and should not do, and what to do when unsure.
Step 3: Add knowledge
Collect the facts the bot needs in a simple document: FAQs, schedules, policies. For small amounts, include them directly in the prompt. For larger collections, use retrieval; see what is RAG.
Step 4a: The no-code route
Many platforms let you create custom AI assistants or chatbots by writing instructions and uploading files, then sharing a link or embedding them on a website. This is the fastest way to a working bot.
Step 4b: The Python route
With basic Python, you can call an AI model's API directly. The structure is simple:
- Install the provider's library and store your API key in an environment variable.
- Keep a list of messages: the system prompt, then alternating user and assistant messages.
- In a loop, read user input, add it to the list, send the list to the API, print the reply and add it to the list.
This teaches how chat applications really work. Later, add a web interface with a framework like Streamlit or a simple web page.
Step 5: Test properly
Try:
- normal questions,
- questions outside its knowledge,
- confusing or rude messages,
- attempts to make it ignore its instructions.
Improve the prompt and knowledge until it behaves reliably.
Step 6: Deploy responsibly
- Never expose your API key in front-end code.
- Tell users they are talking to AI.
- Provide a way to reach a human.
- Avoid collecting personal data unless necessary and protected.
- Monitor conversations (with appropriate privacy) to improve answers.
Next steps
Students in our AI for Teens course build and deploy a chatbot as an early project; the generative AI development course builds advanced assistants with retrieval, tools and evaluation.
Frequently asked questions
Is it expensive to run a chatbot?
Small bots usually cost little in API usage. Costs grow with users and message length, so set usage limits.
Can a chatbot speak Urdu?
Yes, most modern models handle Urdu and Roman Urdu, though quality should be tested.
Do I need to train my own model?
No. Beginners use existing models with prompts and knowledge.


