ai agents / subagents / agent orchestration
Subagents Explained: How AI Agents Launch Other AI Agents
Course walkthrough
AI Agents from Scratch
All lessons in this series
- 1I'll Teach You How To Build AI Agents From Scratch (10 Billion Tokens Proof)
- 2What Is An AI Agent? (ChatGPT Doesn't Count)
- 3The ONE Trick That Turns ChatGPT Into An AI Agent (Tools)
- 4The ReAct Loop: How Cursor & Claude Code Actually Work
- 5The System Prompt That Changes Everything (Prompt Engineering For AI Agents)
- 6How To Make Your AI Agent Truly Autonomous (Without It Going Rogue)
- 7How To Trigger An AI Agent (5 Different Ways)
- 8Subagents Explained: How AI Agents Launch Other AI Agents
- 9Simple Memory: How AI Agents Remember Between Runs
- 10How AI Agents Actually Remember (Memory + RAG Explained)
- 11How To Actually Tell If Your AI Agent Is Good (Evaluation)
- 12The Complete Guide To Building AI Agents (10 Lesson Recap)
Subagents are how modern AI tools like Cursor and Claude Code parallelize work — and at the end of the day, launching a subagent is just executing another tool. In this lesson, I show you exactly how subagents work and when to use them.
You'll learn: → What a subagent actually is (it's simpler than you think) → Why subagents are just specialized tool calls under the hood → How to parallelize AI work across multiple specialized agents → A concrete example: launching a subagent to build a trading strategy → The 3 key things every subagent needs: parallelism, specialization, async execution
By the end, you'll understand when to use subagents in your own AI agent — and how the most popular AI tools use them to ship complex multi-step features.
This is Lesson 8 of "How To Build AI Agents From Scratch" — a free 11-lesson masterclass on building production-ready AI agents.
#Subagents #AIAgents #Parallelization #ClaudeCode #Cursor
Transcript
0:05Welcome back to my course on how to build an AI agent from scratch In this video we're going to be talking about an important part of AI agents called sub agents
0:19And if you understood everything we've talked about so far if that starts and executes a function
0:34then sub agents should click because they're basically the same thing So first let's go back to my agent executor which I've introduced in an earlier video
0:48Within this I remember showing my schema which is part of the basic react loop but it's a little bit different We had thoughts
1:02an action which can be an action or command and we had a final answer Within this architecture that I've built commands are simply things that the system knows
1:16how to do while actions are things that language models know how to do So one of these commands are commands to create
1:30sub agents A sub agent is simply another agent that specializes in some task The system prompt here is specialized
1:44It might contain a different set of tools or a different set of instructions and it's more focused on accomplishing some certain task Now you might be thinking why do I need a sub agent I
1:57already have the agent and the agent already has the list of tools that it can do Why do I need a sub agent Well let's just think about this real quick These instructions are very
2:11very long and while you can try to tell your agent to remember to do everything eventually at some point the performance just starts to degrade
2:24A sub agent is a way of having specialized instructions for an agent and those specialized instructions make it really really good at accomplishing some task
2:38However there's really nothing special about sub agents At the end of the day launching a sub agent is like executing any other tool and let me show you with
2:51a concrete example So let's return here I'm going to create an agent I'm going to say create an options trading strategy that buys spy calls and I'm
3:08going to say launch a sub agent to do this I have it in fully automated mode so in fully automated mode I don't have to do anything The AI is going to do everything for me and we'll see how
3:23it works Like before
3:36we first create a plan This makes the agent more focused and we can see that step one of the plan is to launch an options strategy sub agent
3:53It is a mini agent that under the hood it has special instructions for creating option trading strategies and then this again is another command It's simply waiting
4:06for this sub agent to finish Let's look at that sub agent real quick We can see that this is the sub agent prompt It again has specialized instructions
4:20for how to create option trading strategies so I don't have to have all of this information within the main agent I just have this mini
4:32specialized sub agent and it knows how to do all this stuff by itself The sub agent again is like a mini agent It has its own little plan and it's
4:45going to execute all of this automatically and once it's done the main agent will read the sub agent and summarize the results
4:57and this has several benefits Not only just the fact that this sub agent is focused but you can maybe launch multiple sub agents in parallel
5:11so that you can do multiple things at the same time One sub agent might explore option trading strategies on SPY and the other on QQQ or one sub agent might focus on iron
5:25condor strategies while the other one focused on a covered call strategy You can have sub agents focus on different things to accomplish tasks much faster and with higher accuracy
5:37than just using one singular agent The key thing to remember about sub agents are one they can be parallelized Two they are specialized with a special system
5:50prompt and often a different set of tools and three they take work off of the main agent and can execute tasks asynchronously If
6:03you remember all these key things about sub agents then when you're ready to own an AI agent you'll know exactly when to use them That's the end of this video
6:18In the next video I'm going to be talking about one of the most important ways of making your AI improve over time Your AI can't improve unless it has access to things
6:33it has done before and it can remember what to do next In the next module we're going to be talking about memory This is the key thing that makes a
6:46tool like Cursor different than a tool like PlotCode If you're trying to build a production AI agent this is critical I'll see you in the next video
7:03Thank you
Join the conversation
Loading conversation…