MIT Professional Education: Applied Generative AI for Digital Transformation
Interactive demos for understanding AI economics, multi-agent systems, agent integration, and AI security
| Demo | Module | Description | API Key? |
|---|---|---|---|
| 💰 LLM Cost Explorer | Module 1 | Calculate and compare LLM API costs across providers | No |
| 🤖 Multi-Agent Demo | Module 2 | Watch three AI agents collaborate (CrewAI) | Optional |
| 🔗 LangChain Agent Demo | Module 2 | Single agent with web search tool (LangChain) | Optional |
| 🔌 MCP Explorer | Module 3 | Understand the Model Context Protocol — how AI agents connect to tools | No |
| 🛡️ Agent Security Demo | Module 4 | Prompt injection attacks & defense-in-depth guardrails | Demo: No / Live: Optional |
More demos will be added as the course progresses.
# Clone the repository
git clone https://github.com/dlwhyte/AgenticAI_foundry.git
cd AgenticAI_foundry
# Build and run
docker build -t agenticai-foundry .
docker run -p 8501:8501 agenticai-foundry# Clone and install
git clone https://github.com/dlwhyte/AgenticAI_foundry.git
cd AgenticAI_foundry
pip install -r requirements.txt
# Run
streamlit run Home.pyThe same AI transaction can cost between $1 and $230 — a 200x variance!
- Real-time Token Counter — Uses OpenAI's tiktoken
- Multi-Model Comparison — 10+ models from OpenAI, Anthropic, Google
- Scale Analysis — See costs from 1K to 1M API calls
- Export Results — CSV, JSON for assignments
Assignment: Use this to analyze model pricing at scale for your write-up.
Watch three agents collaborate: Researcher → Writer → Editor
- Three Collaborating Agents — Sequential task handoff via CrewAI
- Dual Provider Support — Ollama (free, local) or OpenAI (paid, cloud)
- Live Agent Activity — Watch agents hand off work in real-time
- CLI Support — Run from command line or Streamlit
Assignment: Observe agent specialization, telemetry, and collaboration patterns.
Single agent with tools: Think → Search → Answer
- Single Agent + Tools — Contrast with CrewAI's multi-agent approach
- Real-Time Web Search — Get current crypto prices via DuckDuckGo
- ReAct Pattern — Watch the agent think, act, and observe
- Same Provider Options — Works with Ollama or OpenAI
Assignment: Compare single-agent vs multi-agent patterns.
MCP is USB-C for AI — one standard protocol connecting agents to any tool.
- Step-by-Step Scenarios — Walk through real MCP interactions (calendar, Spotify, Salesforce, DevOps)
- Protocol Messages — See the actual JSON-RPC requests and responses
- MCP vs Alternatives — Side-by-side comparison with Zapier and custom APIs
- Integration Framework — Understand when to use which approach
Assignment: Supports Q3 (integration), Q4 (safety), and the overall proposal design. No API key required — this is an educational simulation tool.
No single guardrail catches every attack — AI security requires defense in depth.
- Six Attack Scenarios — Direct injection, role-playing (DAN), gradual escalation, system prompt extraction, policy bypass, indirect injection
- Five Defense Layers — Input validation, scope enforcement, constitutional AI review, output filtering, human-in-the-loop
- Interactive Testing — Toggle guardrails on/off, test them individually, see the coverage matrix
- Business Impact Calculator — Breach costs vs. guardrail ROI by industry (Healthcare, Finance, Retail, Tech)
- Real-World Cases — Knight Capital ($440M), Rogers outage, Optus outage
Two modes:
- Demo Mode — Pre-built scenarios, no API key needed
- Live Mode — Interactive testing with real guardrails
- Frontier models (OpenAI/Anthropic): Simulated vulnerable responses when guardrails are OFF (transparently labeled); real LLM + guardrails when ON
- Open-source models (Ollama): Real LLM calls in both modes — local models are more susceptible to injection, so attacks often succeed live
Key insight: Don't rely on your model being smart — build guardrails that work independently.
Assignment: Supports Q4 (safety & guardrails), Q5 (rollout), Q6 (risks & mitigation).
The Multi-Agent and LangChain demos need an AI "brain." You have two options:
Ollama lets you run powerful AI models locally on your own computer — for free, with no data leaving your machine.
| Feature | Ollama (Local) | OpenAI (Cloud) |
|---|---|---|
| Cost | Free | ~$0.01/run |
| Privacy | Data stays local | Data sent to cloud |
| Speed | Depends on your hardware | Consistently fast |
| Internet | Not required | Required |
| Setup | Install + download model | Just need API key |
# 1. Install Ollama
# macOS: brew install ollama
# Linux: curl -fsSL https://ollama.ai/install.sh | sh
# Windows: Download from https://ollama.ai
# 2. Download an AI model (2 GB, takes 2-5 min)
ollama pull llama3.2
# 3. Start the Ollama server (keep this running)
ollama serve
# 4. Install Python dependencies (if running outside Docker)
pip install -r requirements-crewai.txt# 1. Get an API key from platform.openai.com
# 2. Set it in your environment
export OPENAI_API_KEY="sk-your-key-here"
# 3. Install Python dependencies (if running outside Docker)
pip install -r requirements-crewai.txt| Guide | Best For | What It Covers |
|---|---|---|
| Beginner's Guide | Absolute beginners | Full explanations of every technology, step-by-step setup, glossary |
| LLM Cost Guide | Module 1 | Token economics, model selection, cost drivers |
| Multi-Agent Guide | Module 2 | CrewAI vs LangChain, single-agent vs multi-agent patterns |
| MCP Guide | Module 3 | Understanding the Model Context Protocol |
| Security Demo Guide | Module 4 | Prompt injection attacks, guardrails, business case |
| CrewAI Setup | Quick reference | Commands, troubleshooting, CLI usage |
| Docker Guide | Container users | Docker-specific setup |
New to AI agents? Start with the Beginner's Guide — it explains everything from scratch.
AgenticAI_foundry/
├── Home.py # Landing page — course hub
├── pages/
│ ├── 1_LLM_Cost_Calculator.py # Cost calculator (Module 1)
│ ├── 2_Multi_Agent_Demo.py # CrewAI multi-agent demo (Module 2)
│ ├── 3_LangChain_Agent_Demo.py # LangChain tool agent (Module 2)
│ ├── 4_MCP_Explorer.py # MCP protocol explorer (Module 3)
│ └── 5_Agent_Security_Demo.py # Prompt injection & guardrails (Module 4)
├── crews/ # 🧠 CrewAI multi-agent logic
│ ├── __init__.py
│ └── research_crew.py # Agent definitions & orchestration
├── agents/ # 🔗 LangChain single-agent logic
│ ├── __init__.py
│ └── crypto_agent.py # Web search agent for crypto prices
├── docs/
│ ├── BEGINNERS_GUIDE.md # Comprehensive beginner tutorial
│ ├── LLM_COST_GUIDE.md # Module 1: Token economics & cost analysis
│ ├── MULTI_AGENT_GUIDE.md # Module 2: CrewAI vs LangChain patterns
│ ├── MCP_GUIDE.md # Module 3: Model Context Protocol
│ ├── SECURITY_DEMO_GUIDE.md # Module 4: Prompt injection & guardrails
│ ├── CREWAI_SETUP.md # Quick setup reference
│ └── DOCKER_GUIDE.md # Docker setup guide
├── Dockerfile
├── requirements.txt # Base Streamlit dependencies
├── requirements-crewai.txt # CrewAI + LangChain dependencies
└── README.md
The same AI transaction can cost between $1 and $230 — a 200x variance!
Use this tool to understand token economics and model pricing before scaling AI in your org.
Watch agents collaborate: Researcher → Writer → Editor
See multi-agent orchestration (CrewAI) and single-agent reasoning (LangChain) side by side.
| Aspect | CrewAI (Multi-Agent) | LangChain (Tool Agent) |
|---|---|---|
| Metaphor | Team of employees | Single agent with tools |
| Pattern | Sequential handoff | ReAct (Reason + Act) |
| Example | Research → Write → Edit | Question → Search → Answer |
| Best For | Complex workflows | Real-time data retrieval |
Agent(
role="Research Analyst", # Job title
goal="Gather info about {topic}", # What to achieve
backstory="You are an experienced # Shapes behavior
researcher with expertise..."
llm=llm
)CrewAI combines these attributes with task instructions to construct prompts sent to the LLM. See crews/research_crew.py for the full implementation.
MCP is USB-C for AI — one standard protocol connecting agents to any tool.
The MCP Explorer demo covers Module 3: how agents connect to tools via a standardized protocol. Compares MCP vs. Zapier vs. custom APIs across real scenarios (calendar scheduling, CRM lookup, DevOps triage).
No single guardrail catches every attack — AI security requires defense in depth.
The Agent Security Demo covers Module 4: how agents can be attacked via prompt injection and how to defend them with layered guardrails. Covers six attack types, five defense layers, and the business case for investing in AI security.
| Aspect | Zapier / n8n | Custom APIs | MCP |
|---|---|---|---|
| Complexity | Low (no-code) | High (custom dev) | Medium (standard) |
| AI Awareness | None — trigger/action | Manual integration | Native AI support |
| Context / Memory | No | Build it yourself | Built-in |
| Best For | Simple automations | Unique business logic | AI agent ecosystems |
| Layer | What It Does | Cost | Catches |
|---|---|---|---|
| 🔍 Input Validation | Keyword/pattern scan of user input | ~5ms, free | Known attack patterns |
| 🎯 Scope Enforcement | Whitelist of allowed agent actions | ~5ms, free | Privilege escalation |
| 🧠 Constitutional Review | Second LLM reviews draft response | ~1–2s, 2× API cost | Subtle, creative attacks |
| 🔒 Output Filtering | Scan response for PII/secrets | ~10ms, free | Data leaks |
| 👤 Human-in-the-Loop | Human approves high-risk actions | Minutes | Financial/irreversible actions |
The Multi-Agent Demo also works from the command line:
# With Ollama (free)
python -m crews.research_crew --provider ollama --task "Research AI in healthcare"
# With OpenAI
python -m crews.research_crew --provider openai --task "Research AI in healthcare"
# Check your setup
python -m crews.research_crew --check| Technology | What It Does | Learn More |
|---|---|---|
| Streamlit | Web app framework | Creates the UI |
| CrewAI | Multi-agent orchestration | Coordinates agents |
| Ollama | Local LLM runtime | Runs AI on your machine |
| LangChain | LLM integrations | Connects to AI providers |
| Plotly | Interactive charts | Visualizes cost data |
| Docker | Containerization | Easy deployment |
| Problem | Solution |
|---|---|
| "Ollama not running" | Run ollama serve in a terminal |
| "Model not found" | Run ollama pull llama3.2 |
| "Out of memory" | Try smaller model: ollama pull phi3 |
| "Slow responses" | Normal for local AI; try OpenAI for speed |
| "Import errors" | Run pip install crewai langchain-community |
For detailed troubleshooting, see Beginner's Guide — Troubleshooting.
MIT License — see LICENSE
MIT Professional Education | Applied Generative AI for Digital Transformation
Demos work locally — API keys optional (Ollama mode)