AI Lab 07: AI Agents, RAG, & Workflow Automation
- Estimated Time: 5 hours
- Tools Required: Coze or Dify. (Coze is highly recommended for beginners as it provides free access to premium models and built-in plugins without needing API keys).
- Hardware Required: A computer with an internet connection.
Lab Objectives
- Understand the difference between a standard LLM (a passive text generator) and an AI Agent (an autonomous system equipped with memory and tools).
- Learn how to implement RAG (Retrieval-Augmented Generation) to give an AI a "private brain" using your own documents, eliminating hallucinations.
- Core Task: Build a customized AI Assistant that can answer questions based only on a private document you upload, and use "Plugins" to fetch real-time data from the internet.
- Final Project Prototype: Use this No-Code platform to build the actual working prototype for your group's Final Project.
5-Hour Schedule & Step-by-Step Breakdown
Phase 1: Platform Setup & The Agent Architecture (0.5 Hour)
Phase 1: Platform Setup & The Agent Architecture (0.5 Hour)
- Go to Coze.com, log in, and click Create Bot.
- Give your bot a name (e.g., "Galactic Coffee Assistant") and choose an AI model to power its brain (e.g., GPT-4o-mini or Claude 3 Haiku).
- Familiarize yourself with the workspace. An AI Agent has three main components you will configure:
- Persona & Prompt (The Brain): The core instructions on how the AI should behave.
- Knowledge (The Memory / RAG): Private files the AI can read before answering.
- Plugins / Tools (The Hands): APIs that allow the AI to interact with the real world (e.g., searching Google, checking the weather).
Phase 2: Building the Autonomous Agent (2.5 Hours)
Phase 2: Building the Autonomous Agent (2.5 Hours)
In this phase, you will transform a generic AI into a highly specialized, internet-connected employee.
Experiment 1: The RAG "Brain Transplant" (1 Hour)
Standard LLMs don't know your private data. We will fix this using RAG.
- Create the Private Data: Open Word or Notepad and create a fake 1-page "Employee Handbook" for a fictional company. Include specific, bizarre rules.
- Example: "At Galactic Coffee, the Wi-Fi password is 'Mars2026'. Employees must wear purple hats on Tuesdays. The secret ingredient in the dark roast is cinnamon." Save it as a PDF or TXT file.
- The Failure Test: Ask your newly created Bot in the preview panel: "What is the Wi-Fi password at Galactic Coffee?" It will hallucinate or say it doesn't know.
- Implementing RAG:
- Go to the Knowledge section in Coze and add a new Knowledge Base.
- Upload your fake Employee Handbook PDF.
- Make sure the bot is connected to this Knowledge Base.
- The Success Test: Ask the exact same question again. Watch how the AI searches the document, extracts the exact Wi-Fi password, and provides a citation! (Take a screenshot of this successful RAG response).
Experiment 2: Giving the AI "Hands" (Plugins) (1.5 Hours)
Standard LLMs have a "knowledge cutoff" date and cannot see the live internet. Let's give your Agent internet access.
- The Failure Test: Ask the Bot: "What is the current temperature in Tokyo right now?" It will likely apologize and say it cannot fetch real-time data.
- Adding Plugins:
- Go to the Plugins section and click the + icon.
- Search for and add a Weather plugin (e.g., OpenWeather) and a Web Search plugin (e.g., Google Search or Bing).
- The Ultimate Integration Test: Now, ask a complex prompt that requires the AI to use both its Plugins and its RAG Knowledge.
- Prompt: "What is the weather in Tokyo right now? Based on that weather, should I wear the purple hat required by the Galactic Coffee Employee Handbook?"
- Observe: The Agent will autonomously decide to use the Weather plugin first, read the result, then check your uploaded Handbook, and finally synthesize an answer combining both sources. (Take a screenshot of the AI's "working process" showing tool usage).
Phase 3: Final Project Prototype Building (0.5 Hour)
Phase 3: Final Project Prototype Building (0.5 Hour)
- Apply what you just learned to your Final Project.
- If your group is designing a "Travel Planning AI," add flight-search plugins. If you are designing an "Academic Tutor AI," upload course materials to the Knowledge base.
- Start tweaking the Persona Prompt to make the bot act exactly like your group envisioned.
Phase 4: Writing the AI Lab Journal (1.5 Hours)
Complete your "AI Lab Journal" in a Word or Markdown file.
AI Lab Journal Report
AI Lab Journal: Agents, RAG, & Plugins
1. Lab Setup & Key Definitions
- What is an "AI Agent"? Explain in 1–2 sentences how it differs from a standard chatbot like the basic free ChatGPT.
- What does RAG stand for, and what problem does it solve? Explain why companies use RAG instead of just training a whole new model.
2. Agent Configuration Table
| Component | What I Used | What it does for the Agent |
|---|---|---|
| Model (Brain) | [e.g., GPT-4o] | Processes logic and generates the text. |
| Knowledge (RAG) | [Name of your fake PDF] | [Describe what private info it contains] |
| Plugins (Tools) | [e.g., Google Search, Weather] | [Describe what real-world actions it can perform] |
3. Test Results & Screenshot Evidence
- RAG Implementation: Describe how the AI answered before and after you uploaded the PDF.
[Insert a screenshot showing the AI citing your uploaded PDF here]
- Plugin / Tool Usage: Describe the complex question you asked that required the AI to fetch live internet data.
[Insert a screenshot showing the AI successfully triggering the plugin/tool and answering here]
4. Group Project Progress
- Our Agent Prototype: [Explain in 2–3 sentences what kind of bot your group built today in Coze for your final project].
[Insert a screenshot of your Final Project Bot in action]
5. Core Reflections
- Question 1: Why is giving an AI "Plugins" — such as the ability to send emails, buy stocks, or edit databases — potentially dangerous? What kind of "Guardrails" would you need to put in place?
- Question 2: Compare Week 4, where the AI hallucinated fake facts, to Week 7, where the AI used RAG. How does RAG build trust for corporate businesses wanting to use AI?
🎯 Pro-Tips for Students (How to Avoid Common Pitfalls)
- Instructing the Plugin: Sometimes the AI gets "lazy" and forgets it has tools. If your AI refuses to check the weather even though you installed the plugin, go to your Persona/Prompt and add a strict rule: "You MUST use the Weather Plugin whenever a user asks about temperature or climate."
- Garbage In, Garbage Out (Again!): If your uploaded PDF is a messy scan with unreadable text, the RAG system will fail. Always ensure the documents you provide to your AI's Knowledge Base are cleanly formatted text or clear PDFs!