existential-birds/beagle/deepagents-architecture
Claude Code and agent skill by existential-birds/beagle
- community
Checking that the SKILL.md file is still in the repository.
Guides architectural decisions for Deep Agents applications. Use when deciding between Deep Agents vs alternatives, choosing backend strategies, designing subagent systems, or selecting middleware approaches.
Install
npx vskill@latest install existential-birds/beagle/deepagents-architectureSKILL.md
Deep Agents Architecture Decisions
When to Use Deep Agents
Use Deep Agents When You Need:
- Long-horizon tasks - Complex workflows spanning dozens of tool calls
- Planning capabilities - Task decomposition before execution
- Filesystem operations - Reading, writing, and editing files
- Subagent delegation - Isolated task execution with separate context windows
- Persistent memory - Long-term storage across conversations
- Human-in-the-loop - Approval gates for sensitive operations
- Context management - Auto-summarization for long conversations
Consider Alternatives When:
| Scenario | Alternative | Why | |
|---|---|---|---|
| Single LLM call | Direct API call | Deep Agents overhead not justified | |
| Simple RAG pipeline | LangChain LCEL | Simpler abstraction | |
| Custom graph control flow | LangGraph directly | More flexibility | |
| No file operations needed | create_react_agent | Lighter weight | |
| Stateless tool use | Function calling | No middleware needed |
Backend Selection
Backend Comparison
| Backend | Persistence | Use Case | Requires | |
|---|---|---|---|---|
StateBackend | Ephemeral (per-thread) | Working files, temp data | Nothing (default) | |
FilesystemBackend | Disk | Local development, real files | root_dir path | |
StoreBackend | Cross-thread | User preferences, knowledge bases | LangGraph store | |
CompositeBackend | Mixed | Hybrid memory patterns | Multiple backends |
Backend Decision Tree
CompositeBackend Routing
Route different paths to different storage backends:
Subagent Architecture
When to Use Subagents
Use subagents when:
- Task is complex, multi-step, and can run independently
- Task requires heavy context that would bloat the main thread
- Multiple independent tasks can run in parallel
- You need isolated execution (sandboxing)
- You only care about the final result, not intermediate steps
Don't use subagents when:
- Task is trivial (few tool calls)
- You need to see intermediate reasoning
- Splitting adds latency without benefit
- Task depends on main thread state mid-execution
Subagent Patterns
Pattern 1: Parallel Research
Best for: Research on multiple topics, parallel analysis, batch processing.
Pattern 2: Specialized Agents
Best for: Domain-specific expertise, different tool sets per task type.
Pattern 3: Pre-compiled Subagents
Best for: Reusing existing LangGraph graphs, complex custom workflows.
Middleware Architecture
Built-in Middleware Stack
Deep Agents applies middleware in this order:
- TodoListMiddleware - Task planning with
write_todos/read_todos - FilesystemMiddleware - File ops:
ls,read_file,write_file,edit_file,glob,grep,execute - SubAgentMiddleware - Delegation via
tasktool - SummarizationMiddleware - Auto-summarizes at ~85% context or 170k tokens
- AnthropicPromptCachingMiddleware - Caches system prompts (Anthropic only)
- PatchToolCallsMiddleware - Fixes dangling tool calls from interruptions
- HumanInTheLoopMiddleware - Pauses for approval (if
interrupt_onconfigured)
Custom Middleware Placement
Middleware vs Tools Decision
| Need | Use Middleware | Use Tools | |
|---|---|---|---|
| Inject system prompt content | ✅ | ❌ | |
| Add tools dynamically | ✅ | ❌ | |
| Transform requests/responses | ✅ | ❌ | |
| Standalone capability | ❌ | ✅ | |
| User-invokable action | ❌ | ✅ |
Subagent Middleware Inheritance
Subagents receive their own middleware stack by default:
- TodoListMiddleware
- FilesystemMiddleware (shared backend)
- SummarizationMiddleware
- AnthropicPromptCachingMiddleware
- PatchToolCallsMiddleware
Override with default_middleware=[] in SubAgentMiddleware or per-subagent middleware key.
Gates: architecture decisions before implementation
Complete in order. A step passes only when the stated artifact exists in the design note, ADR stub, or ticket; internal intent alone does not count.
- Fit - Confirm Deep Agents vs alternatives (see tables above).
- Pass: Short written rationale that either names one matching "Use Deep Agents When You Need" bullet or one "Consider Alternatives" row plus the chosen alternative.
- Backend - Match the Backend Decision Tree to a concrete choice.
- Pass: Backend name(s) from the Backend Comparison table; if
FilesystemBackendorCompositeBackend,root_dirand any route prefixes are written down (path placeholders OK).
- Subagents - Decide delegation boundaries.
- Pass: Either "no subagents" plus one sentence why or a named list where each subagent maps to at least one "When to Use Subagents" reason; parallel plans state what merges outputs.
- Human-in-the-loop - Approval surface.
- Pass: Explicit list of tools/operations that use
interrupt_on, or "no HITL" plus one-line risk acceptance.
- Middleware - Custom vs built-in only.
- Pass: Either "custom middleware: none" or each custom piece named, placed after the built-in stack, and tied to prompt injection, tools, or request/response transforms.
- Context - Long threads and large inputs.
- Pass: Stated plan for default summarization behavior (~85% context / ~170k tokens) or an alternative cap; large files handled via references/chunking or equivalent, named in text.
- Checkpointing - Resume and durability.
- Pass: Checkpoint/checkpointer approach named for the graph or "none" with one-line rationale (e.g. ephemeral demo only).
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/beagle-ai/skills/deepagents-architecture/SKILL.md
Popularity
- Repository stars
- 78
- Repository forks
- 9
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/existential-birds/beagle/deepagents-architecture)