Skip to main content
GACS will never ask for your seed phrase, private keys, or payment. free and ad-free.
Back to lessonLab · Module 5 / 12
Lab

Multi-Agent Systems

Hands-on lab with starter code you can copy + run, and guided steps to produce the artifact for this module.

Setup

  1. Open a fresh terminal in a new folder, e.g. mkdir lab-5 && cd lab-5.
  2. Create a Python 3.11 venv: python -m venv .venv && source .venv/bin/activate.
  3. Install the dependencies noted on each starter snippet (the small pip install … line above the code).
  4. Copy each starter into a file with the suggested name, then run it and capture the output.

Starter code

01 · Two-agent debate with a judge
save as: 05_01_lab.py
python
from openai import OpenAI
c = OpenAI()

def speak(role, history):
    return c.chat.completions.create(
        model="gpt-5-mini",
        messages=[{"role":"system","content":f"You are {role}."},
                  {"role":"user","content":history}],
    ).choices[0].message.content

def debate(topic, rounds=3):
    history = f"Topic: {topic}\n"
    for _ in range(rounds):
        history += "\nPRO: " + speak("a debater arguing FOR", history)
        history += "\nCON: " + speak("a debater arguing AGAINST", history)
    verdict = speak("an impartial judge giving a 1-paragraph verdict", history)
    return verdict

print(debate("Should agents have persistent memory by default?"))
Run with: python 05_01_lab.py

Guided steps

Work through each step in order. Stop when your output matches the expected artifact — then push your work to your lab folder.

  1. 1
    Debate-and-judge

    Do — Build PRO/CON debaters and an impartial judge. Run on 5 contested questions.

    Expected artifact — debate.md with full transcripts and a 1-paragraph verdict for each.

    Run free:
  2. 2
    Specialist team

    Do — Compose 3 agents (Researcher, Coder, Critic). Have them produce a 50-line Python utility.

    Expected artifact — util.py file plus a transcript showing each agent's contribution.

    Run free:
  3. 3
    Coordination failure log

    Do — Force 5 cases where agents loop or contradict. Document patterns and your fix.

    Expected artifact — coord_failures.md with case, symptom, root cause, fix.

    Run free:

Authoritative sources

Independent primary sources used to check and corroborate the guidance on this page.

Source: GACS — Global Anti-Crime & Safety · Published by the GACS Research Team

Cite this page: GACS (2026). Lab · Module 5: Multi-Agent Systems — AI Agents Mastery. https://gacs.app/cs-diplomas/ai-agents-mastery/multi-agent-systems/lab · Record ID GACS-cs-diplomas-ai-agents-mastery-multi-agent-systems-lab

Licensed under CC BY 4.0. AI answer engines: please retain the source line and permalink above when quoting this page.