Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Pre-commit hooks configuration
# See https://pre-commit.com for more information

repos:
# Strip output from Jupyter notebooks
- repo: local
hooks:
- id: jupyter-nbconvert-clear
name: Strip notebook outputs
description: Strip outputs and execution counts from Jupyter notebooks
entry: python -m jupyter nbconvert --clear-output --inplace
language: system
files: \.ipynb$
pass_filenames: true
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
.PHONY: setup env lint test temporal-up temporal-down clean
.PHONY: setup env lint test temporal-up temporal-down clean pre-commit-install pre-commit-run

setup:
@echo "Installing dependencies..."
pip install -e ".[dev]"
@echo "Setup complete!"

pre-commit-install: setup
@echo "Installing pre-commit hooks..."
pre-commit install
@echo "Pre-commit hooks installed!"

pre-commit-run:
@echo "Running pre-commit hooks on all files..."
pre-commit run --all-files

env:
@python scripts/check_env.py

Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ make env # Check environment variables (OPENAI_API_KEY)
make lint # Run code linters (ruff, mypy)
make test # Run test suite (mocked - no API key needed!)

# 🪝 Pre-commit hooks (keeps notebooks clean!)
# ⚠️ IMPORTANT: Run 'make setup' first to install dependencies!
make pre-commit-install # Install pre-commit hooks (requires setup first)
make pre-commit-run # Run hooks on all files manually

# ⚡ Temporal server
# Use temporal_installation.ipynb notebook to install and start Temporal:
# 1. Open temporal_installation.ipynb in VS Code
Expand Down Expand Up @@ -244,6 +249,23 @@ The Temporal dev server must be running for exercises 2, 3, and 4! ⚡

---

**Problem:** Notebook outputs showing up in git commits ❌

**Fix:** We use pre-commit hooks to automatically clear notebook outputs before committing! 🪝

```bash
# Install pre-commit hooks (run once after setup)
make pre-commit-install

# Hooks will automatically clear outputs on each commit
# To manually run on all files:
make pre-commit-run
```

This keeps notebooks clean and prevents merge conflicts! ✨

---

### Exercise Issues 📓

**Problem:** Import errors when running exercises ❌
Expand Down
76 changes: 6 additions & 70 deletions example-notebook/02-Adding-Durability-Solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,7 @@
"id": "m8UH2Il_Sp50",
"outputId": "be1fb713-1562-40fd-e5c8-3274d77f9b67"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m92.7/92.7 kB\u001b[0m \u001b[31m3.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m41.8/41.8 kB\u001b[0m \u001b[31m2.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m13.2/13.2 MB\u001b[0m \u001b[31m58.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m9.0/9.0 MB\u001b[0m \u001b[31m70.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.0/2.0 MB\u001b[0m \u001b[31m49.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m278.4/278.4 kB\u001b[0m \u001b[31m17.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m76.5/76.5 kB\u001b[0m \u001b[31m5.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h"
]
}
],
"outputs": [],
"source": [
"# We'll first install the necessary packages for this workshop.\n",
"\n",
Expand Down Expand Up @@ -149,15 +134,7 @@
"id": "fy4s0KTRdWxL",
"outputId": "a68d8068-e0ed-4278-8cfd-1a5f05ca9b0b"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"API Key: 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\n"
]
}
],
"outputs": [],
"source": [
"# Load environment variables and configure LLM settings\n",
"import os\n",
Expand Down Expand Up @@ -215,18 +192,7 @@
"id": "scrsqIOy0a_8",
"outputId": "795ce7c7-8142-47f9-b6b6-5428c83b23e3"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1mtemporal:\u001b[0m Downloading Temporal CLI latest\n",
"\u001b[1mtemporal:\u001b[0m Temporal CLI installed at /root/.temporalio/bin/temporal\n",
"\u001b[1mtemporal:\u001b[0m For convenience, we recommend adding it to your PATH\n",
"\u001b[1mtemporal:\u001b[0m If using bash, run echo export PATH=\"\\$PATH:/root/.temporalio/bin\" >> ~/.bashrc\n"
]
}
],
"outputs": [],
"source": [
"# Download the Temporal CLI.\n",
"\n",
Expand Down Expand Up @@ -519,17 +485,7 @@
"id": "cJMyyRU97oTj",
"outputId": "9d21e45f-4ecf-4a42-f27e-2d6cb53bf253"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Welcome to the Research Report Generator!\n",
"Enter your research topic or question: Give me facts about elephants\n",
"Started workflow. Workflow ID: generate-research-report-workflow, RunID 019940b9-6c36-758f-98c0-d14f26a0eb35\n"
]
}
],
"outputs": [],
"source": [
"from temporalio.client import Client\n",
"import uuid\n",
Expand Down Expand Up @@ -714,17 +670,7 @@
"id": "kgtTTapM6CNy",
"outputId": "86a1a9b5-3269-4f31-a96e-f2367a6f5768"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Welcome to the Research Report Generator!\n",
"Enter your research topic or question: give me facts about elephants\n",
"Started workflow. Workflow ID: generate-research-report-workflow, RunID 019940ba-acf2-79f2-95a6-fefe18594bbc\n"
]
}
],
"outputs": [],
"source": [
"# Execute your Workflow\n",
"import uuid\n",
Expand Down Expand Up @@ -982,17 +928,7 @@
"id": "ySug_ag_HR-H",
"outputId": "251b2695-b300-4a33-815e-d1235457ace3"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Welcome to the Research Report Generator!\n",
"Enter your research topic or question: give me facts about elephants\n",
"Started workflow. Workflow ID: generate-research-report-workflow, RunID 019940bd-52bf-7e93-a601-d5b788afa829\n"
]
}
],
"outputs": [],
"source": [
"# Run the Workflow\n",
"import uuid\n",
Expand Down
16 changes: 15 additions & 1 deletion exercises/01_agent_hello_world/exercise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,21 @@
{
"cell_type": "markdown",
"metadata": {},
"source": "## Next Steps\n\nOnce you've completed this exercise, you'll understand:\n\n- ✅ How to create agents with the OpenAI Agents SDK\n- ✅ How to define custom tools that call real APIs\n- ✅ How the agent decides when to use tools\n- ✅ How to run agents with async/await\n\n**Ready for more?** Proceed to:\n\n- **[Exercise 2: Temporal Hello World](../02_temporal_hello_world/exercise.ipynb)** - Learn Temporal workflows and activities\n- **[Exercise 3: Durable Agent](../03_durable_agent/exercise.ipynb)** - Combine agents + Temporal for production durability!"
"source": [
"## Next Steps\n",
"\n",
"Once you've completed this exercise, you'll understand:\n",
"\n",
"- ✅ How to create agents with the OpenAI Agents SDK\n",
"- ✅ How to define custom tools that call real APIs\n",
"- ✅ How the agent decides when to use tools\n",
"- ✅ How to run agents with async/await\n",
"\n",
"**Ready for more?** Proceed to:\n",
"\n",
"- **[Exercise 2: Temporal Hello World](../02_temporal_hello_world/exercise.ipynb)** - Learn Temporal workflows and activities\n",
"- **[Exercise 3: Durable Agent](../03_durable_agent/exercise.ipynb)** - Combine agents + Temporal for production durability!"
]
}
],
"metadata": {
Expand Down
Loading