Subagents, Files, and Skills: A Deep Research Assistant Built on Deep Agents
This pattern is the difference between a demo and a tool that survives long research tasks. It shows how to enforce real constraints with tools and middleware instead of hoping the model obeys the prompt.
Deep Agents shifts the design of a research assistant from a single-agent prompt loop to a multi-agent orchestration. The demo uses one main agent to plan and deliver, a researcher subagent that runs web searches and writes findings files, an analyst that executes JavaScript through a QuickJS REPL, and an editor that reviews drafts without touching files. A general-purpose subagent comes built in via createDeepAgent, so there's no need to declare it yourself. The key architectural choice is file-based communication between subagents: each subagent runs in an isolated context and receives only the task description passed through the task tool, so intermediate results have to be written to disk in a self-contained form. A FilesystemBackend with virtualMode maps stable virtual paths like /workspace/sources/ to the real project directory, which keeps prompts independent of machine-specific paths.
Pitfalls and engineering constraints get as much attention as the build itself. Skills are loaded progressively: the middleware reads only name and description first, and the full SKILL.md is read only when the model deems it relevant. But a skill is guidance, not a hard constraint; any rule you need enforced, like a maximum search count, has to live in tool code or middleware. A common bug: a skills path that doesn't match the backend's rootDir gets silently skipped, so the agent runs but never loads the skill. The demo also recommends per-run workspace directories to avoid stale findings files contaminating a new report. The progression from prompt-driven to engineering-driven is the core lesson: prompts decide what the agent wants to do, while tools, middleware, backends, and checkpoints decide what it can and cannot do.
File-based handoffs between subagents force each agent to produce auditable artifacts; that's a pragmatic fix for context bloat and for debugging long agent runs.
Prompts define what the agent wants to do, but the real claim is that tools, middleware, backends, and checkpoints define what it can and cannot do.
Progressive skill loading is a compromise: it keeps the initial prompt small, but it relies on the model to ask for the right manual, which is itself a fragile behavior.
Silent skill-loading failure reveals that agent frameworks often fail softly; without observable output, you may never notice a skill didn't load.