AI Agents Masterclass

repository·main·Indexed 25 days ago

https://github.com/coleam00/ai-agents-masterclass

A repository providing hands-on code examples and tutorials for building AI agents using Large Language Models. It includes a Self-hosted AI Starter Kit with n8n, Ollama, Open WebUI, Flowise, Qdrant, and PostgreSQL, as well as specific implementations like a Pydantic AI Web Search Agent and a v0-agent-frontend Next.js application. The content is structured as weekly lessons with corresponding video tutorials and environment configurations for integrations with OpenAI, Anthropic, Groq, and Asana.

Tokens
8.5K
Snippets
28
Records
52
Agent score
86%

What's inside ai-agents-masterclass

  1. Configure n8n and Open WebUI integration

    main

    After starting the containers, follow these steps to link n8n with Open WebUI:

    1. Set up n8n: Open http://localhost:5678/. Open the included workflow at http://localhost:5678/workflow/vTN9y2dLXqTiDfPT.
    2. Configure n8n Credentials:
      • Ollama URL: http://ollama:11434 (or http://host.docker.internal:11434/ if running Ollama on Mac host).
      • Postgres: Use DB, username, and password from your .env file. Host is postgres.
      • Qdrant URL: http://qdrant:6333.
      • Google Drive: Follow n8n's guide; use a custom domain for the redirect URI instead of localhost.
    3. Activate Workflow: Select Test workflow. Once running, toggle the workflow to active and copy the Production webhook URL.
    4. Set up Open WebUI: Open http://localhost:3000/.
    5. Add n8n Function:
      • Go to Workspace -> Functions -> Add Function.
      • Name and describe the function, then paste the code from n8n_pipe.py (or download it from Open WebUI site).
      • In the function settings (gear icon), set n8n_url to the Production webhook URL you copied from n8n.
      • Toggle the function on to make it available in the model dropdown.
  2. Install the Self-hosted AI Starter Kit

    main

    The Self-hosted AI Starter Kit provides a Docker Compose environment containing n8n, Ollama, Open WebUI, Flowise, Qdrant, and PostgreSQL. Choose the installation command based on your hardware:

    Nvidia GPU users

    Requires following Ollama Docker instructions first if you haven't used Nvidia GPUs with Docker before.

    Mac / Apple Silicon users

    Since Docker cannot expose the Mac GPU, you have two options:

    1. Full CPU mode: Use the 'everyone else' instructions below.
    2. Hybrid mode (Recommended): Run Ollama natively on your Mac for faster inference and connect the n8n instance to it using http://host.docker.internal:11434/.

    Everyone else (CPU mode)

    Use this for standard CPU-only setups.

    # For Nvidia GPU users
    git clone https://github.com/coleam00/ai-agents-masterclass.git
    cd ai-agents-masterclass/local-ai-packaged
    docker compose --profile gpu-nvidia up
    
    # For Mac / Apple Silicon users (Hybrid mode: Ollama on Mac, rest in Docker)
    git clone https://github.com/coleam00/ai-agents-masterclass.git
    cd ai-agents-masterclass/local-ai-packaged
    docker compose up
    
    # For everyone else (CPU mode)
    git clone https://github.com/coleam00/ai-agents-masterclass.git
    cd ai-agents-masterclass/local-ai-packaged
    docker compose --profile cpu up
  3. Upgrade the AI Starter Kit

    main

    To upgrade your existing installation, use the following commands based on your profile:

    Nvidia GPU users

    docker compose --profile gpu-nvidia pull
    docker compose create && docker compose --profile gpu-nvidia up

    Mac / Apple Silicon users

    docker compose pull
    docker compose create && docker compose up

    Everyone else (CPU)

    docker compose --profile cpu pull
    docker compose create && docker compose --profile cpu up
  4. Set up the AI Agents Masterclass environment

    main

    To follow along with the masterclass videos, you must clone the repository, navigate to the specific video folder (e.g., 1-first-agent), and configure your environment variables.

    1. Configure Environment Variables: Locate the .env.example file in the specific video folder. Copy it to a new file named .env and fill in the required API keys and configuration values.
    2. Create a Virtual Environment: It is recommended to create a single virtual environment for the entire masterclass.
    3. Install Dependencies: You must run pip install -r requirements.txt inside each specific video folder to install the packages required for that lesson.
    # 1. Create the virtual environment (one-time setup)
    python -m venv ai-agents-masterclass
    
    # 2. Activate the environment
    # On Windows:
    .\ai-agents-masterclass\Scripts\activate
    
    # On MacOS/Linux:
    source ai-agents-masterclass/bin/activate
    
    # 3. Install dependencies for a specific video folder
    cd 1-first-agent
    pip install -r requirements.txt
  5. Install the Pydantic AI Web Search Agent

    main

    To set up the project, clone the repository, navigate to the pydantic-ai directory, and install the required dependencies using pip. It is recommended to use a Python virtual environment.

    After installation, create a .env file by renaming .env.example to .env and populate it with your API keys and model preferences.

    git clone https://github.com/coleam00/ai-agents-masterclass.git
    cd ai-agents-masterclass/pydantic-ai
    pip install -r requirements.txt
  6. Configure environment variables for Pydantic AI

    main

    The agent requires specific environment variables in a .env file to function.

    • BRAVE_API_KEY: Your Brave Search API key.
    • OPENAI_API_KEY: Required if using GPT models.
    • LLM_MODEL: The model identifier to use (e.g., gpt-4o for OpenAI or qwen2.5:32b for Ollama).
    OPENAI_API_KEY=your_openai_api_key
    BRAVE_API_KEY=your_brave_api_key
    LLM_MODEL=your_chosen_model
  7. Configure environment variables for LLM Agent Evaluation Framework

    main

    To use the LLM Agent Evaluation Framework, rename .env.example to .env and populate the required environment variables. This framework supports multiple LLM providers including OpenAI, Anthropic, Groq, and Ollama.

    Note on Google Drive: No environment variables are required for Google Drive access; follow the Google Drive API Python Quickstart for authentication instead.