Build a small chatbot that does one thing well

By LessonFolk

Theme: Building with AILevel: Intermediate

Write a small command-line chatbot for one purpose you choose, with its own system prompt, a conversation that remembers, errors that do not crash it, and one finished feature.

About 4 hours 5 milestones

What you need

  • A computer with the programming language of your choice installed
  • A free model to call, either a model running on your own computer with a local model runner or a hosted API on its free tier
  • A code editor
  • An AI coding agent that edits your project from your instructions (optional, if you prefer to direct the work rather than type the code)

Courses it builds on

The project puts these courses to work. You can start it without them: your tutor explains what you need.

The brief

Build a small chatbot that runs in your terminal and does one thing well: a study buddy for one subject, a recipe helper, a bot that answers the common questions of your club. You choose the purpose, the programming language and the model, local or hosted.

You also choose how you build it. You can write the code yourself, asking an AI chat app for help when you need it. Or you can direct an AI coding agent, a tool that writes and edits the code in your project from your instructions. Either way, you decide what the bot does, you check what was written, and you must be able to explain every part of your code: each milestone asks you to.

Your tutor is your coach: it explains the ideas, asks questions, helps you read an error and reviews your code (or your instructions to the agent) with you, but it will not write the chatbot or those instructions for you.

Two rules. If you use a hosted API, your key is a password: never paste it into a chat or into your code. And use made-up questions for your tests, never personal or confidential information.

Milestones

Reach them in order. Your tutor checks each one with you before the next.

  1. Choose the purpose and write the system prompt

    Pick a narrow purpose, write the system prompt that sets it, and prepare the questions you will test it with.

  2. Make a first call work

    Send one question with your system prompt to the model from your code, and print the reply.

  3. Keep the conversation going

    Turn the single call into a loop that keeps the history, and keep that history from growing without limit.

  4. Survive failures

    Make the bot handle a slow or failed call without crashing.

  5. Test it like a user and add one feature

    Run your test questions again, fix what went wrong, then finish one feature.