Mission Objective
Understand what Tools are and why agents need them. Connect your agent to Email, Search, and Code Interpreter tools. Create an Email Agent that can send messages. Understand when to use Knowledge Bases vs. Tools.
So far, our agents only think. They receive text, process it, and return text. But what if you want your agent to: Send an email? Search the web for live information? Do math accurately? Read a specific file from SharePoint? This requires Tools. Tools give your agent hands to act on the world, not just think about it.
The Hiking Metaphor: Imagine you're on a hike and you need to: Check your exact location → You need a GPS (Web Search Tool). Calculate how long until sunset → You need a Calculator (Code Interpreter). Send a message to base camp → You need a Radio (Email/Teams Tool). Without tools, you're just standing there thinking. With tools, you can act.
Today we'll create an Email Agent that can actually send messages, learn when to use Knowledge Bases vs. Tools, and understand the Python Code Interpreter for accurate calculations.
Key Takeaways:
- Understand what Tools are and why agents need them
- Connect your agent to Email, Search, and Code Interpreter tools
- Create an Email Agent that can send messages
- Understand when to use Knowledge Bases vs. Tools
The Gear List (Components)
Foundry offers a wide variety of tools. Here are the main categories:
Search Tools (Bing, Google)
Query the web for live information. Use when your agent needs current news, prices, or information not in your knowledge base.
Communication Tools (Outlook, Teams)
Send messages, read emails. Create an Email Agent: Go to Build → Agents → Create new agent. Name: "Email Agent", Model: GPT-4.1 nano (fast, simple task). Instructions: "You are an email assistant. When given a message containing a recipient, subject, and body, you send the email using the email tool." Tools → Add Tool: Search for "Outlook" and select "Send Email".
Compute Tools (Python Code Interpreter)
Run code for math, data analysis, creating charts. Large Language Models are BAD at math—ask GPT-4 to calculate 15% of $1,234.56, and it might guess wrong. The Code Interpreter lets the agent write Python, run it in a secure sandbox, and return the exact result. Use for: financial calculations, data analysis, statistics, chart generation.
Data Tools (SharePoint, SQL, Fabric)
Query databases and file systems. Connect to your company's internal data sources.
Custom Tools (OpenAPI Connectors)
Connect to any API using OpenAPI specifications. Integrate with Logic Apps or any external system.
Knowledge Base vs. Tool
Knowledge Base = Reference information (agent reads it to answer questions). Example: "Our return policy is 30 days." Tool = Actions (agent calls it to do something). Example: "Send this email now." The Hiking Metaphor: Knowledge Base = Your trail map (you read it). Tool = Your radio (you use it to call for help).
Creating the Email Agent and Knowledge Bases
Creating the Email Agent: 1) Go to Build → Agents → Create new agent. 2) Name: "Email Agent". 3) Model: GPT-4.1 nano (fast, simple task). 4) Instructions: "You are an email assistant. When given a message containing a recipient, subject, and body, you send the email using the email tool. Always confirm when the email is sent." 5) Tools → Add Tool: Search for "Outlook" or "Email" in the tool library. Select "Send Email" tool and configure authentication. 6) Save.
Using the Email Agent in a Workflow: After the approval is given ("yes") in your YouTube workflow: 1) Add a "Set Variable" node: Variable = Local.email_prompt, Value = "Send email to: user@example.com, Subject: New YouTube Title and Description, Body: {Local.editor_output}". 2) Add an "Invoke Agent" node: Agent = Email Agent, Input = Local.email_prompt. 3) Test: Run the workflow, approve, and check if the email is sent.
The Code Interpreter Tool: One of the most powerful tools. LLMs are bad at math, but the Code Interpreter lets the agent: Write a small Python script, Run it in a secure sandbox, Return the exact result. Use cases: Financial calculations, Data analysis (processing a CSV), Creating charts, Statistical operations. To add: In your agent, go to Tools → Add Tool → Search for "Code Interpreter" or "Python" → Enable it. Add to instructions: "When you need to perform any mathematical calculation, always use the Python code interpreter. Do not estimate."
Connecting Knowledge Bases: Use when your agent needs to answer questions using YOUR private data. Steps: 1) Go to Build → Knowledge. 2) Click "Create Knowledge Base". 3) Name: "Company Policies". 4) Add Data Source: Choose "File Upload" and upload PDF/Word documents, OR choose "SharePoint" to connect live. 5) Wait for indexing (converts documents into searchable vectors). 6) Edit your agent and in the Knowledge section, select your Knowledge Base. Now the agent can reference those documents when answering.
Key Points to Remember:
- Tools = Actions—without tools, agents can only think
- Email/Teams tools enable communication
- Code Interpreter ensures accurate calculations
- Knowledge Bases ground agents in your private data
- Configure tools in the agent, then invoke that agent in the workflow
The Trail Map (Adding Email to the YouTube Workflow)
Field Notes: Build the Full Email Flow
Create an Email Agent with the Outlook Send Email tool and connect it to your YouTube workflow.
- Create an "Email Agent" with the Outlook Send Email tool
- In your YouTube workflow, after approval, set up the email_prompt variable with recipient, subject, and body
- Invoke the Email Agent with the email_prompt
- Test the complete flow end-to-end
- STRETCH GOAL: Add a "Code Interpreter" tool to one of your agents. Have it calculate something (e.g., word count of the generated description).
Ranger's Warnings (Common Pitfalls)
LLMs Are Bad at Math
Ask GPT-4 to calculate 15% of $1,234.56 and it might guess wrong. ALWAYS use the Python Code Interpreter for any calculations.
Knowledge vs. Tool Confusion
Knowledge Base = Reference information (Q&A about your company data). Tool = Actions (search, email, calculate). Know which one you need!
Authentication Required
Email and SharePoint tools require you to connect your account. Configure authentication when adding the tool to your agent.
Pro Tips
When you add a tool, the agent gains a new capability. If the model decides it needs to send an email, it will call the tool with the appropriate parameters.
The Code Interpreter is for math, data, and graphs—not for AI reasoning. Use it to guarantee accuracy in calculations.