{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Building Multi-Agent Systems \u2014 Introduction\n",
        "\n",
        "## Learning Objectives\n",
        "- Planner/executor/specialist patterns\n",
        "- Blackboard architectures for shared memory\n",
        "- Debate and critique patterns (controlled)\n",
        "\n",
        "## Time Estimate\n",
        "**1.5\u20132 hours**\n",
        "\n",
        "## Notebook Intent\n",
        "This notebook is designed to be run top-to-bottom. Each section ends with a small checkpoint you can reuse in your own projects.\n",
        "\n",
        "---\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Guided Practice \u2014 Foundations\n",
        "\n",
        "You will:\n",
        "- implement a small, testable unit of logic\n",
        "- interpret the results in domain terms for **Building Multi-Agent Systems**\n",
        "- identify the next experiment that would most improve outcomes\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "from __future__ import annotations\n",
        "\n",
        "from dataclasses import dataclass\n",
        "from typing import Dict, List\n",
        "\n",
        "\n",
        "@dataclass\n",
        "class LessonRun:\n",
        "    name: str\n",
        "    score: float\n",
        "    notes: str\n",
        "\n",
        "\n",
        "def summarize_runs(runs: List[LessonRun]) -> Dict[str, float]:\n",
        "    if not runs:\n",
        "        raise ValueError(\"runs must not be empty\")\n",
        "    avg = sum(r.score for r in runs) / len(runs)\n",
        "    return {\"count\": float(len(runs)), \"average\": round(avg, 3)}\n",
        "\n",
        "\n",
        "runs = [\n",
        "    LessonRun(\"baseline\", 0.62, \"first pass\"),\n",
        "    LessonRun(\"tightened_prompt\", 0.74, \"added constraints + examples\"),\n",
        "    LessonRun(\"eval_hook\", 0.81, \"added a simple automated check\"),\n",
        "]\n",
        "\n",
        "summarize_runs(runs)\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Exercise (Notebook)\n",
        "Pick one metric you care about for **Building Multi-Agent Systems** (quality, latency, cost, risk).\n",
        "\n",
        "1. Write down how you will measure it (even if approximate).\n",
        "2. Change one part of the code cell and rerun.\n",
        "3. Record what improved and what regressed.\n",
        "\n",
        "## Stretch\n",
        "Turn the code cell into a function with type hints and add one negative test (an input that should fail).\n"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "version": "3.10.0",
      "mimetype": "text/x-python",
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 4
}
