The AI Gets Hands (Agents & Tools)
โจ PAN'S RULE: If it's not chaotic, it's not magic! โจ
An AI that can only talk is like a brain in a jar โ super smart, but pretty boring. Let's give that brain some hands, feet, and a jetpack so it can actually DO things in the world! ๐
What is an AI Agent?
Imagine a brilliant robot chef ๐ค. It knows every recipe in the world (that's its AI brain), but it can't cook without its tools!
Giving an AI "tools" is like handing our robot chef a spatula, a whisk, or an oven. When you ask it for a pancake, the AI thinks, "Aha! To make a pancake, I need the `whisk` tool and the `frying_pan` tool." Then, it uses them to actually make you a pancake! An AI Agent is a super-smart AI that doesn't just talkโit can pick the right digital tool to actually get a job done!
The Agent's Toolkit
๐จ TOP SECRET: Agent Sparky's Brainwaves ๐จ
๐ป System Diagnostic: Agent Thinking...
When you give an agent a complicated question, it doesn't just guess. It makes a plan, step-by-step. This is called "Chain of Thought." It's like we get to see the AI's internal monologue!
SYSTEM LOG: Agent Thinking...
[USER_QUERY]: "How much does a pizza cost in New York and what's the weather?"
[THOUGHT]: This is a multi-step problem. I can't answer both at once.
[PLAN]: First, find the price of pizza. Second, find the weather. Third, combine the answers.
[ACTION]: Use `web_search` tool with query "average pizza price NYC".
[TOOL_RESULT]: "$25"
[THOUGHT]: Okay, I have the price. Now for the weather.
[ACTION]: Use `weather_api` tool with location "New York, NY".
[TOOL_RESULT]: "75ยฐF and Sunny"
[FINAL_RESPONSE]: A pizza in New York costs about $25, and the weather is currently 75ยฐF and sunny! ๐โ๏ธ
Based on the log, what was the agent's FIRST action?
Which Tool Should Sparky Use?
Your mission is to help Agent Sparky pick the right tool for each job. Click the best option!
To answer "What is 523 times 78?", Sparky should use the...
To answer "What's the weather like tomorrow in London?", Sparky should use the...
To answer "What appointments do I have on Friday?", Sparky should use the...
๐ป Hacker Challenge: Upgrade the Pizza-Bot!
Your mission is to upgrade the Pizza-Bot's brain! Agents need strict instructions (called a 'schema') to use their tools. In the sandbox below, add a new parameter for the pizza's crust and set its value to stuffed. Then hit Run!
Train a Custom Vision Tool!
Let's go beyond pre-made tools. We're going to build a brand new tool for our agent: a vision tool that can tell if you need help with your homework! We'll use a real-world tool called Teachable Machine to do it. No code needed!
- Open Google's Teachable Machine in a new tab.
- Choose "Image Project" and then "Standard image model".
- For "Class 1", rename it to "Thumbs Up". Use your webcam to take at least 20 pictures of yourself giving a thumbs up. ๐
- For "Class 2", rename it to "Hand Raised". Take 20+ pictures with your hand raised, like you have a question. โ
- Click the "Train Model" button. It might take a minute, but you're training a real AI!
- Once it's trained, test it out in the "Preview" window. Does it recognize your thumbs up and raised hand? You just built a custom vision tool!
When you use a tool with a webcam like Teachable Machine, you are creating data. That's powerful! Remember Pan's rules: 1) Never use your camera without a parent's permission. 2) Never share images of your face, your room, or personal info. The model you trained lives only in your browser and is safe. Be smart, be safe!
Think Like a Builder: What would happen if you only trained the AI on your hand? Would it recognize your friend's hand? This is called bias, and it's why it's so important for AI builders to use lots of different data to make their tools fair for everyone.
Architect a Travel Agent
Your turn to be the architect! Design a JSON schema for a `TravelBot` agent. It needs two tools: one for flights and one for hotels. Follow the missions in the code comments below to complete the agent's brain.
๐ Sandbox: Architect a Travel Agent
๐ Learn More
- Deep Dive into LangChain Tools - See the official documentation real developers use. This is the "instruction manual" for building powerful agents. Bookmark it.
- Simple AI Agent on Replit - See a real, working code example you can run and remix! With a parent's permission to create a free account, you can "Fork" this project to create your own copy and start building a live agent in minutes.
๐จโ๐ฉโ๐ง Parent Corner
An "AI Agent" is like a chatbot that can take action. Instead of just answering questions, it can use "tools" to browse the web, do math, or even order a pizza for you! This lesson is a great introduction to the logic of programming and problem-solving.
Family Challenge: Try the "Train a Custom Vision Tool" activity together using Teachable Machine. Brainstorm other fun things to teach the AI to recognize: different types of toys, happy vs. sad faces, or even different family members! It's a fantastic, hands-on way to understand how machine learning works without writing any code.