Deepagents Architecture logo

Deepagents Architecture

Organization
existential-birds
deepagents-architecture

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.

Overview

Publisherexistential-birds
Repositorybeagle
Skill namedeepagents-architecture
Stars
82
Forks
8
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by existential-birds on GitHub. Read the source before you install it.

Installation

Install the Deepagents Architecture AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/existential-birds/beagle.git /tmp/beagle
mkdir -p .claude/skills
cp -r /tmp/beagle/plugins/beagle-ai/skills/deepagents-architecture .claude/skills/deepagents-architecture
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Deepagents Architecture in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Deepagents Architecture on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Deepagents Architecture is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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:

ScenarioAlternativeWhy
Single LLM callDirect API callDeep Agents overhead not justified
Simple RAG pipelineLangChain LCELSimpler abstraction
Custom graph control flowLangGraph directlyMore flexibility
No file operations neededcreate_react_agentLighter weight
Stateless tool useFunction callingNo middleware needed

Backend Selection

Backend Comparison

BackendPersistenceUse CaseRequires
StateBackendEphemeral (per-thread)Working files, temp dataNothing (default)
FilesystemBackendDiskLocal development, real filesroot_dir path
StoreBackendCross-threadUser preferences, knowledge basesLangGraph store
CompositeBackendMixedHybrid memory patternsMultiple backends

Backend Decision Tree

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)

CompositeBackend Routing

Route different paths to different storage backends:

python
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
        },
    ),
)

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
         ┌─────────────┐
         │  Orchestrator│
         └──────┬──────┘
    ┌──────────┼──────────┐
    ▼          ▼          ▼
┌──────┐  ┌──────┐  ┌──────┐
│Task A│  │Task B│  │Task C│
└──┬───┘  └──┬───┘  └──┬───┘
   └──────────┼──────────┘
      ┌─────────────┐
      │  Synthesize │
      └─────────────┘

Best for: Research on multiple topics, parallel analysis, batch processing.

Pattern 2: Specialized Agents
python
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
python
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.

Middleware Architecture

Built-in Middleware Stack

Deep Agents applies middleware in this order:

  1. TodoListMiddleware - Task planning with write_todos/read_todos
  2. FilesystemMiddleware - File ops: ls, read_file, write_file, edit_file, glob, grep, execute
  3. SubAgentMiddleware - Delegation via task tool
  4. SummarizationMiddleware - Auto-summarizes at ~85% context or 170k tokens
  5. AnthropicPromptCachingMiddleware - Caches system prompts (Anthropic only)
  6. PatchToolCallsMiddleware - Fixes dangling tool calls from interruptions
  7. HumanInTheLoopMiddleware - Pauses for approval (if interrupt_on configured)

Custom Middleware Placement

python
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()])

Middleware vs Tools Decision

NeedUse MiddlewareUse 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.

  1. 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.
  2. Backend - Match the Backend Decision Tree to a concrete choice.

    • Pass: Backend name(s) from the Backend Comparison table; if FilesystemBackend or CompositeBackend, root_dir and any route prefixes are written down (path placeholders OK).
  3. 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.
  4. Human-in-the-loop - Approval surface.

    • Pass: Explicit list of tools/operations that use interrupt_on, or "no HITL" plus one-line risk acceptance.
  5. 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.
  6. 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.
  7. Checkpointing - Resume and durability.

    • Pass: Checkpoint/checkpointer approach named for the graph or "none" with one-line rationale (e.g. ephemeral demo only).

Frequently asked questions

What does the Deepagents Architecture AI skill do?

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.

Why use Deepagents Architecture on TypingMind?

Because you install it once and use it with any model. Deepagents Architecture is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Deepagents Architecture in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/existential-birds/beagle/tree/main/plugins/beagle-ai/skills/deepagents-architecture. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Deepagents Architecture?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Deepagents Architecture?

As many as you like. As long as a model supports skills, you can use Deepagents Architecture with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Deepagents Architecture AI skill free?

Yes. It is published on GitHub by existential-birds under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇