AI & Machine Learning Topic

AI Agents for Beginners: How a Study Helper Works

Lesson 1 of 6 · AI agents, tools and MCP.

Use these lessons in order. The code examples share the same small study project.

  1. AI Agents for Beginners: How a Study Helper Works
  2. Python Tool Calling: Build Your First AI Agent
  3. What Is MCP? Tools, Resources and AI Apps Explained
  4. Build an MCP Server and Client in Python
  5. Test AI Agents and MCP Tools in Python
  6. Connect an AI Agent to MCP Tools in Python

Documentation checked: 25 October 2026. Code examples use made-up lesson data. Technical words are explained as they appear.

You ask an AI app, “Show me Python lesson two.” The app could guess an answer. A better app can look up the lesson, read the result and answer from that information.

An AI agent uses a model to choose a next step towards a goal. That step may be a tool call. A tool is a function the app allows it to use.

In this series, you will build a small study helper. It reads made-up course data. It does not change the Lecturre database.

What you will learn

  • What a model, a tool and an agent do.
  • How an agent chooses a tool.
  • Why your Python app must check the request.
  • When a simple fixed process may be enough.

Start with the parts

Model: The AI system that reads input and produces an answer or a request to use a tool.

Tool: A piece of code with a clear job. Our tool reads one lesson from a small list.

Agent loop: The steps that send information to the model, run allowed tools and return their results.

State: Information kept during the task. For our helper, this includes the question and earlier tool results.

Limit: A rule that stops the work. Our example allows only three model responses and four tool calls.

A complete example in plain language

  1. You ask, “Show Python lesson two and its practice task.”
  2. The model sees a tool called get_lesson.
  3. It requests that tool with the course name and lesson number.
  4. Your app checks that the tool and inputs are allowed.
  5. Your Python function reads the lesson.
  6. Your app sends the result back to the model.
  7. The model gives a short answer based on that result.

These are example tool inputs, not a full network message:

{"course": "python", "lesson": 2}

The tool returns this demo data:

{
  "course": "python",
  "lesson": 2,
  "title": "Dictionaries",
  "task": "Store a book title and its author in a dictionary."
}

A possible final answer is: “Lesson two is about dictionaries. Practise by storing a book title and author.” The exact wording can vary.

The model does not run your function by itself

A tool request is a message. Your app decides whether to act on it. It runs the function and sends the result back.

This matters when a tool can change something. Reading a lesson is a small task. Sending an email or changing a booking needs more checks.

Keep the first project read-only. That means it reads information but does not change it.

Agent or fixed process?

A fixed process follows steps chosen by you. For example, a button always opens lesson two.

An agent can use a model to choose between possible next steps. It may ask which course you mean or request a lesson tool.

You do not need an agent for every task. A normal search form may be simpler and faster when the steps are already clear.

What makes the example useful?

The lesson data comes from a real function, not from a guess. The inputs are small and easy to check. You can test the function without using an AI service.

The project also has a clear finish. If the model keeps asking for tools, the app stops and asks for a smaller task.

Try it yourself

  1. Write a question your helper should answer.
  2. Name the data it needs.
  3. Write the smallest tool that can read that data.
  4. Decide when the task should stop.

For example: “Find lesson one in the MCP course.” The data is one lesson. The tool is get_lesson. The task ends after a useful answer or a clear error.

Next lesson

Build the Python tool and the model loop in Python Tool Calling: Build Your First AI Agent.

Official sources

Connect this lesson to the full AI course

For Python and data basics, start with the first Python project. For document-based answers, read the RAG guide. Use prompt and evaluation checks to assess the answer as well as the tool loop. The local tests check program behaviour; they do not establish the quality of a live model.

All AI & Machine Learning tutorials

Comments (0)

No comments yet. Be the first to comment!

LecturreAI Assistant

Hello! I'm LecturreAI

What would you like to learn today?