Get startedGet started for free

How Agents Work - Planning & Tool Calling

1. How Agents Work - Planning & Tool Calling

Here's a question I get all the time. James, autonomous agents sounds amazing, but how do they actually work? What's happening under the hood that makes them so much more capable than traditional AI? I'm going to pull back the curtain and show you three core concepts that make agents possible. In this video, we'll explore the first two concepts, planning and tool calling. These are foundations that enable agents to break down complex problems and execute solutions autonomously. In our previous video, we established the paradigm shift from directed assistance to autonomous agents. Now we need to understand the mechanics. How do agents actually plan and execute? We'll start with two fundamental concepts, and I'll show you in Snowflake specific implementation for each. Let's start with planning. Arguably the most critical capability that separates agents from assistance. When you give an agent a high-level objective like analyze customer churn, it doesn't just start randomly querying data. It first creates a plan by breaking that objective into executable steps. In practice, planning works like this. First, the agent decomposes the task. I need to identify customer churn, understand their characteristics, analyze communication patterns, and identify common factors. Then it determines sequences and dependencies. I can't analyze communication patterns until I've identified who's churned. Finally, it builds adaptability into the plan. If I don't find sufficient data in one area, I'll adjust my approach. Cortex agents have built-in planning capabilities that automatically handle this decomposition. When you give Cortex agents a complex request, they determine whether or not to query structured data through Cortex Analyst, search unstructured documents through Cortex Search, or coordinate between both, all without you having to specify sequence. If you have not heard about Cortex Analyst or Cortex Search, no worries. I'll share what you need to know in this course. If you want to dive deeper, check out our docs or our other AI courses. Let's say the user asks, why did we lose TechCorp as a customer? Here's how Cortex agents could plan. First, query structured sales and support data for TechCorp. Second, search through unstructured emails, meeting notes for context. Third, analyze contract documents for terms and conditions. And fourth, synthesize findings into a comprehensive explanation. That covers the first core concept. Now let's explore the second concept, tool calling. How agents interact with external systems and data sources. Think about what an agent needs to do to accomplish real work. It can't just reason about problems. It needs to actually do things. Query databases, call APIs, search the web, execute calculations, read documents. This is where tool calling comes in. The process works as follows. The agent analyzes the user's objective. It identifies what actions are needed. It selects the appropriate tool for each action. It executes those tools with the right parameters. And it combines the results intelligently. Let me give you some real world examples of different tool types. For database queries, an agent might call a SQL tool to fetch customer data or sales metrics. For external data, you might call a weather API to get the forecast data or stock market API for real-time prices. For web searches, you could search the internet for recent news or competitor information. For document analysis, it might search through PDFs, contracts, or knowledge bases. For calculations, it may call a custom function to compute complex business logic. The key insight is this. Agents don't have just one tool. They have access to multiple tools and can choose which ones to use based on the tasks. It's like having a Swiss army knife instead of just a single blade. Now, let me show you how Snowflake implements this for data analysis workloads. For structured data in your database, Cortex agents can use Cortex Analyst, which translates natural language into SQL and executes queries against your table. It understands business context through semantic views so that when you ask about customer retention rate by segment, it knows exactly which tables to join and how to calculate those metrics. The agent calls Cortex Analyst, which generates the appropriate SQL with joins and calculations, then returns formatted results. For unstructured data, like documents and emails, Cortex agents can use Cortex Search, which performs hybrid semantic and keyword searches across text content. It finds relevant information even when phrased differently than your search terms. When searching for customer complaints about pricing, Cortex Search finds documents mentioning these terms. They're semantically related, such as to expensive, cost concerns, or budget constraints, not just the keyword matches. But here's what makes agents powerful. They're not limited to just these two tools. In more advanced scenarios, agents can call external APIs for real-time data, execute custom Python or SQL functions for specialized calculations, search the web when they need current information, chain multiple tools together in sequence, all based on what's needed to accomplish the user's objective. So we've covered the first two critical concepts, planning, which enables agents to break down complex objectives into executable steps, and tool calling, which allows agents to interact with database, APIs, documents, and external systems to actually get work done. But there's one more concept that completes the picture. In our next video, we'll explore memory. You'll see how all three concepts work together to create autonomous intelligence.

2. Let's practice!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.