In this lesson, you will use the collaborative agent to start to build the data analysis pieces of a larger Wikipedia analysis app. Along the way, you will learn the basics of how to guide and observe the AI agent as it does its work. Let's get started. Before diving into building the app, we'll cover one final concept. In the earlier slides, we talked a lot about all the different pieces and components that make a collaborative AI agent like Cascade intrinsically very powerful. Things like context awareness and tools, and human actions. But it's also important to think about the axes that improve the user experience independent of those underlying capabilities. So even with all of those things kept constant, there's still a lot of things and a lot of aspects about the tools that can make the UX really, really good. And it's important to note these because I'll print them quite a bit as we start building out the Wikipedia analysis app. The first is capabilities. We'll be using Cascade a lot, but it turns out that these agentic capabilities are not the only capabilities that AI native IDE like Windsurf provides. So when is it appropriate to use some of these other capabilities? There's a lot of places of guidance. While Cascade has the ability to independently go on, in, out, retrieve the right information. Turns out that the better you are at giving some amount of guidance to the AI so that you can focus the right places. Just like a peer programmer, they will do a lot better. So how can you do that effectively with Cascade? Observability. Of course, now the AI is capable of doing a lot more than just give a few lines of an autocomplete suggestion or respond to a single chat message. So if you're an expert in observing what the AI is doing at all times, then you will be able to keep up with what the AI is doing and maintain state and make sure that you're doing larger and larger tasks effectively. And finally, there's just a lot of polish. There's a lot of helpful plugins and shortcuts to make sure that you're natively interacting with the AI in the most optimal manner. So our decision to own the IDE surface was not an arbitrary decision. There was a lot of polish and a lot of UX that we thought could be special. So with that, let's dive right in. Great. So we're going to start with a completely blank project called Wikipedia Analysis. And we're going to build this from scratch. In this video we're going to do some data analysis. The motivation behind this app came from myself and a bunch of my friends at the office playing a game called catfishing. In this game, really short. You're given all the categories of a Wikipedia page, and you have to guess the Wikipedia page that it corresponds to those set of categories. That just got me thinking. If I was to try to learn about a new kind of category of information, what would I need to do? What kind of basic terminology would I first have to learn before I really understand that topic. And so what we're going to do is we're going to try to use the Wikipedia information, taking a category and understand what are the frequency of words that appear across all the pages that belong to that category. And that will give me a good place to start my work. So I'm going to start with a prompt like this. It's copying right here. I'll read it out loud. Write a script that takes in a Wikipedia category as a command line argument, and outputs a cumulative frequency of non-common words across all the pages in that category, and then run it on a specific category. One of my favorites, large language models. And I specified to use a Mediawiki API. Before running this, a few things to point out here. Notice that I was relatively specific in exactly how my inputs and outputs look like. I specified certain APIs that I wanted to use. It is important to still be clear to the AI, especially if there's no context that already is begin. If you start with a really vague statement. The AI might do something that is correct, but unexpected. Again, think about this like a peer programmer. If you wanted a peer programmer versus some work for you, what would you have to tell it to do? A few other things to point out about the Cascade panel before I start the work, As you can see, I'm currently using Claude 3.5 Sonnet for my reasoning model. You can actually choose a number of different models that are available to you, but let's just get it started. So I'm going to click enter and let Cascade start to go. Great. Before I click on the installation command for the requirements dot txt. Let's point out a couple of features in Windsurf to help you observe what AI is doing. The first is something we've used actually earlier, which is the open diff button because edits can happen across multiple files. Being able to click open diff and look through the changes that Cascades being made is great. It's important to still review the changes that the AI makes. The other thing you'll notice here, is what we call the Cascade bar. This is the way to essentially build a review flow directly into the editor. So, if there's multiple changes within a file, you could use the up and down errors. And you can use the right and left arrows to actually go from file to file where there are edits, I can accept these changes at the individual block level, the file level or across all files. But now that we've done some observability, let's continue to work here. So I first need to install the requirements dot txt. So I'll click accept. Note here that my environment actually uses Python 3 instead of Python, pip3 instead of pip. And so, Cascade is able to recognize that and of course correct accordingly. But while it continues, maybe this is something that I just want Cascade to always know as I'm doing my work, I don't want it to always figure out that I have pip3 instead of pip. So I'm going to show the first kind of method of guidance here, which is if you go to the Windsurf settings tab on the bottom right, you can see there's a lot of different settings, but I'm going to go into this one called Set Global AI rules. These are rules that Cascade will listen to as you're working, no matter where you're working. Of course, the repository rules are for particular repositories, but I can just say here use Python3 instead of Python, pip3 instead of pip, something like that. And now Cascade should be able to follow these instructions every time I ask it to do something. And we'll verify this in a few moments. But let's continue to see what Cascade's doing. So here it is saying okay, let's now run it on that large language model's category. And let it go. As you can see it's starting to go. And it's starting to process all of the different pages on Wikipedia that follow the large language model's category. You can notice that we truncate the outputs just for space reasons, but Cascade is actually using the IDE's native terminal. So by clicking this little button over here called Go to terminal, you can actually pull up the full execution within the terminal pane in the editor. So I can go in, and even though I only see the last few, I can see that some of the most common words, to no surprise, are things like model, models, language, OpenAI, ChatGPT. So, already we can kind of get an idea that yes, if I was to learn about large language models, these are some terms that I probably need to get to know. So that's great. It's successfully built out a data analysis that does exactly what I want to do. I'll go ahead and accept all changes. It's important to accept changes as you go along rather than just accumulate edits over and over. So I'm just and accept all the changes. Close the terminal. Let's actually go ahead and actually check the fact that global rules that I had set earlier. To do this, I'm going to use a different functionality. I could ask to check this within my current cascade conversation, but it's important to maintain some amount of separation between conversations that are different. So I'm going to start a new conversation with Cascade. Here, I can ask the same command as it needed to do before, install the requirements dot txt. If it hasn't learned anything, it would just use pip instead of pip3, but instead is using those global rules that we specified to directly use pip3. So this is an example of how just setting some rules will allow Cascade to always kind of follow general best practices about your environment or how you do things. Of course, in this case everything's already set up. To go back to my original conversation, I used to go to the past conversations and go back, and I'm back into my original conversation. In this lesson, you used Cascade to build the entire analysis part of your application, using a Wikipedia API to pull all the relevant data, parse it accordingly, and result in frequencies. And along the way you were able to use a number of the features within the Windsurf ID in order to guide, Cascade and to observe what it's doing. In the next section, we're going to add caching to the system, because I don't want to rerun this analysis every single time I'm iterating on my application. So see you there.