📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

I Built a Team of Research Subagents in Claude Code

Alex McFarland23:35

Transcription

In today's video, we're going to expand our Claude code writing system even more. This time, we're going to be introducing custom research agents inside of it. Custom Claude agents that can be built on top of your own context inside of your system, use your own skills, reference your own JSON context profiles, your your content, etc. So this is a a research agent that knows everything about your business, everything about your context and can tailor the research uh you know on top of that instead of just some like general deep research tools that you might use elsewhere online.

Okay, to get started we are going to be having our Claude code starter kit open here. If you haven't watched my master class, if you haven't been here before, uh you can get this exact starting kit to kick off your Claude code writing system if you want. Here on the left we have our dotcloud with agents and skills. We have a context uh JSON profiles for our business profile, our ICP or ideal client profile, our voice DNA. We have a knowledge folder and we have our claude.md file. And today to put this research agent inside of here, we're actually going to be using the perplexity MCP. So we're going to build an actual Claude agent and then give it access to the Perplexity MCP to run deep research reports. Okay.

And actually at the end of this video, you're just going to get the system prompt for my own custom research agent as well uh for Substack subscribers. So if you haven't uh make sure to check that out so you can get the quad code system, the research agents, all of that good stuff.

Okay, so the first thing we need to do here is get the Perplexity MCP server. I'm going to open this up on the right side here. This is the official Perplexity MCP server from Perplexity. I'm going to include this link below. Now, there are a couple ways that we can install this. When you scroll down here, you're going to see that you can just install this plugin here inside of Claude or you can manually configure this inside of your JSON file here or your cloud.json file uh MCP file inside of uh you know VS Code or cursor or whatever you know your terminal wherever you're running cloud code. I actually prefer option two uh just because I prefer to have an MCP file here on the left where I could see all the MCPS I have connected. But you could choose whichever one uh you want.

Now since I'm building on this cloud code starter kit that I've already given my uh followers here, we have never put an MCP server in here. So we don't have an MCP.json file. So if you're completely new to this, it's actually very easy. You don't have to do anything. If you just come here to Perplexity and you copy this manual configuration and you tell Claude, I'm going to dictate to it right now. Uh install this Perplexity MCP inside the project here. And then I'm just going to paste that, you know, exact stuff that I copied from Perplexity's MCP server. It will set it up for us. It will set up the MCP.json file that we don't have here. And then, you know, every other additional MCP server that you add on top later, you can just, you know, tell Claude to stick it in there or put it in manually yourself, you know, whichever works for you.

Okay. Now, one other thing to mention is that there are two ways to install MCP servers. If you're not familiar at all with this, you can install it locally across all of your different cloud projects, or you can just install it here inside of this specific project. I like to do it, you know, inside of each specific project because I like to have different MCP servers for different work, different clients, my own stuff. Uh, you know, but if you just, you know, only have one real, you know, thing that you do, if you only make content for yourself or you only write for yourself or one client, then, you know, you could just choose to install it across all of them or in the project. But I like to do it in the project.

So as you can see here now we have uh Claude telling us that it created an MCP.json with the perplexity MCP configuration and it even walks us through here. So like you know if you never if you're not familiar with any of this type of of stuff just tell Claude to walk you through it. It's going to walk you you know very simply through it. So here now we have this MCP.json file. Open it up. Here you can see that we have the actual Perplexity MCP server here. But in order for this to work, we need a Perplexity API key. As you can see, your key here. So, you're going to go to your Perplexity account. I'm going to expand this a little bit here so you can see. You're going to go into your settings and scroll down here to API keys, and you're going to generate an API key, and you're going to copy it. I have this one already made up, and I'm going to delete it after the video, but I'm going to copy this API key I generated here. And you're just going to paste it right in here. All right. We're going to exit and paste it. Now your API keys in there and we can save this.

Okay, so now our Perplexity MCP server is set up all right inside of here. But for it to start working, we need to restart. So we need to open up a new one here. And this time I'm actually going to open up a terminal because inside of Cloud Code, if you're using the extension, which you just saw here in VS Code, you can't really access your MCP servers and stuff like that. So it's best to use the terminal. That's another reason why if you're not comfortable with the terminal yet, start getting comfortable with it because it just unlocks a lot more things that you can do right inside of there. So now we're going to we're going to launch up Claude here and we're going to put /mcp. And now we can see right here our perplexity server is connected and running. We can enter to view the tools. View tools. And now we can see we have three tools for Plexity. We have search which is going to give us quick search for simple queries using perplexity sonar model. best for straightforward questions and basic information lookup. We can also do reasoning which handles complex multi-step tasks using perplexity sonar reasoning pro model best for explanations, comparisons and problem solving. And then what we really want to check out today is deep research which conducts in-depth analysis and generates detailed reports using perplexity sonor deep research model. This is your multi-page deep research papers that can come out of perplexing. For anybody who's used like NAN or other, you know, workflow automation or agent platforms like that, one of the problems you might have run into that I know I always ran into was that it would always time out when I was trying to do perplexity deep research reports with like for example a perplexity node inside of N8N. It would always run out because it takes a long time and there were limits on how long it would let it run. But now you don't have to worry about that at all because you're running this right here in cloud code on your computer, your laptop, whatever, and you're not going to run into those problems. So you can generate these really good detailed reports that take some time running in the background.

All right, so now we have that Perplexity MCP set up. You know, we could even test it out if we want to and just say, uh, you know, run a test query, uh, to test your Perplexity MCP server. You can run something like that just to make sure, but we already saw it was connected, but we'll see what that, you know, uh, brings back to us. And this is how it works here. It's going to say it's going to run a test query and then you're gonna have to give it permission. Uh, it's going to run what is the current weather in New York City today. We're going to give it permission to run it. And you're going to see this is now going to use Plexity for searching. So, you know, Cloud Code already has native web search capabilities and it's pretty good too inside of Cloud Code. But if you ever want to use Plexity for those more deep research reports or you just like Perplexity better for upto-date information, that's how simple it is to to to install Perplexity into your writing system inside of Cloud Code. Okay, so we have the Plexity MCP servers working correctly. Successfully returned weather information for New York City. All right, so we know it works. All right, so that's perfect there.

The next thing for us to do now though is it's great we have Perplexity, but we want an agent now. an agent where whenever we talk to Claude here, you know, whenever we fire up a new chat and we talk to Claude and it recognizes that we need a research task, it can take that and pass it off to the research agent to go handle that task. And that's what we want to happen. So here on the left side of my Claude Code starter kit, you could see that I already have one agent in here which we talked about in previous videos and in my substack which is a newsletter agent that handles newsletters and it uses some of these Claude skills down here like thought leadership newsletters and stuff like that to write newsletters. So for example, if I were to, you know, start with Claude, it can now orchestrate or it can uh pass off tasks to to either one of these agents that we're going to create. Now if it's a newsletter, it'll pass it to the newsletter agent. If it's research, it'll pass us the research. And that's how it goes. So forth and so on as you add in more agents.

Now to create a new agent, very simple. For my subscribers, you will come to the paid member vault in uh in Substack here that I that I provide where we have a lot of different stuff here. And you're going to be able to find now a research agent which I'll be linking to. And before I move on with that, a couple of you have asked for like a kind of master document with all these different resources that will be out here soon on Substack with all the links to all the different uh resources and assets that you get uh for your writing system.

All right, so I already developed a research agent system prompt here. I'm going to expand. We can look through it really quickly. And then you're just going to go ahead and put that in your own system. Feel free to make your edits. Everything's flexible here. You know, read it, go through it, make changes, test, iterate, whatever. But this is uh you know that the exact one I use in my own uh writing systems. So we have a research agent that conducts research. Let me wrap the code here so we could read it a little better. So we have a researcher agent that conducts research and analysis filtered through your business context. Use this when the user needs market research, competitive analysis, trend research or data gathering. We're using the Opus model. Uh and then we have the system prompt here. Now the difference between with my system prompt is it's built specifically for my writing system. So, you know, if you're going to use my system prompt, you need to also be using the other infrastructure and methodologies that I developed here with, for example, context profiles and my cloud MD system prompt because all of this is connected.

All right. So, we're going to take this research agent context uh or system prompt, which basically what it does is when you come up with a research task and you pass it to the research agent, the research agent is going to specifically look here in your context folder for things like your business profile, context profile, your ICP, your voice DNA, and it's going to understand the context about you to make sure that this research is tailored and personalized and custom to you and your system and your business brand, whatever it that you're doing.

All right. And to put this in there, it's super simple. You're literally going to copy this code right here, which is the actual system prompt. You're going to come here into your agents folder. All right. And we are going to create a new file. Let's name this researcher- agent. And make sure to put MD so it so it saves as a markdown file because that's all cloud code agents are. They're just markdown files formatted in a specific way here. So, you're going to save that. You're going to click enter. All right. And now here you could see we have the empty file for the researcher agent. And we're going to paste what I gave you there. And this is the system prompt. All right. So we're going to save that. All right.

And now you can see here we have the researcher agent fired up, loaded up, ready to go. Now once again, you need to restart your cloud code to give it access to this. So we're going to open up a new terminal here. We'll uh restart Cloud Code. We'll fire up Claude. And what you can do here is you can do slash agents just to confirm that everything's set right. You didn't put anything wrong. And now you can see we have the researcher agent right here. So it's fired up. It's loaded. Everything worked out correctly. We can view it. We can edit it, delete it, etc. Right.

All right. So our agent is fired up. It's ready to go. So now we're going to test it out by running a query. So there are a couple really creative things you can do now. So now that your custom, you know, cloud code writing system has access to a research agent in powerful deep research tools through the perplexity MCP, you can generate highly, you know, personalized and custom research reports, deep research queries and stuff like that built right on top of your context. So the more stuff you have here, you know, inside of your system, the better it's going to be. So this cloud code starting kit is a little bit bare right now, right? We have two agents. We have some skills. There's nothing load. There are three context profiles loaded here which are my personal ones that I copied and put here. Uh which you don't have. You're going to have to, you know, of course put your own in there. And then we have knowledge, which I don't have here. But in my real system that I use my day-to-day work, you know, I have all my substack newsletters, my YouTube transcripts, more context profiles. so much context that this M that this research agent can use when you know compiling any type of reports or anything like that any insights. Now my profiles in here you could see we have like a business profile which talks about all of my business what I do the pricing you know for my products I have my ICP my ideal client profile you know who it is that my audience is. So that's really um you know important to have in there. At the very least you should have these context profiles because it's the the basis of your your agent and your uh you know entire system here really. Right.

All right. So now here's what we're going to run here. We're going to take this this prompt just as an example. And what I wanted to do is I'm going to tell it I want to validate my niche. Use your research agent to determine whether there's real demand for what I do, who else is doing it, and what people are willing to pay. run a deep research report. We're going to run that and it should fire up its research agent to then use Perplexity for that report. And in doing so, it's going to study my business profiles and ICPS and stuff like this to know what my business is and the context for all my business. Couple errors here reading files, but it's going to fix itself out and search it. Uh, but we're going to let that run here. Now, an important thing to note is you really shouldn't have to, you know, call out like I did here in the prompt to use your research agent because, you know, in the perfect world, Anthropic says that Claude Code autonomously invokes its agents and its skills. But I do find that not to be the case sometimes, especially when you're dealing with something like an MCP tool such as perplexity. So you might tell it, you know, if I were to tell it just to, you know, run a deep research report and I never mentioned using the research agent, it is very likely to just bypass the research agent and just run the report, which sometimes works perfectly fine. But if you actually want to, you know, ensure that it runs the through the agent, you know, sometimes you need to call it out. Here's the deep research. You can see it is going to hand it off. It handed it off to the researcher agent for a deep niche validation report. This is the researcher agent running here and it's calling on the perplexity uh deep research tool putting out this big query and we're going to let that one run. So now that's going to run and fill out an entire report.

I'm going to open up another uh terminal here and then run just like a just another example here which is content gap analysis. So hopefully this gives you some ideas of what you can do. We're going to tell it now like look at my ICP profile and run a gap analysis. what content is missing out there for this audience? What pain points aren't being addressed? What questions are they asking that no one is answering well? And once again, I'm going to tell it uh fire up a research agent to carry out this task. And we're going to run that one. So now you have multiple research agents. Fire it up. Running different things. You can use this for anything, right? Depending on what it is you do. So we're going to see that this is running. Uh and we're going to now start this one. It's going to read our ICP profile, then hand it off to the agent with the right context. That's going to take a couple minutes, but that's what's cool. You can run all these parallel instances here. You can go work on something else, come back to that later, you know, whatever. Go have a coffee, keep working, whatever it is you want to do. I'm going to pause it here, let this run for a few minutes, and then we'll come back and see what the final output looks like and what you can do with that.

All right, so my first research agent just finished its task, which was the first report on uh determining whether there's real demand for what I do, who else is doing it, what people are willing to pay. And this is what you're going to see here. here. It's going to come back. It's just going to be Claude telling you like a little summary of what it did. Uh, you know, you should validate with strong demand signals. Here's the research I found. Blah blah blah blah blah. But this is not what's cool. What's really cool now is what we're going to do is compile this into an actual PDF report with Claude's like executive summary, our agents executive summary on top of it since our, you know, Claude knows so much about our context. So, I'm going to use voice dictation here and I'm going to tell it like let's see here. I'm going to say, "All right, I want you to create a PDF uh, you know, research report with the full original report. Um, but before that, I want your page of executive summary from the agent, you know, specifically uh regarding my context and our system here." And then continue with the original report. Something like that. We're just going to tell it that. um you know, maybe a little less wordy next time, but we're going to tell it that. And now it's going to do something really cool here, right? So, you're going to see right here, it's going to say use skill document skills. Claude may use instructions code or files from this skill. So, this is a Claude skill that's going to allow it to create really nice PDFs and documents. And if you don't have that skill already, I'm going to link here to another video which I did that tells you or shows you how to install Claude's official library of Claude skills. And in that is these document skills. So if you don't have that, make sure to install that as well. So you could start to see how all of this is connected. It's in it's insane. It really is insane how all of this is connected. And this time around, you can see it invoked it itself. I didn't even say it actually. You know, funny. The first time this happened when I was testing it out earlier today, I totally even forgot about that, you know, document skill. So, it invoked it itself and I was like, "Oh, you know, I couldn't even remember about that." So, so it's going to use the document skill here and we're going to give it, you know, permission here and it's going to fire up that skill to create this really nice PDF with the original research report, but also our custom agents executive summary on top of it. All right. Okay.

So, as you can see, I'll create a professional PDF report with an executive summary tailored to your business context, followed by the full report. We're going to let that do it. We're going to come over here, and this is still running. So, that's going to take a minute. Uh, so we'll we'll jump back here when that's done. All right. So, after a minute or two, it ran here. You can see it used its PDF document skills to create a professional PDF report. All right. And then what you're going to get here is give it permission to actually generate the PDF research report. We're going to let that run and then it'll open up the report. And then over here, our second Asian just got done as well. Let's first let's first let this uh finish up here. We're going to keep giving it permission to finish this up. And there you have it. It finished it up. Here we have the PDF report created successfully and it went ahead and stuck it inside of my knowledge folder here. So, we have that stored over there.

Before we take a look at it, let's look at our second agent which was running our our second uh query. If you remember on looking at my ICP and running a gap analysis of what content is missing there for my audience and you can see we got the summary here. It determines seven gaps that is missing for you know my ICP out there. For example, let's see this market has a barbell problem. Education exists for beginners uh like basic chap tutorials and engineers like courses but the middle ground for professional content operators is almost entirely vacant. You're positioned to own this space. We have the seven gaps. Context engineering has no teacher. Uh voice preservation remains unsolved. No anti-slop governance framework. Career transition anxiety is unressed. Agentic workflows are underdocumented. No newsletter owns writing operations. and the empty uh middle in AI education. So, these are all great things uh that are going to work for me. Now, I'm not going to run the same thing here, but what I would do is tell this the same thing we told the first agent, which was to go ahead and put this in a PDF research report with an executive summary on top. And I'm going to store all these in my knowledge here for good reference and for, you know, just even even richer context inside my system going forward next time I talk to Claude. Right?

So, let's get rid of that for now. Let's go back to our first uh PDF report. You're going to see here now in knowledge we're going to have I guess let's say in notes here we have this niche validation report. We're going to open it right here inside of VS Code. And this is the report that Claude put together. We have a niche validation report for AI writer ops market demand analysis competitive landscape pricing validation prepared for Alex McFarland. We have the executive summary from my agent here you know which says let's see you are Alex McFarland founder of AI writer ops teaching professionals to build AI writing systems all right your target audience consists of content strategists marketing leaders consultants agency owners and solarpreneurs who are frustrated with generic AI output that sounds like everyone else's. You know we have the verdict which is strong market validation. Your niche is validated with compelling demand signals. Right? We got the research reveals a significant gap between AI tool adoption and comprehensive training. Then we have this 51 percentage point gap represents my addressable market. My positioning around context engineering voice DNA preservation and reusable systems addresses documented market pain points. Now we have these metrics here. We have the market size, demand gaps, competition, my competitive advantage, which is context engineering versus prompt engineering, which is why we're blowing up here in our community on on Substack on YouTube. Uh, we're blowing up all over the place because of these things. Context engineering versus prompt engineering, voice DNA, uh systems over oneoff. So, you know, I ran this almost like validating what I already knew was validated, which kind of helps us see the accuracy here, right? We have strategic recommendations as well. And then we have the full research report from uh Perplexity. All right, that's going to go in and we're going to see all these pricing validations. It even taking a look at my own pricing. Some of this is outdated. Uh, but you know, we have my newsletter competitive. We have my training program, you know, 1,297 comparing it to other ones. We have custom builds 2500 to 5,000. Uh, we t, you know, it even says that it may be underpriced. We have strategic partnerships, uh, assessments and stuff like that. So, you could just see it's like a mountain, like it's a gold mine of of insights and information. Uh, this is how you run deep research reports with these custom agents inside of your system with your own context.

So, make sure to check that out. Uh, if you're not subscribed, subscribe to this YouTube where we're going to keep covering this stuff going forward. Keep expanding our systems, you know, all these these new agents, MTP tools, everything coming out of Cloud Code. We're going to keep, you know, pushing that forward. And join my Substack if you want access to all of these different assets and tools, you know, so that you could copy them right into your own system like this Cloud Code starting kit. Uh, and you know, these agents, these skills, all of it is available on my Substack. So, make sure to check that out. And then lastly, just to mention, a lot of you are asking about when the coowriter system is coming out, which is my training program, but not, you know, I don't even like to call it a training program because it's like a training program of teaching you how to do all this, how to use it all, but also it's an entire library here of like everything I use. It's like an entire system library of agents and skills and video walkthroughs and community and stuff like that. That is opening very soon. So, keep checking back on that. I'm actually working on building an entire platform for it. all sorts of cool stuff that I'm going to show you guys that I'm building with Claude Code for my community.