From ec5194a23888e4398c8edee3d21d34d0f06dbd25 Mon Sep 17 00:00:00 2001 From: Salma Lalji Date: Fri, 1 May 2026 15:51:06 -0700 Subject: [PATCH 1/7] notification to slack --- .github/workflows/testsPython.yml | 56 ++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 452f71d..b78f142 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -72,8 +72,54 @@ jobs: steps: - name: Notify on test results run: | - if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then - echo "success notifications go here" - else - echo "failure notifications go here" - fi + steps: + - name: Notify Slack on success + if: needs.python-unit-tests.result == 'success' + uses: slackapi/slack-github-action@v1.27.0 + with: + payload: | + { + "text": "Tests Passed!*", + "attachments": [ + { + "color": "#36A64F", + "fields": [ + { "title": "Repository", "value": "${{ github.repository }}", "short": true }, + { "title": "Branch", "value": "${{ github.ref_name }}", "short": true }, + { "title": "Python Version", "value": "${{ env.python-version }}", "short": true }, + { "title": "Triggered by", "value": "${{ github.actor }}", "short": true }, + { "title": "Commit", "value": "${{ github.sha }}", "short": false }, + { "title": "View Run", "value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", "short": false } + ] + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + + - name: Notify Slack on failure + if: needs.python-unit-tests.result != 'success' + uses: slackapi/slack-github-action@v1.27.0 + with: + payload: | + { + "text": "Tests Failed!", + "attachments": [ + { + "color": "#FF0000", + "fields": [ + { "title": "Repository", "value": "${{ github.repository }}", "short": true }, + { "title": "Branch", "value": "${{ github.ref_name }}", "short": true }, + { "title": "Python Version", "value": "${{ env.python-version }}", "short": true }, + { "title": "Triggered by", "value": "${{ github.actor }}", "short": true }, + { "title": "Commit", "value": "${{ github.sha }}", "short": false }, + { "title": "View Run", "value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", "short": false } + ] + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + From b0f579354cac9b2f15acb7ad36f405c7e71d1c7c Mon Sep 17 00:00:00 2001 From: Salma Lalji Date: Fri, 1 May 2026 16:03:20 -0700 Subject: [PATCH 2/7] notify to slack channel --- .github/workflows/testsPython.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index b78f142..2f84430 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -79,7 +79,7 @@ jobs: with: payload: | { - "text": "Tests Passed!*", + "text": "Tests Passed", "attachments": [ { "color": "#36A64F", From d7d168b3c3cc1754f344cf084cc02367581f4efb Mon Sep 17 00:00:00 2001 From: Salma Lalji Date: Fri, 1 May 2026 22:04:58 -0700 Subject: [PATCH 3/7] fix config to slack --- .github/workflows/testsPython.yml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 2f84430..17cf21d 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -13,10 +13,12 @@ # 1. Checkout repository code # 2. Set up Python environment using a custom action # 3. Run unit tests and report results +# 4. Send Slack notification on success or failure # # Notes: # - secrets are set in https://github.com/smarter-sh/smarter/settings/secrets/actions # - Integrates with Codecov for coverage reporting +# - SLACK_WEBHOOK_URL must be added to repo secrets ############################################################################### name: Python Unit Tests @@ -37,11 +39,8 @@ env: jobs: # Job #1: Run Python unit tests - # - # This job will run on an Ubuntu runner and execute the Python - # tests by using a custom action located in ./.github/actions/tests/python. python-unit-tests: - runs-on: ubuntu-latest # the runner (remote machine) will use Ubuntu OS + runs-on: ubuntu-latest steps: - name: Checkout code id: checkout @@ -63,23 +62,19 @@ jobs: codecov-token: "${{ secrets.CODECOV_TOKEN }}" # Job #2: Notifications (Mini-capstone assignment) - # This job will run after the Python unit tests and - # is scaffolded to facilitate sending notifications based - # on the test results. + # Sends a Slack notification on success or failure. notifications: needs: python-unit-tests runs-on: ubuntu-latest + if: always() # ← ensures this job runs even when tests fail steps: - - name: Notify on test results - run: | - steps: - name: Notify Slack on success if: needs.python-unit-tests.result == 'success' uses: slackapi/slack-github-action@v1.27.0 with: payload: | { - "text": "Tests Passed", + "text": "*Tests Passed!*", "attachments": [ { "color": "#36A64F", @@ -104,7 +99,7 @@ jobs: with: payload: | { - "text": "Tests Failed!", + "text": "*Tests Failed!*", "attachments": [ { "color": "#FF0000", @@ -122,4 +117,3 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - From 89f48c300ca378f80b31bbd74f23f80bf4a9987b Mon Sep 17 00:00:00 2001 From: Salma Lalji Date: Fri, 1 May 2026 22:17:18 -0700 Subject: [PATCH 4/7] add notification to slack if success or failed --- .github/workflows/testsPython.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 17cf21d..21d0285 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -13,12 +13,10 @@ # 1. Checkout repository code # 2. Set up Python environment using a custom action # 3. Run unit tests and report results -# 4. Send Slack notification on success or failure # # Notes: # - secrets are set in https://github.com/smarter-sh/smarter/settings/secrets/actions # - Integrates with Codecov for coverage reporting -# - SLACK_WEBHOOK_URL must be added to repo secrets ############################################################################### name: Python Unit Tests @@ -39,8 +37,11 @@ env: jobs: # Job #1: Run Python unit tests + # + # This job will run on an Ubuntu runner and execute the Python + # tests by using a custom action located in ./.github/actions/tests/python. python-unit-tests: - runs-on: ubuntu-latest + runs-on: ubuntu-latest # the runner (remote machine) will use Ubuntu OS steps: - name: Checkout code id: checkout @@ -62,7 +63,9 @@ jobs: codecov-token: "${{ secrets.CODECOV_TOKEN }}" # Job #2: Notifications (Mini-capstone assignment) - # Sends a Slack notification on success or failure. + # This job will run after the Python unit tests and + # is scaffolded to facilitate sending notifications based + # on the test results. notifications: needs: python-unit-tests runs-on: ubuntu-latest From dd1e6d5b28e741a118c3174d22ff6896826f34fe Mon Sep 17 00:00:00 2001 From: Salma Lalji Date: Mon, 25 May 2026 23:06:51 -0700 Subject: [PATCH 5/7] real DB credentials --- .vscode/settings.json | 3 ++- app/openai_test.py | 52 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 app/openai_test.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 3a4d3c9..9bba064 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,6 @@ "cornflakes.linter.executablePath": "venv/bin/flake8", "[python]": { "editor.defaultFormatter": "ms-python.black-formatter" - } + }, + "python-envs.defaultEnvManager": "ms-python.python:venv" } diff --git a/app/openai_test.py b/app/openai_test.py new file mode 100644 index 0000000..3d740f9 --- /dev/null +++ b/app/openai_test.py @@ -0,0 +1,52 @@ +import os +from openai import OpenAI +from dotenv import load_dotenv + +load_dotenv() + + +client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) + +messages = [ + { + "role": "system", + "content": "You are a helpful assistant that can call tools." + }, + { + "role": "user", + "content": "Give me a list of available AI courses." + } +] + +response = client.chat.completions.create( + model="gpt-4.1-mini", + messages=messages, + temperature=0.7 +) +print(response.choices[0].message.content) + +from pydantic import BaseModel, Field +from typing import List, Optional, Literal + +class GetCoursesRequest(BaseModel): + topics: List[str] = Field(..., description="List of course topics to retrieve") + max_cost: float = Field(0.0, ge=0, description="Maximum budget for the courses") + difficulty: Optional[Literal["beginner", "intermediate", "advanced"]] = Field( + None, + description="Optional difficulty level of the courses" + ) + + + +print(GetCoursesRequest.model_json_schema()) +def make_get_courses_tool(): + return { + "type": "function", + "function": { + "name": "get_courses", + "description": "Retrieve a list of courses that match given topics.", + "parameters": GetCoursesRequest.model_json_schema(), + }, + } + +print(make_get_courses_tool()) From d5e357ad6450e37e7d04c03240fad92660c69e0d Mon Sep 17 00:00:00 2001 From: Salma Lalji Date: Mon, 25 May 2026 23:17:28 -0700 Subject: [PATCH 6/7] add MySQL credencials --- .env | 17 +++++++++++++++++ .gitignore | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..2f2c0b4 --- /dev/null +++ b/.env @@ -0,0 +1,17 @@ +OPENAI_API_KEY=ADD-YOUR-OPENAI_API_KEY-HERE +REPO_NAME=agentic-ai-workflow +DOCKERHUB_USERNAME=lpm0073 + +# These settings are probably fine to leave as-is. +ENVIRONMENT=local +DOCKERHUB_ACCESS_TOKEN=ADD-YOUR-DOCKERHUB_ACCESS_TOKEN-HERE +LLM_TOOL_CHOICE=required +LOGGING_LEVEL=20 +MYSQL_HOST=sql.lawrencemcdaniel.com +MYSQL_PORT=3306 +MYSQL_USER=smarter_test_user +MYSQL_PASSWORD=smarter_test_user +MYSQL_DATABASE=smarter_test_db +MYSQL_CHARSET=utf8mb4 +PYTHONPATH=./venv:./ +CODECOV_TOKEN=ADD-YOUR-CODECOV_TOKEN-HERE diff --git a/.gitignore b/.gitignore index 1434880..4df6e1a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ dist *.tfstate *.tfstate.* .terraform/ -.env +#.env lambda_dist_pkg *.zip __pycache__ From 8d6ed185bf514b448899afd4f9b310c8645789b3 Mon Sep 17 00:00:00 2001 From: Salma Lalji Date: Mon, 25 May 2026 23:24:40 -0700 Subject: [PATCH 7/7] Docker debugging --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 28065c8..e02fe1e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Agentic AI Workflow Example +# Agentic AI Workflow Example by Salma Lalji e [![FullStackWithLawrence](https://a11ybadges.com/badge?text=FullStackWithLawrence&badgeColor=orange&logo=youtube&logoColor=282828)](https://www.youtube.com/@FullStackWithLawrence)
[![OpenAI](https://a11ybadges.com/badge?logo=openai)](https://platform.openai.com/) @@ -15,6 +15,7 @@ A Python command-line application that demonstrates how to use OpenAI Api functi - how to use Docker Compose to containerize your project - how to leverage Pydantic for constructing complex JSON objects +- Docker debugging Python code is [located here](./app/)