MMAIlabSoftware Engineering Research Group (UTM SERG) · Training
MMAIlab
Hands-on training labs
Software Engineering Research Group (UTM SERG)
Training catalogue
Courses
Course
Setup check
Is this computer ready for the course? MAIlab checks what this course’s labs need, from Python and your settings to the models you can call and the tools, and says how to fix anything missing. The same checks run in a terminal:
Modules
Copy report gives a short text for the class chat when you ask for help: the checks and your browser ID, never a key.
Model settings
Inspector
Send a message. The exact HTTP request, the raw response, the streamed chunks and every retry appear here.
Tokenizer
Models read and write tokens, not words. Each coloured chip is one token; · marks a space.
English vs Bahasa Melayu
Same meaning, different token counts, different bill.
Context window: the next request
Everything in one request must fit: system prompt + history + new message + the space reserved for the answer.
Messages the next request will send
The API is stateless
The API remembers nothing between calls. Your app re-sends the whole history every turn, so input tokens and cost grow with each turn. A chat app does this for you without showing it.
Last call
This conversation
Monthly projection
Example: a Klang Valley clinic with 300 enquiries a day. Change any number.
Set USD → RM to today's exchange rate. Reasoning tokens are billed as output, so set output tokens from a real call.
Every call this browser made: chat, compare, error lab and token counts. Click a row to open it in the Inspector. Other browsers cannot see your log.
One conversation, three request shapes
The current chat (plus the text in the message box) written as each provider's raw request. Nothing is sent.
Error lab
Each experiment makes a real request to the provider and model chosen on the left (only the simulated 429s are fake). Predict the first response, then run it. Read the status code before the content.
Compare providers
One prompt, sent to all three providers at the same time with the same system prompt and max_tokens. Each model runs at its default effort.
3 · Few-shot examplesinput → the exact JSON you want back; include an ambiguous one
4 · Output contractexact JSON fields, types and allowed values
Business rulesyour case study's own checks, run in code after the schema
Model used for tests
How the contract becomes an API request
The parts are assembled into one request. The system field carries the instruction, the output contract and the failure policy. Each few-shot example becomes a user/assistant message pair. The enquiry goes last, inside the input variable.
Check any output
Paste a reply from MAIlab, Flowise, ChatGPT or a classmate. Code checks it against the current contract in three layers: syntax, schema, business rules. A prompt alone cannot do this.
Test set
Expected columns come from the contract's enum and boolean fields. "(any)" means the case does not check that field.
Run
Versions
Compare two contracts line by line, then run both on the test set. Accept a change only if nothing that passed before now fails.
Model matrix
The same contract and test set on several models, one run per case. Which is the cheapest model that meets the target?
Build it in Flowise
Copy each block into the matching Flowise node. Node names and fields can vary by Flowise version.
Flowise and LangChain, side by side
The same ideas with a different interface: nodes become classes, wires become |, side panels become parameters and environment variables, and the chat window becomes a script or a test.
Flowise node
LangChain (Python)
Where you see it
Chat Prompt Template
ChatPromptTemplate.from_messages([...])
prompt below: system message, few-shot pairs, then {enquiry}
ChatOpenAI or ChatAnthropic
ChatOpenAI(...), ChatAnthropic(...)
model below; the key comes from an environment variable, never a field
LLM Chain (the wires)
prompt | model: a Runnable
chain below
The chat window
chain.invoke({...}), run from a script or a test
result below; Module 1's Inspector shows the HTTP request it becomes
Structured Output Parser
your own check(), or model.with_structured_output(schema)
check() below: syntax, schema, then business rules
Custom Tool
@tool on a typed function; its docstring is the description
Module 3 → Code
Tool Agent
create_agent(model, tools, system_prompt=...)
Module 3 → Code
Buffer Memory, Redis-Backed Chat Memory
a checkpointer with a thread_id, or your own Redis history
Module 6 → Memory, and giga_pipeline_lab.py in Module 6 → Whole pipeline
Key terms. Chain: a fixed composition of steps. Runnable: a LangChain object you can invoke; a prompt, a model and prompt | model all are.
Tool: a function with a name, a description and an input schema. Memory: earlier state supplied to later turns.
Common mistakes. Treating code as a different concept: the chain, tool and memory ideas are the same in both. Mixing up cache and memory: a cache reuses a result, memory supplies the past conversation (Module 6).
Unpinned versions: the first line of every LangChain snippet in MAIlab names the versions it is tested on, because the APIs change between releases.
The same contract in LangChain
Test your chatflow
Runs the test set against your own Flowise chatflow, straight from this browser, and checks every reply against the contract.
Submission pack
Built from the contract in the editor and a saved test run.
Call details
Click Inspect on any test result to see its raw request, response and contract check here.
Toolswhat the agent may ask for. The harness decides what actually runs.
Limits and stop conditions
How to run it
Run the agent
Each step: observe (what is in context) → plan (the tool call the model proposes) → act (the harness checks it, then runs, denies or asks a human) → update (the result goes back). The model proposes; the harness decides.
Guardrail lab
Each case uses the design-studio starter and the mode chosen on the left. Predict first, then run it with the harness and again with only a prompt guardrail. A prompt request alone is weaker than a check in code.
The tools, as each provider receives them
The same tools, written in each provider's raw tools field. Limits such as "at least 1" go into the description: the schema tells the model, and the harness enforces it.
Trace and cost
Compare providers on one task
The same scenario, run live on all three providers. Nobody can approve here, so a tool that needs approval ends the run.
The same agent in code
Call details
Click Inspect on a live step to see its raw request, with the tools and the whole conversation so far.
Caseswhat the agent must do, not only what it says
Fallback policywhat happens when a check fails
Syntax error (not valid JSON)
Schema error (wrong fields or types)
Business-rule error
Tool outage
Temporary API error (timeout, 429, 5xx)
up to 3 attempts with backoff, then human review
Wrong API key (401)
stop and alert: retrying cannot fix it
Limit reached, or a tool needs approval
human review
How to run it
Run the evaluation
Each case runs through the agent harness with the fallback policy on the left. A case passes only if the agent did the right thing: the right route, the right amounts, and no forbidden action. Failure tests switch on a planned failure and check that the fallback catches it.
Regression: change one thing, re-run everything
The same eval set on two versions. The demo is set up: A is the studio agent with a typo in its price data (poster RM100), B is v1.0. Accept a change only if nothing that passed before now fails.
Models are used only in live mode (set on the left).
Failure log
What a real system would send to its monitoring: one line per failure, with the error class and the route. Credentials and the customer's data stay out.
Call details
Click Inspect on a live case to see the raw request and response of its first model call.
Build in:
Agentic engineering in eight ideas
Answer each quick check before you build.
1 · Agentic engineering
You build software by directing an AI coding agent that reads files, edits code and runs commands. You set the goal, approve the plan and verify the result.
A freelancer asks Claude Code to add SST to a quote calculator, reviews its plan, then checks the tests and the diff before committing.
2 · A coding agent is the Module 3 loop
Same observe → plan → act → update loop as the agent in Module 3. The tools are now your project: files, the terminal and the tests.
Module 3 harness
Claude Code
System prompt
CLAUDE.md: standing instructions, every session
Tool permission: allowed / approval / denied
Permission rules: allow / ask / deny
Approval pause
Permission prompt, and plan approval in plan mode
Limits (steps, tokens, time)
A time box, small steps, /clear between tasks
Module 4 eval cases
Acceptance tests, agreed before the change
3 · Agentic engineering versus vibe coding
Vibe coding
Accepts whatever the AI produces. 300 generated lines, unread, because the app seems to run.
Agentic engineering
Keeps engineering discipline: clear requirements, small steps, tests, review and version control.
4 · Context and project memory
The agent only knows what it can read. A CLAUDE.md file in the project root gives standing instructions (commands, conventions, rules) that load in every session. It is committed to Git, so it never holds secrets.
5 · Permissions and safety
Claude Code asks before it edits files or runs commands, unless you allow them. Plan mode is read-only. CLAUDE.md is guidance; permission rules are the hard limits.
Allow pytest to run without asking, but keep approval for git push and for deleting files.
6 · Verification defines “done”
An agent saying “done” is not evidence. Passing tests, a readable diff and a run of the real program are. Agree the tests before you ask for the change: you own the requirement and the acceptance test.
compute_quote([("logo", 2)]) must return subtotal RM600.00, SST RM48.00 and total RM648.00.
7 · The renovation analogy
Everyday idea
Technical concept
Contractor, fast on site
Coding agent
Agreed drawings
Approved plan
Site rules
CLAUDE.md + permissions
Inspection before paying
Tests and diff review
Where it stops working: a contractor carries professional liability. The agent carries none, so the reviewer does.
8 · Common mistakes
Mistake
Do instead
Accepting changes without reading the diff
Review every diff. Ask Claude to explain any line you do not understand.
One huge, vague prompt
Break the work into small, testable steps, and plan first.
Secrets or client data in CLAUDE.md or prompts
Keep keys in environment variables. CLAUDE.md is committed to Git.
The working method
The human approves every stage boundary. Loop back to Plan whenever verification or review fails.
ExploreAgent reads and explains the code. No edits yet.
PlanPlan mode: agent proposes, you edit and approve.
ImplementSmall steps: agent edits code and adds tests.
VerifyRun the tests and the program; fix failures.
ReviewRead the diff; question anything unclear.
CommitOne clear commit per change, easy to undo.
A real session
1 · Explore. “Explain this project and how to run its tests.” Claude reads three files and runs pytest: 1 test passes.
2 · Plan. In plan mode Claude proposes: return a dict, add an SST rate, validate inputs, add four tests. Human decision 1: the educator edits the plan to keep the rate in catalogue.json.
3 · Implement and verify. Claude edits quote.py, adds tests and runs pytest: 5 passed. It updates the old test to the new return type.
4 · Review and commit. Human decision 2: the educator spots float rounding and asks for Decimal. Claude updates, re-runs the tests and commits “Add 8% SST and input validation”.
Those two decisions are the engineering. The next step shows why decision 2 matters.
Claude Code essentials
Action
How in Claude Code
Why it matters
Start a session
Run claude in the project folder
The agent works on this project only
Create project memory
/init writes a starter CLAUDE.md
Standing rules for every session
Check what loaded
/memory and /context
See which CLAUDE.md files are in context
Plan before editing
Shift+Tab to plan mode, or /plan
A read-only proposal you approve
Stop or redirect
Press Esc
Interrupt a wrong direction early
Fresh start
/clear
Drop old context between tasks
Control actions
Permission prompts and /permissions
You decide what runs and changes
Shortcuts can change between versions. Check the Claude Code docs at code.claude.com.
Float versus Decimal: the bug a reviewer catches
Change the numbers. Floats store money in binary, so some amounts come out a hair off, and how you write the formula changes the answer.
Rounding a float at the end hides this until it doesn't: in Python, round(2.675, 2) gives 2.67, because 2.675 is stored as 2.67499999….
Step 1 · Your project
CLAUDE.md starts with what the project is, so the agent does not have to guess. Use the Quote helper lab, or press New project above and describe your own system.
Changing the stack on a new project swaps in that stack's commands, permissions and test file. Once you have edited them, use the button instead.
Already ran /init in Claude Code? Paste the CLAUDE.md it wrote, and MAIlab fills the steps from it.
Sections MAIlab does not recognise are kept as they are, at the end of the new CLAUDE.md.
Step 2 · Commands
The commands the agent uses to install, test and run the project. MAIlab chose them from your answer in step 1: you do not need to write any.
Things Claude cannot guess, like how to run the tests. Write the exact command, pytest -q, never “run the tests”. The test command is the one the agent uses to check its own work.
Step 3 · Project map
The main parts of what you are building, in your own words. The agent reads this first, so it knows what matters.
Where things live, so the agent reads the right file first. One line per file or folder that matters; skip the obvious. Starting from an empty folder? List the layout you want, or leave this empty and decide it in Plan.
Step 4 · Rules
Project conventions that differ from the defaults. Write each rule so a reviewer can check it against the diff. “Write clean code” cannot be checked; “Use Decimal for money; round to 2 dp” can.
Step 5 · Never
Red lines the agent must respect. Tick the ones you want: MAIlab writes the permission rule behind each one, so a never is blocked and an ask makes the agent stop for your click.
Clear red lines. CLAUDE.md is context, not enforcement: the agent usually follows it, but nothing stops it. Back each line that matters with a permission rule: deny blocks the action, ask makes Claude stop for your click.
Step 6 · Definition of done
Agree what “done” means before the work starts. Write examples in plain words. MAIlab writes them as tests that fail for now; in the session's first step the agent turns each one into a real test, and you approve them.
Agree the acceptance tests before you ask for the change. MAIlab writes them as a test file you commit first. They fail until the change is made; the change is done when they pass, and the agent is told never to edit them.
Acceptance casesinput → expected output, or an error the code must raise
Step 7 · Permissions
How much the agent may do on its own. You can change this later, and Shift+Tab switches it during a session.
Hard limits, in .claude/settings.json. Claude Code checks deny first, then ask, then allow. Anything not listed asks you. Project rules apply once you trust the folder.
Claude Code may start in another mode unless the settings say "defaultMode": "default". Shift+Tab switches modes during a session.
Bash rules match the command text, so they are not a security boundary: git -C . push slips past Bash(git push *). Use them to keep the agent honest, not to stop an attacker.
Step 8 · Optional automation
Extra helpers. Leave them off for your first session; turn one on when you know why you want it.
Each one is a real Claude Code file. Leave them off for your first session; add one when you know why you want it.
Step 9 · The first task
Never one huge, vague prompt. Write the change you want, then split it into small steps that each end with a test run. MAIlab turns this into the session's prompts, using your commands and rules.
Small, testable steps
Review and download
Everything on the Files tab, in one zip. Unzip it into your project's root folder (the starter: an empty folder called quote-helper).
What is in your pack
Unzipping into an existing project replaces any CLAUDE.md and .claude/settings.json already there. If you have your own, merge by hand.
Use it in Claude Code
Tick each one as you do it. Your ticks are saved with the project.
Session companion
Follow it stage by stage, with Claude Code open beside it. Each stage shows what to type, with Copy buttons; paste the evidence where it asks, and tick the checkpoint before you move on. The Evidence tab reads what you paste.
Submission
What to hand in: your CLAUDE.md, the approved plan showing your edit, the test evidence and a reflection. The reflection is assessed most heavily: it shows whether you supervised the agent or just accepted its output.
Checking Redis…
Your keys
Only keys with your browser's prefix. Inspecting them is not logged below.
Redis commands
Every command MAIlab sent for you, newest first, as redis-cli shows it.
The read-through cache
Build the key, then GET it. A hit returns the stored, validated result. A miss calls the model, checks the answer, and stores it with SET key value EX ttl.
What goes into the keyleave one out and two different requests may share an answer they should not
Guided demos
Hit, expiry, version.
Leave one out.
Side effects.
Session memory
Each turn: identify the session, load its history (LRANGE), pass it in with the new message, check the reply, save the pair (RPUSH, LTRIM) and refresh the TTL (EXPIRE). Storing alone does not make the model remember.
Rate limits
A shared counter per scope and window. The Lua script increments and sets the expiry in one atomic step, and every blocked caller is told when to retry.
The scripts
The whole pipeline
One turn of the studio assistant: rate limit → load history → cache → agent → validate → store → save. On a Redis failure it returns a review result and an error class, without keys or client data.
Normal and failure testsRun all clears your keys first.
The same lab in LangChain
giga_pipeline_lab.py is this pipeline written with LangChain: create_agent with the read-only lookup_price tool and a Quote schema,
then the same cache key, history, atomic rate limit and safe fallback, and the same nine tests. send_quote is never given to the agent.
Run it on your own laptop, against your own Redis.
test runs the nine tests with a free stand-in model, so no key is needed. demo runs the normal and failure cases and the cache and session traces
with your own model: set MODEL_NAME and its key (the file's first lines list OpenAI, Claude, DeepSeek and Ollama), or MODEL_NAME=stand-in to see them for free.
Paste the output into your evidence pack. These are the versions MAIlab tests it on (record tested versions).
Try it on your own machine
Everything so far ran on the class Redis. Now run the same thing on your own laptop: install Redis, replay the commands in redis-cli, run the self-test, and bring the result back as evidence (a training Redis instance).
1 · Install Redis and check it
2 · Replay the commands in redis-cli
Each line is a real Redis command; the ECHO lines print what to look for. Compare your output with the expected output.
3 · Run the self-test
4 · Bring your result back
Code and submission
The pipeline you ran, as Python with redis-py, and the evidence: package versions, the cache hit/miss trace, the separate-session trace, the tests and your decision checklist.
Decision checklisttick what your design does, and say how
Today’s job
Studio Reka JB, a small design studio in Johor Bahru, has an AI assistant that answers customer enquiries. You decide what the AI reads before it answers: start with Start here on the right.
The studio’s documents
What the AI’s search can find. Untick a document to hide it from the search (the search index). Two are out of date on purpose, and one is in Bahasa Melayu.
Practice or a real AI model
The sheet for one question (context X-ray)
A · Search the documents (retrieval)
The documents are cut into short pieces. The search scores each piece against the question, and only the best few go on the sheet.
B · Answer with sources (grounded answers)
The AI answers only from the pieces it was given, and names the piece after each fact, like [price-2026#1]. Code then checks the sources and the numbers. With nothing useful on the sheet, the right answer is “I do not know”.
A · Four ways to carry a long chat (memory strategies)
A customer chats for 15 messages. The deadline comes in message 2 and the budget in message 4. Each way puts a different part of the chat on the sheet: the chart shows the words it costs on every message, and the table whether the last message can still see the facts.
B · Can it find one fact in a long read? (lost in the middle)
One fact (“the client’s maximum budget is RM450”) is hidden in a long pile of past quotes: at the start, in the middle or at the end. Then the AI is asked for it.
Too many similar tools (confusion)
The Module 3 agent quotes one poster, first with its 3 tools, then with 9 look-alike tools added. The whole tool list goes on the sheet at every step. Does it still pick lookup_price, and what do the extra tools cost?
Read once, pay less (prompt caching)
A long, unchanging start (the instructions, the documents and past quotes) is sent twice; the second call should read it from the provider’s cache. Then the time is put at the very top, and the cache stops matching. Unchanging first, changing last.
My design (context spec)
Write your design down: what goes on the sheet, in which order, how much, and why. It starts from what you set in steps 1 to 5. Export it as JSON, or as Python that builds exactly this sheet.
Import my work
Bring in what you built in Modules 2–7. Each one fills its stage, and goes into the build pack as it is.
From idea to a SaaS you can sell
Fourteen stages in four phases: define the idea and its requirements, decide the stack, the quality and the core modules every SaaS needs, design the AI (only when a feature uses it), then ship. Each stage ends in a file your coding agent will read, with blueprint.json as the source of truth. Click a stage to see what you decide there and why.
One request through your app
Drawn from your own decisions: a step you chose not to have is grey. Change a decision on the Blueprint tab and this changes with it.
Pricing
What one task costs you, what a customer costs you a month, and prices that leave a margin. Token prices come from models.json; the exchange rate is yours to check today.
Fixed costs: server, domain, email, tools. Payment fee: check your gateway’s own rate. The margin is what is left of each ringgit after the tokens and the fee. Price from value: a customer compares your price with what the problem costs them, not with your token bill.
Blueprint check
Code checks your requirements, stack, quality targets, permissions and AI decisions against each other and against the lessons of Modules 1–7, as Module 5 checks a Claude Code setup. Fix the errors before you build.
Optional: ask a model to review it
One live call: the whole blueprint goes to a model that looks for risks the checks above cannot see. The cost is shown before you send.
Build pack
Everything you decided, as files any coding agent reads: blueprint.json (the source of truth), AGENTS.md for Codex, Cursor and most agents, CLAUDE.md, GEMINI.md and Copilot instructions that point to it, the docs, and a pending test for each acceptance criterion. Unzip it into an empty folder, open the folder in your coding agent and start with milestone M0 on the Build guide tab.
Build guide
One milestone per session. Paste the prompt into your coding agent; it plans, you approve, it writes the tests first, then the code. When the tests pass, paste the evidence here.
Trainer console
The trainer passcode is TRAINER_PASSCODE in this exam server's .env.
New session
Sessions
Verify a result
The studio is the course case. My own business builds the same agent for your business: your price list, skills and tools.
Skill library
One folder per skill. Until the agent loads one, it sees only the names and descriptions.
Skills and agents
A skill packages the know-how for one kind of task: a name, a description of when to use it, numbered steps and optional files. An agent works toward a goal by choosing which of its permitted skills and tools to use, inside a harness that sets the rules.
One agent, many skills
Prompt, tool or skill?
A prompt is one instruction. A tool is one function the app runs. A skill bundles know-how for a task: instructions plus the tools and files it needs.
Analogy: the clinic receptionist
She keeps a binder of procedures: booking, billing and panel insurance claims. She reads the tab labels and opens only the procedure each patient needs.
My own business
The same kind of agent for your own business: its price list, its skills and its tools. It is kept apart from the studio lab: switch with Starting point on the left.
Keep each business you build: Save set on the left stores it under a name, and Load brings it back, so a learner can keep several case studies and switch between them.
Profile
Price list
One file, catalogue.json, that the skills refer to, and the lookup_price tool reads. Never copy prices into a skill.
Writes classify-enquiry, draft-quote, bilingual-reply (when clients write in BM) and make-booking (when an action needs approval), the agent's instructions, samples and a test plan, in your business's words. Free and the same every time: then edit them.
Tools
Data only, as in Module 3: a look-up table, a calculator formula, or an action that never leaves MAIlab. Every call goes through the harness: allowed runs, needs approval waits for staff, denied is refused.
Output
The JSON the agent finishes with, checked in three layers like a Module 2 contract.
Write a skill
Keep each skill to one task. If the steps need “and also…”, split it into two skills. The name and description are always visible to the agent; the steps load only when it uses the skill.
Checks
Test it alone
Run 3–5 sample requests on this skill by itself and check each output. A wrong answer is easier to trace to one skill. Each test records the version; change the skill and test again.
Build the agent
Test each skill alone first, then the agent.
Tools
Least privilege: read-only first. load_skill and read_file are always there: they only read the skill library.
Harness
The harness checks every call, refuses anything that sends, and logs every step. Module 3 shows a full harness with approvals.
Run the agent
The model sees the instructions and the skill index, calls load_skill for each skill it needs, then read_file and lookup_price. Every reply is a draft for staff: nothing goes to the client.
Test plan
Record which skills the agent actually used. A right answer from the wrong skills is still a fail. Test requests that need 0, 1, 2 and 3 skills.
Use your skills elsewhere
This lab runs in Claude with Skills turned on, in Claude Code, or in Flowise. The same SKILL.md files work in the first two.
Claude Code
A project folder: each skill in .claude/skills/<name>/SKILL.md with its files, the agent instructions and the test plan in CLAUDE.md. Unzip it into a folder, run claude there, and try the five requests.
Claude (claude.ai)
One zip per skill, with the skill's folder at its top. Upload each under Settings → Features (Skills, with code execution on). Only name and description are in the frontmatter, as claude.ai requires.
Flowise
Skills lab submission
The reflection counts most: it shows that descriptions control when a skill is used.
Reflection
After (its description now):
Today’s job
Pusat Tuisyen Cemerlang, a tuition centre in Johor Bahru and Kulai, answers parents on WhatsApp. You build the Johor Bahru assistant that finds the right page in its documents and answers only from it: start with 1 · Start here on the right.
The centre’s documents
Each one has labels (metadata): its branch, current or out of date, its language, and where it came from. One was copied from Facebook and never checked.
Numbers for meaning (embeddings)
Practice or a real AI model
A · Cut the documents into pieces (chunking)
B · Add a document of your own (ingestion)
It is cut, labelled and searched like the others, and saved in this browser. A line that starts with # is a heading.
A · One piece as numbers (an embedding)
How close are two sentences? (cosine similarity)
B · Three searches side by side (retrieval)
C · The map of meaning (the vector space, flattened)
Keep out, read again, keep a few (filters, reranking, threshold)
The question, the pieces and the rules (the generation prompt)
16 labelled questions (an evaluation set)
Two in Bahasa Melayu, one that needs two documents, and two that no document answers. For each: were the right pages handed over, how soon, is the answer right, and does it stay with its sources?
Each case starts from a good set-up (cut by paragraph, both searches, every filter, a second reading, three pieces, the rules on) and breaks one thing.
8 · My design (the RAG spec)
Write your design down, from what you set in steps 2 to 6, with a reason for each choice. Export it as JSON (Module 8 imports it into stage 9), or as one Python file that runs the same pipeline and tests it, with nothing to install.
Today’s job
Studio Reka JB uses Claude Code, Claude Desktop and a Flowise assistant, and each one needs the same prices. You build one MCP server for all of them, plug MAIlab’s agent into it, then your own AI app: start with 1 · Start here on the right.
Your MCP servers
Each one runs on this computer at its own address (Streamable HTTP). Steps 2, 3 and 5 use the one you choose.
Practice or a real AI model
Send one request (JSON-RPC over HTTP)
A · What the app allows (the host’s permissions)
The server labels each tool; the app decides. The starting point follows the server’s labels because you built this server. For a server you did not build, start from “a person approves”.
B · The same tools, three ways (tools/list, then each provider’s tools field)
Run the agent to see the tools as the server sends them, and as Claude and OpenAI receive them.
C · The run (Module 3’s loop, with an MCP client)
Serve a Module 3 scenario (your tools as an MCP server)
Who connected (the server’s log)
Step 7 of 8 (MCP in your own system)
Use it in your own system
8 · My design (the MCP server spec)
Write your server down: what it offers, what each app may do with it, how apps connect, and the checks you keep. Export it as JSON, or download the server as one Python file.
Today’s job
Kafe Senja wants a logo and a poster, and 200 A3 posters printed by Friday, with the reply in BM and English. Studio Reka JB’s agents share the work, and the printing goes to another company’s agent: start with 1 · Start here on the right.
The team
Practice or a real AI model
The client’s request
Who does what (the pattern)
The whole conversation, or a short brief? (context in a hand-off)
The same request and pattern, run both ways.
A · Find the agent (its Agent Card)
B · Send it a task (JSON-RPC: SendMessage)
Step 7 of 8 (orchestration and A2A in your own system)
Use it in your own system
8 · My design (the orchestration spec)
Write your design down: the pattern and why, what each hand-off carries, the merge checks, the limits, and which other companies’ agents you trust. Export it as JSON, or download it as one Python file that runs it and checks it.
Today’s job
Practice or a real AI model
Your versions
Your prompt (the specification)
Tick a constraint to add it to the prompt; untick it to take it out.
The tracker
Automatic checks (a probe drives the page)
Your own criteria (tested by hand in the preview)
Compare two versions
Commit the open version
History
Step 7 of 8 (your own folder, Git and assistant)
Use it in your own project
8 · My project brief (a starter repository)
The files a marker opens first: what it is, how to run it, the stories, every prompt with its reason, and the page itself. Name the AI tools you used: the course asks you to say so.
Today’s job
Where you are
Practice or a real AI model
Only for “Ask the AI to fix it” in step 4.
The tracker, running (the original logic.js)
logic.js (as the AI wrote it)
Predict before you run
Log a defect (a bug report)
Your logic.js
Ask the AI to fix it (and review the change first)
Your tests (test and assert, as in node:test)
Step 7 of 8 (issues, failing tests and node --test on your computer)
Use it in your own project
8 · My test report (defects, tests and reflection)
What you found, what you fixed, and which test guards each fix. Then three questions the course asks you to reflect on.
Today’s job
Practice or a real AI model
For step 5, Generate from the contract.
Screens (the user flow)
The AI’s first draft. Change it here: MAIlab writes the SQL from this form.
Who may do what (the access rules, from the stories)
The OpenAPI JSON it makes
The prompt (the contract is in it)
Tick a constraint to add it; the contract is added from step 4.
Step 7 of 8 (a real repository: backend, frontend and docs)
Use it in your own project
8 · My design pack (contract, schema, flow and code)
Everything the backend and the frontend are built from, and the code generated from it. It downloads only when no secret is left in the code.
Today’s job
Your portal
Opening your portal…
Send a request (a real HTTP request to your portal)
Who got what
Recent requests (from anywhere: this page, curl, your tests)
Step 7 of 8 (FastAPI dependencies, Pydantic, pytest and Playwright on your computer)
Use it in your own project
8 · My test plan (rules, tests and failure cases)
Each rule, the tests that catch it breaking and whether it is fixed; each failure case, predicted and seen. The tests download for pytest, with a Playwright test for your own page.
Today’s job
The agent asks
Practice or a real AI model
For step 4, The run, and the agent’s answer to your review.
The repository
The plan the AI suggested. Each row is one task: what it is, which criteria it serves, which files it changes, and the test that proves it.
The AI’s suggestion: allow everything, so it never has to stop and ask.
Folders it may change
Commands
AGENTS.md, as your rules write it.claude/settings.json, the same rules for Claude Code
The change, file by file
Step 7 of 8 (a real coding agent, an issue and a protected main)
Use it in your own project
8 · My agent plan (AGENTS.md, permissions, plan, run log, review and traceability)
Everything a real agent needs to work in the tracker the way yours did here, and the evidence of how it went. It downloads only when no key is in it.
Today’s job
Practice or a real AI model
For step 3, Run the team. A real model plays each agent in its own conversation.
The team’s repository
The AI’s suggestion: every agent gets every tool, no round limit, no team rules.
Team rules
AGENTS.md, as your team rules write it
tools/list (what the practice repository’s server offers)
The JSON-RPC answer
Call a tool (tools/call, on a copy of the team’s repository)
Every step of the last team run
Find the fault
A recorded practice run that ended approved, yet BC2 is broken. Click the step where it went wrong.
Step 7 of 8 (subagents, permissions, hooks, a turn limit and MCP)
Use it in your own project
8 · My agent team (subagents, permissions, team rules, run log and failures)
The three agents for Claude Code with your tools and rules, and the evidence of how the team ran. It downloads only when no key is in it.
Today’s job
Your pipeline
The missing test (an API test, as a Lab 4 table row)
Nothing checks that a student cannot grade. Write the test that fails when one can.
The AI’s workflow, as a form. MAIlab writes ci.yml from it.
When it runs, and with what
Jobs
.github/workflows/ci.yml, as the form writes it
Branch protection (the checks main requires)
Secrets in the whole history
The dependency audit (C4’s packages; advisories made up)
Static analysis (bandit’s findings)
docs/security-report.md
Step 7 of 8 (GitHub Actions, branch protection, gitleaks and Dependabot)
Use it in your own project
8 · My pipeline (the portal, its tests, ci.yml, gitleaks, Dependabot and the report)
The portal as a repository you can push to GitHub, with your workflow and its settings. Its tests run with pytest as they are, so the first run can go green. It downloads only when no key is in it.
Today’s job
Your staging
v1.1’s commits
The version number
Before deploying
How v1.1.0 goes out
Staging’s settings
Alert rules
Logs (the last 15 requests)
Timeline
Restore the service
Incident report (blameless)
What the portal costs to run, a month
Step 7 of 8 (Docker, a staging host, a deploy job, migrations and rollback)
Use it in your own project
8 · Final report (release, rollback proof, incident, evaluation, Dockerfile and deploy job)
The release written up end to end, and the files to deploy Lab 7’s portal repository for real. It downloads only when no key is in it.
Today’s job
The situation
Practice or a real AI model
For steps 3 and 4: who writes the answers.
Tokens (OpenAI’s o200k tokenizer, run on MAIlab)
The next word (next-token prediction)
Rank the four candidates for each opening, 1 for the most likely, then compare.
The context window
The prompt MAIlab sends
Compare two versions
My acceptance criteria (written before reading)
Spot the problem
Four answers from other prompts. Each has one problem: find it against the situation on the left.
Step 7 of 8 (ChatGPT, Claude, Gemini or Microsoft Copilot)
Use it in your own assistant
8 · My prompt card (a template with blanks and its checks)
Your final prompt as something you can reuse: the facts that change become blanks, and the criteria travel with it.
Today’s job
Practice or a real AI model
For steps 2 to 5: who answers. Step 6 is practice only.
Made up for teaching
Every enquiry, student, meeting and figure in this lab is invented. Use real ones only in your own assistant, with names removed.
The twenty enquiries
Your examples (up to six, in this order)
Examples to choose from
The five enquiries (MAIlab adds them after your prompt)
The office’s tracker needs: .
The meeting notes (MAIlab adds them to every prompt)
One prompt for everything
A chain of three (each gets the notes and the previous answer)
Practice only: MAIlab’s model calls carry text, so a stand-in reads these images. Download one and try it in your own assistant on step 7.
Step 7 of 8 (few-shot prompts, tables, chains, self-checks and images in your assistant)
Use it in your own assistant
8 · My prompt library (every prompt with its blanks and its checks)
This lab’s prompts, as you wrote them, ready to reuse. The library is kept in this browser: download it, and load it back on another computer.
Today’s job
The lab change
Practice or a real AI model
For every step: who writes the answers.
All three readers:
The committee report (MAIlab adds it after your prompt)
Both summaries:
The source(MAIlab adds it after your prompt)
The faculty glossary
The lecture note (MAIlab adds it after your quiz prompt)
The quiz
The rubric
Step 7 of 8 (ChatGPT, Claude, Gemini or Microsoft Copilot)
Use it in your own assistant
8 · My writing kit (your prompts, the glossary and the checklists)
This lab’s prompts as you wrote them, ready to add to your library, with the faculty glossary and the habit of removing personal data.
Today’s job
Practice or a real AI model
For every step: who answers.
Made up for teaching
Every claim, staff member, student, survey answer and number in this lab is invented. Real forms and data go only into tools your university approves for them.
The text copied from the three claim PDFs (MAIlab adds it after your prompt)
The claims sheet (MAIlab adds it as CSV after your prompt)
The five questions (MAIlab adds them too)
The dean’s questions (MAIlab adds them, and the survey, after your prompt)
survey.csv (120 made-up postgraduates)
Three test cases
A colleague’s library (Ravi’s file: what merging will do)
Before you paste (a made-up student list)
The assistant’s spec
Five test messages (sent with your instructions as the system prompt)
Message 4 carries made-up personal data on purpose, to test the refusal. In real use, not pasting is the control: by the time an assistant refuses, the data has already reached the provider.
Step 7 of 8 (PDFs, spreadsheets, data-analysis tools and custom assistants)
Use it in your own assistant
8 · Our team library (templates with authors, versions, tests and the checklist)
Everything in your library, ready to share: colleagues load the file into their own MAIlab, and merging keeps both versions when a prompt differs.
The verification checklist
Today’s job
The review
Practice or a real AI model
Who answers; OpenAlex is real either way.
The criteria
The 40 abstracts (made up; MAIlab adds them after your prompt)
Screen 10 yourself
MAIlab adds six included abstracts (S01, S04, S05, S17, S32, S34) after your prompt. Fields: design, sample, models, metrics, finding.
protocol.md
Step 7 of 8 (OpenAlex, Scopus or Web of Science, Zotero, and your own reference list)
Use it in your own research
8 · My review kit (the prompts, their checks and the protocol)
This lab’s prompts as you wrote them, with the checks that go with them, ready for your own review.
Today’s job
The codebook
For codebook and coding-reliability approaches; reflexive thematic analysis codes differently and does not measure agreement.
Practice or a real AI model
Who answers; MAIlab’s checks are the same either way.
Code 10 yourself
workshop.csv: 24 made-up students, before and after (MAIlab adds it after your prompt)
Aisyah’s paragraph (made up)
Eight scenarios
Step 7 of 8 (your transcripts, your data in Python or R, your draft, your rules)
Use it in your own research
8 · My research kit (the prompts, their checks, the disclosure and the audit trail)
This lab’s prompts as you wrote them, with the checks that go with them, ready for your own research.
Today’s job
The five topics
Practice or a real AI model
Who answers. A plan records which, and its runs keep to it.
Prompt A (Dr Farah’s, fixed)
An AI’s plan
My plan
The people’s rubric (they scored all 20 replies with it)
A real judge runs only in real-model mode; by default it is a different model from the experiment’s.
Step 7 of 8 (a real model, OSF, and your own results)
Use it in your own research
8 · My experiment kit (the prompts, the plan, the judge and the checklist)
This lab’s prompts and plan as you wrote them, ready for your own experiments.
Today’s job
Practice or a real AI model
Who answers; the checks are the same either way.
The ten answers (made up; open each to compare what a person sees with what the AI reads)
The assistant’s instructions, three ways
Step 7 of 8 (your own assistant or study)
Use it in your own research
8 · My robustness kit (the report, the checklist and the prompts)
The experiment report from your records, the robustness checklist, and this lab’s prompts.
Today’s job
Practice or real models
Who answers. The model here is the one you try a task on, add on step 4, and ask to read the results.
Calls and money
Calls made at the same time can slow each other down: 1 at a time gives the cleanest latency, 4 finishes sooner.
Prices are in US dollars, as in models.json. Enter today’s rate to see RM as well; MAIlab does not guess it.
The set’s fingerprint (SHA-256):
Try one task (this is not benchmarking)
Why a long prompt costs time once, and a long answer costs it per token
Prefill reads the whole prompt in one pass, and the model keeps what it has read in a KV cache(the keys and values of every token so far). Decode then writes one token at a time, each one looking back at that cache, so every extra answer or reasoning token adds its own slice of time.
A provider also batches calls from many customers on the same hardware: when it is busy, each call gets a smaller share, which is one reason the same call is faster at some times than at others. Prompt caching, which re-uses the cache of a repeated prompt, is measured in Context Engineering (Module 7 of the AI Automation course).
Two questions
A runs file (benchmark-runs.json) holds the configurations, the task set’s fingerprint and every call. Loading one checks that it answered this task set, then works like a finished run: a trainer can record a real benchmark once and share it.
Two configurations, task by task
One task, every run
The AI’s reading
model-report.md
Today’s job
Your settings
Carried from step to step, and into the notebook on step 9.
Practice or a real AI model
Used only by the teacher on step 7 and the AI’s reading on step 10. The rest of the lab needs no model.
Your own dataset: one item a line, as {"input", "output"}, {"enquiry", "reply"} or {"messages"}, at least 50 and at most 5,000 lines. It replaces the office’s for every later step. A "split" field on every line keeps its own split; otherwise MAIlab splits it 80/10/10.
Your own rules (the generic scorer)
One item in the model’s chat template
Token lengths (estimate)
The split and the leakage check
The style check of every training reply
Two variants, mentioned only: DoRA and rsLoRA
DoRA splits each weight into a size and a direction and adapts the direction with LoRA, which can come closer to a full fine-tune at the same rank. rsLoRA scales the update by alpha ÷ √r instead of alpha ÷ r, so a high rank still learns. Both are one setting in PEFT’s LoraConfig (use_dora, use_rslora); this lab keeps plain LoRA.
A question
The memory on a free T4 (estimate)
For deployment: GGUF sizes (estimate)
Your choice
Total against active parameters
Two real MoE models
Where LoRA goes on an MoE
On the attention layers, which every token uses, or on each expert’s MLP; the router is usually frozen, so that training does not upset the balance it has learned. Either way the whole model must be in memory, which is why this lab fine-tunes a small dense model.
A question
Logit distillation: soft targets
How to run it
Open colab.research.google.com with a Google account, then File → Upload notebook, and choose e02-adaptation.ipynb.
Runtime → Change runtime type → T4 GPU → Save.
Runtime → Run all. The first cell stops with a clear message if no GPU is attached. Step 8 gives an estimate of the training time; the replies before and after take a few minutes more.
When it finishes, save results.json (it downloads by itself) and load it on step 10.
Free GPUs are not guaranteed: when Colab has none to lend, try again later. MAIlab cannot run the notebook itself; it never asks for a token and never uploads your data. Uploading the notebook to Colab puts the dataset written into it on Google’s machines, so use your own dataset only if you may share it with Google.
The cells
Optional: your model in Ollama
With Ollama running on this computer, the base model (ollama pull qwen3:0.6b) and yours (from the notebook’s optional last cell and ollama create) answer the same test items, one at a time, scored the same way. Free: it runs on this computer.
The AI’s reading
adaptation-results.md
Today’s job
Practice or a real AI model
Who answers, reranks, extracts and summarises. Practice uses MAIlab’s free stand-ins, with made-up names and estimated costs.
Meaning search
The embeddings behind meaning search: MAIlab’s free stand-in, or real ones from OpenAI or Ollama, as in the RAG Lab.
Money
Prices are in US dollars, as in models.json. Enter today’s rate to see RM as well; MAIlab does not guess it.
Try one question (this is not benchmarking)
Merge candidates (entity resolution)
Relations (each from its chunk)
Add a relation the extraction missed
Communities and their summaries
The graph
The benchmark plan
The run
A runs file (retrieval-runs.json) holds the plan, its fingerprint and every record. Loading one rebuilds it from checked fields; a file made on another question set, corpus or graph loads, but is named, and no control ticks for it.
Two systems, question by question
The AI’s reading
Export the graph
graph.cypher is one MERGE statement per entity and per relation, for Neo4j; graph.json is NetworkX node-link data. Both are data only.
retrieval-report.md
Today’s job
Practice or a real AI model
Who reads the requests, checks them and writes the emails. Practice uses MAIlab’s free stand-ins, with made-up names and estimated costs; a person always decides the edge cases.
The checker’s search
Money
Prices are in US dollars, as in models.json. Enter today’s rate to see RM as well; MAIlab does not guess it.
The team (each agent’s input and output)
One request by hand (one transition of the step machine at a time)
A runs file (recovery-runs.json) holds the designs, their fingerprints, every run’s outcomes and step 5’s trace. Loading one rebuilds it from checked fields; a file made on other requests, times or failure rates loads, but is named, and no control ticks for it.
Two designs, request by request
The AI’s reading
e04_recovery_graph.py
recovery-report.md
Today’s job
The traces
Practice reads a simulated week of the agent team’s traffic, free. Live reads your own calls from MAIlab’s call log and makes no model calls.
The rollback rule: roll back when a test shows 1.2 is worse; promote only when the tests rule out a quality drop larger than the margin and a p95 rise larger than the allowance; otherwise extend.
jaeger.md
ops-report.md
Today’s job
Practice or a real AI model
Who checks the requests and writes the lessons. Practice uses MAIlab’s free stand-ins, with planted behaviour and estimated costs; a live run is counted, costed and confirmed first.
A results file
This browser did not keep E06’s last save: its storage for this site may be full, so this work would be lost on reload. Download memory-runs.json and lessons.json on step 9 to keep it.
Each strategy is one change against the baseline (no memory), with the same corrections, seeds and repeats:
The test: week 3, unseen, after the memo. Week 4 stays locked until a final plan is saved after hygiene (step 7).
memory-report.md
Today’s job
Practice or a real AI model
Who runs the pilot’s two conditions. Practice uses MAIlab’s free stand-ins from E01, E03 and E06, with planted behaviour and estimated costs; a live pilot is counted, costed and confirmed first.
This browser did not keep E07’s last save: its storage for this site may be full, so this work would be lost on reload. Lock the plan and download prereg.json on step 9 to keep it.
item_id, split (pilot or test), optional kind and text
against the treatment:
To find current baselines in the literature, PE301 Lab 5 shows how to search it with OpenAlex.
in E08’s results.csv template, on your pilot tasks
proposal.md
Today’s job
The locked plan
Practice or a real AI model
Who runs step 3’s two conditions. Practice uses MAIlab’s free stand-ins from E01, E03 and E06, with planted behaviour and estimated costs; a live run is counted, costed and confirmed first.
This browser did not keep E08’s last save: its storage for this site may be full, so this work would be lost on reload. Download results.csv on step 3 to keep the run.
README: how to repeat the run
research-report.md
Today’s job
The case
Step 7 of 8 (Trello, Jira, GitHub Projects or Miro)
Use it in your own project
8 · Our team charter
Today’s job
The case
Two strategies
Feasibility
The risk register
The overrun
Step 7 of 8 (Trello, Jira, GitHub Projects or Miro)
Use it in your own project
8 · Our initiation pack
Today’s job
The case
Is it Done?
Step 7 of 8 (Trello, Jira, GitHub Projects or Miro)
Use it in your own project
8 · Our release and sprint plan
Today’s job
The case
Two actions for sprint 5
Step 7 of 8 (Trello, Jira, GitHub Projects or Miro)
Use it in your own project
8 · Our sprint report
Today’s job
The case
Practice or a real AI model
For step 6: who writes the drafts.
Step 7 of 8 (Trello, Jira, GitHub Projects or Miro)
Use it in your own project
8 · Our story backlog
Today’s job
The case
Practice or a real AI model
For step 6: who writes the tests.
Part A · Tests from an AI
Part B · The demo
Step 7 of 8 (Trello, Jira, GitHub Projects or Miro)
Use it in your own project
8 · Our acceptance tests
Today’s job
The case
Step 7 of 8 (Claude on the web, the desktop app or the mobile app)
Use it in your own work
8 · My Claude playbook
Today’s job
The case
Step 7 of 8 (Claude on the web, the desktop app or the mobile app)
Use it in your own work
8 · My Claude setup
Today’s job
The case
Step 7 of 8 (Claude with Cowork, on MAIlab's practice folder)
Use it in your own work
8 · My hand-off brief
Today’s job
The case
Step 7 of 8 (Claude with Cowork, on MAIlab's practice folder)
Use it in your own work
8 · My Cowork setup
Today’s job
The case
Step 7 of 8 (Claude Code on MAIlab's practice project)
Use it in your own work
8 · My project setup
Today’s job
The case
Step 7 of 8 (Claude Code on MAIlab's practice project)