Back to website
Mayank Aggarwal Learning Center

Phase 06 · AI AgentsLesson 4 of 4

Project: Multi-Agent DSA Solver

Combine everything so far: a team of agents that solves coding problems.

  • 2:47:05 video
  • 2 min read
  • Advanced
  • Deep dive
01

The problem

This project brings the whole track together: Python, DSA and multi-agent design. You'll build a small team of agents that can read a coding problem, write a solution, test it and improve it, much like a pair-programming session where every role is played by an AI.

02

The concept

Deep dive: 2h 47m video. You don’t need it all in one sitting. Watch the first 20 minutes for the core idea, read the write-up below, and come back for the rest when you need it.

The team design#

AgentResponsibilityTools
Problem analystRestates the problem, identifies inputs, outputs and edge casesNone
CoderWrites a Python solution and explains its time complexityNone
TesterWrites test cases (including edge cases) and runs the codeCode execution
ReviewerChecks correctness, efficiency and readability; approves or requests changesNone
  1. Problem
  2. Analyst
  3. Coder
  4. Tester
  • fails
    1. Coderfix
  • passes
    1. Reviewer
    2. Approve
    3. Final answer

Why separate roles help#

A single model asked to "solve this problem" often produces code that looks right but fails edge cases. Splitting the job forces each step to happen explicitly: someone must think about edge cases, someone must actually run tests. This is the same reason human teams separate writing and reviewing.

Build it step by step#

  1. Start with one agent: the coder alone, on an easy problem (two-sum). Confirm the basic setup works.
  2. Add the tester with code execution in a sandbox. Watch the coder fix its own errors from real test output.
  3. Add the analyst in front, and compare: do solutions handle edge cases better?
  4. Add the reviewer with a clear rule: approve only if all tests pass and complexity is stated.
  5. Add termination: stop on approval or after a maximum number of rounds.

Make it observable#

Log every message with the agent's name and the round number. When the system fails, the log shows exactly where: was the problem misunderstood, was the code wrong, or were the tests weak?

Evaluate it properly#

Create a set of 10–20 problems of mixed difficulty with known correct answers. Track:

  • How many are solved correctly
  • How many rounds each takes
  • Total tokens (cost) per problem

Then improve one thing at a time (a clearer instruction, a better test prompt) and re-run the same set. That's real engineering, not guesswork.

03

Try it

Your task · about 10 minutes

Rebuild the project with a different task, such as summarising articles or reviewing pull requests, and add it to your portfolio.

04

Recap & next

Key takeaways

  1. Split the job into roles: one agent understands the problem, one writes code, one reviews and tests.
  2. Give agents tools to execute and verify code rather than trusting the first answer.
  3. Log every step so you can see where the team goes wrong and improve prompts.
  4. A project like this makes a strong portfolio piece because it shows agents, Python and DSA together.

Quick check

2 questions · instant feedback

1Why add a reviewer/tester agent?
2Why log every agent step?

Want to train your team on this? Talk about corporate training

Finished this lesson?

Mark it complete to track your progress and keep your streak going.

Next