Featured resource
2026 Tech Forecast
2026 Tech Forecast

1,500+ tech insiders, business leaders, and Pluralsight Authors share their predictions on what’s shifting fastest and how to stay ahead.

Download the forecast
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • AI
Labs

Build a Multi-Agent Assistant with Deep Agents

One agent with a long prompt can answer a question. It struggles with research work that takes a dozen tool calls, three kinds of expertise, and a report someone will actually act on. In this Code Lab, you'll build a multi-agent research assistant with the Deep Agents harness. Your primary agent writes a plan, hands focused subtasks to research, analysis, and reporting subagents, and keeps findings in files so its context window stays small. You'll add a reusable report skill and persistent memory so every run follows the same standards, then trace each agent's work and evaluate the workflow for correctness, latency, and token cost. When you're finished, you'll have a working assistant that turns an analyst's question into a structured, sourced report, plus the numbers to show how well it performed.

Lab platform
Lab Info
Level
Intermediate
Last updated
Dec 01, 2026
Duration
1h 30m

Contact sales

By clicking submit, you agree to our Privacy Policy and Terms of Use, and consent to receive marketing emails from Pluralsight.
Table of Contents
  1. Challenge

    Introduction

    Build a multi-agent assistant with Deep Agents

    You're on the analytics team at Globomantics. Analysts keep asking open-ended questions like this one:

    Why did Q3 2026 revenue in EMEA fall while the other regions grew, and what should we watch next quarter?

    Answering it well takes two kinds of research (market notes for the why, SQL for the how much) and a report someone can act on. In this lab, you'll build a research assistant that does that with a team of agents, using the Deep Agents library on top of LangGraph.

    What you'll build

    • A research lead agent that writes a plan and delegates.
    • Three subagents: a researcher (market notes), an analyst (SQL), and a reporter (the final report).
    • A file workspace so agents hand off work through files instead of long messages.
    • A reusable report skill and a memory file with the team's conventions.
    • A validator and an evaluation that check whether the answer is actually right.

    The trap in the data

    EMEA subscription revenue fell 12.0% quarter over quarter. A query that also counts one-time Analytics Desktop license sales shows only 7.6%. The team's definition of revenue lives in memory, and subagents don't read memory. Getting the right answer depends on the lead passing that convention along. In recorded live runs, a single agent fell for the trap and the multi-agent build didn't.

    How this lab works

    • Files: you'll edit agent.py, validate.py, evaluate.py, skills/research-report/SKILL.md, and memories/AGENTS.md. Look for TODO comments. tools.py, run.py, and lab_budget.py are complete.
    • Terminal: the lab's Python environment is already active. Run commands from the workspace folder.
    • Checks: each task has a Validate button. Most checks run offline with a stand-in model, so they're free and instant.
    • AI tokens: the lab gives you 20,000 Claude tokens per session (shown at the top of the screen). Three tasks make small live calls: about 1,500, 5,000, and 11,000 tokens. Everything else is free. If you run out, restart the lab to get a fresh session and a new API key.

    Why lab_budget.py? Deep Agents sends long built-in instructions with every model call, mostly for tools this lab doesn't use. lab_budget.py swaps them for short versions so a full multi-agent run costs about a third as much. You don't need to edit it, but it's worth a read when you finish.

  2. Challenge

    Configure the environment and build a single-agent baseline

    Configure the environment and build a baseline

    Before you build a team, you need a yardstick: one agent with every tool, answering on its own. create_deep_agent returns a compiled LangGraph graph, so everything you know about invoking graphs still applies.

    In this step, you'll point the lab at Claude and build that baseline.

  3. Challenge

    Define research, analysis, and reporting subagents

    Define the subagents

    A subagent in Deep Agents is a dictionary with four keys:

    | Key | What it does | |---|---| | name | How the lead refers to it when delegating | | description | What the lead reads when deciding who gets a task, so make it specific | | system_prompt | The subagent's own instructions | | tools | The only tools it can use |

    Each subagent starts with a clean context window, sees only the task description the lead writes, and returns one final message. Narrow tools keep each one focused.

  4. Challenge

    Configure task planning and delegation

    Configure planning and delegation

    Deep Agents can give the lead a write_todos tool for planning. As of version 0.7 it's opt-in: you add it with TodoListMiddleware. The plan lives in the graph state, so you can inspect it after a run.

    Delegation quality depends on what the lead writes in each task description, because that's all a subagent sees. In this step, you'll turn on planning, write the lead's delegation rules, and then watch your wiring run with a free, scripted dry run.

  5. Challenge

    Implement filesystem-backed context management

    Manage context with files

    Every message an agent reads stays in its context window. If subagents paste full findings back to the lead, the lead's context fills up fast. Instead, subagents write their full output to files and return a short summary and a path.

    Deep Agents gives every agent file tools backed by a backend. A CompositeBackend routes paths by prefix:

    | Path | Backend | Where it lives | |---|---|---| | Anything else | StateBackend | In the agent's state; gone after the run | | /workspace/ | FilesystemBackend | The output folder on disk | | /memories/ | FilesystemBackend | The memories folder | | /skills/ | FilesystemBackend | The skills folder |

    virtual_mode=True keeps agents inside each folder, so /workspace/../agent.py can't escape.

  6. Challenge

    Configure reusable skills and persistent memory

    Add a skill and memory

    Two features keep runs consistent:

    • Skills are folders with a SKILL.md file. The agent sees each skill's name and description up front and reads the full file only when it needs it. This keeps long instructions out of every call.
    • Memory is a file, here /memories/AGENTS.md, that's loaded into the lead's system prompt on every run. The agent can also edit it, so it learns conventions over time.

    One catch: custom subagents don't inherit skills or memory. You'll give the reporter skills explicitly, and the lead copies conventions from memory into task descriptions.

  7. Challenge

    Execute and validate a multi-agent research task

    Run and validate

    Now run the real model through your multi-agent build, then write checks that catch a broken run automatically.

    The full EMEA request needs more than 30,000 tokens, so here you'll ask a focused, numbers-only version live. That's enough to see whether the lead passes the revenue definition to the analyst. Your validators then run against the dry run's full report.

  8. Challenge

    Trace and evaluate the workflow

    Trace and evaluate

    A report can pass every structural check and still be wrong. In this step, you'll measure what matters: is the headline number correct, how long did it take, and which agent spent the tokens?

    Your run logs already trace each agent's work: run.py tags every model call with the agent's name and records calls, tokens, and seconds per agent in usage_by_agent. The recorded/ folder holds two real runs of the full EMEA request, made with a larger model and no token limit: the single-agent baseline and the multi-agent build. You'll score both, plus your own live --numbers run. # You're done

    You built a research assistant where a lead agent plans, delegates to three specialists, hands off work through files, follows a reusable skill, and remembers team conventions. Then you proved whether it gets the right answer and measured what that costs.

    Where to go next:

    • Read lab_budget.py to see how the built-in prompts were shortened. The same levers help in production.
    • Try python run.py --full outside the lab, with your own API key, to run the whole request live.
About the author

Mycal Brown, PhD, is a cybersecurity and AI governance professional focused on secure AI adoption, cloud security, SOC operations, and risk management.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight