Basic LLMs and AI Agent

Basic LLMs and AI Agent

IT Standard 14 10 hrs AI Python

This course introduces how a large language model works and how the same model is turned into an agent that can act on a computer. Students first trace a prompt through tokenization, embedding, attention and next-word prediction, then practise the five elements of a good prompt in Google Gemini and use one conversation to produce key points, an AI-generated comic and a working app built with the Canvas tool. Alongside the practical work they examine hallucination, training data cutoff and the memory ceiling, apply a trust-but-verify routine, and review what counts as sensitive information online. The second half of the course moves off the cloud: students install Ollama, run open models locally while recording CPU usage, memory and token throughput, and compare model sizes. They then run supplied Python agents in Thonny to rename, create, read and delete files inside a restricted sandbox folder, observe the Think-Act-Observe loop, and add a new tool to the agent. The course finishes with a skill-based personal assistant, where students write their own Python skill from a template and load it into the assistant's skillset.

Course Enquiry

Learning objectives

  • Explain how a large language model produces text, covering tokenization, embedding, attention and next-word prediction.
  • Write structured prompts and evaluate LLM output against hallucination, knowledge cutoff, memory limits and online privacy risks.
  • Run open models locally with Ollama and build a sandboxed file agent and a skill-based assistant in Python.

Lesson plan

Explore AI and LLM | Describe the relationship between artificial intelligence, machine learning, deep learning and transformer models, and explain how an LLM builds an answer through tokenization, embedding, attention and next-word prediction
Prompting, limitations and online privacy | Apply the five elements of a good prompt (persona, objective, audience, context, boundaries) and the master prompt strategy; identify hallucination, training data cutoff and the memory ceiling; apply the trust-but-verify rule and compare the strengths of common LLM services; recognise sensitive personal data and the risks of sharing it online | Hands-on: i) Use Gemini to generate key points on a chosen topic and refine them with follow-up prompts ii) Ask the LLM to write an image prompt, then generate a four-panel comic that explains the same topic iii) Use the Canvas tool to turn the conversation into a working app
LLMs on a local computer | Compare cloud and local models on privacy, connectivity and model size, and install and run open models with Ollama | Hands-on: i) Record CPU usage and total RAM before and after loading a model ii) Run gemma4:e2b and deepseek-r1:8b with --verbose and record the prompt and response speed in tokens per second iii) Compare the two models and discuss whether a larger parameter count always gives a better result
AI agent experiment | Distinguish a chatbot from an agent, introduce commands and simple scripting, explain the Think-Act-Observe loop, and explain why an agent is restricted to a sandbox folder | Hands-on: i) Run agent.py in Thonny and ask it to rename and delete files in the AI_Sandbox folder ii) Run smart-agent.py and count the steps it takes to list, read, create, rename and delete files iii) Test the folder restriction by trying to act on a file outside AI_Sandbox iv) Add a new tool to smart-agent.py so the agent can write text into a file
Personal assistant and skillsets | Understand a skillset as the set of actions given to an LLM, and how the tool list and the system prompt tell the assistant which skill to use and when; outline how advanced agents extend this by writing their own code and running sub-agents in parallel | Hands-on: i) Run assistant.py and ask it for the current time ii) Build get_current_time.py from skill_template.py and add it to the Skillset folder iii) Create an additional skill of your own, such as note taking or retrieving weather data from an open data API

Prerequisites

  • Basic Python experience

Hardware

  • Notebook/Desktop with updated browser
  • Windows notebook/desktop able to run local models with Ollama

Software

  • Google Gemini
  • Ollama
  • Thonny
  • Python with the ollama package

Other requirements