deepagents-architecture — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited deepagents-architecture (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
| 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 | 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 |
Need real disk access?
├─ Yes → FilesystemBackend(root_dir="/path")
└─ No
└─ Need persistence across conversations?
├─ Yes → Need mixed ephemeral + persistent?
│ ├─ Yes → CompositeBackend
│ └─ No → StoreBackend
└─ No → StateBackend (default)Route different paths to different storage backends:
from deepagents import create_deep_agent
from deepagents.backends import CompositeBackend, StateBackend, StoreBackend
agent = create_deep_agent(
backend=CompositeBackend(
default=StateBackend(), # Working files (ephemeral)
routes={
"/memories/": StoreBackend(store=store), # Persistent
"/preferences/": StoreBackend(store=store), # Persistent
},
),
)Use subagents when:
Don't use subagents when:
#### Pattern 1: Parallel Research
┌─────────────┐
│ Orchestrator│
└──────┬──────┘
┌──────────┼──────────┐
▼ ▼ ▼
┌──────┐ ┌──────┐ ┌──────┐
│Task A│ │Task B│ │Task C│
└──┬───┘ └──┬───┘ └──┬───┘
└──────────┼──────────┘
▼
┌─────────────┐
│ Synthesize │
└─────────────┘Best for: Research on multiple topics, parallel analysis, batch processing.
#### Pattern 2: Specialized Agents
research_agent = {
"name": "researcher",
"description": "Deep research on complex topics",
"system_prompt": "You are an expert researcher...",
"tools": [web_search, document_reader],
}
coder_agent = {
"name": "coder",
"description": "Write and review code",
"system_prompt": "You are an expert programmer...",
"tools": [code_executor, linter],
}
agent = create_deep_agent(subagents=[research_agent, coder_agent])Best for: Domain-specific expertise, different tool sets per task type.
#### Pattern 3: Pre-compiled Subagents
from deepagents import CompiledSubAgent, create_deep_agent
# Use existing LangGraph graph as subagent
custom_graph = create_react_agent(model=..., tools=...)
agent = create_deep_agent(
subagents=[CompiledSubAgent(
name="custom-workflow",
description="Runs specialized workflow",
runnable=custom_graph
)]
)Best for: Reusing existing LangGraph graphs, complex custom workflows.
Deep Agents applies middleware in this order:
write_todos/read_todosls, read_file, write_file, edit_file, glob, grep, executetask toolinterrupt_on configured)from langchain.agents.middleware import AgentMiddleware
class MyMiddleware(AgentMiddleware):
tools = [my_custom_tool]
def transform_request(self, request):
# Modify system prompt, inject context
return request
def transform_response(self, response):
# Post-process, log, filter
return response
# Custom middleware added AFTER built-in stack
agent = create_deep_agent(middleware=[MyMiddleware()])| Need | Use Middleware | Use Tools |
|---|---|---|
| Inject system prompt content | ✅ | ❌ |
| Add tools dynamically | ✅ | ❌ |
| Transform requests/responses | ✅ | ❌ |
| Standalone capability | ❌ | ✅ |
| User-invokable action | ❌ | ✅ |
Subagents receive their own middleware stack by default:
Override with default_middleware=[] in SubAgentMiddleware or per-subagent middleware key.
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.
FilesystemBackend or CompositeBackend, root_dir and any route prefixes are written down (path placeholders OK).interrupt_on, or "no HITL" plus one-line risk acceptance.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.