{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "Deep Agents Harness, DeltaChannel & Composite VFS Architecture",
    "quality_profile": "showcase",
    "repository": {
      "url": "https://github.com/langchain-ai/deepagents",
      "revision": "9f3a1dd38f8b5dbd828d2f366e9b03dad359fadf"
    },
    "views": [
      {
        "id": "primary-execution",
        "label": "Primary Execution Path",
        "focus": ["client-tui", "server-graph", "pregel-loop", "deltachannel-state"],
        "note": "Follow user prompt from Textual TUI through server graph factory and Pregel loop to DeltaChannel state."
      },
      {
        "id": "filesystem-routing",
        "label": "Composite Virtual Filesystem",
        "focus": ["pregel-loop", "fs-middleware", "composite-vfs", "host-disk", "state-storage"],
        "note": "Inspect virtual path multiplexing across local host disk and thread state with output offloading."
      },
      {
        "id": "subagent-delegation",
        "label": "Subagent Delegation & Isolation",
        "focus": ["pregel-loop", "subagent-router", "worker-subagent"],
        "note": "Trace task delegation with private parent middleware state key scrubbing."
      }
    ]
  },
  "components": [
    {
      "id": "client-tui",
      "type": "external",
      "label": "dcode Terminal",
      "sublabel": "Textual TUI / Client",
      "pos": [50, 270],
      "size": [140, 60],
      "tag": "libs/code",
      "sources": [
        {
          "path": "libs/code/deepagents_code/app.py",
          "line": 1,
          "end_line": 60,
          "label": "Textual App Entry"
        }
      ]
    },
    {
      "id": "server-graph",
      "type": "backend",
      "label": "Server Factory",
      "sublabel": "make_graph",
      "pos": [260, 270],
      "size": [140, 60],
      "tag": "In-Memory / HTTP",
      "sources": [
        {
          "path": "libs/code/deepagents_code/server_graph.py",
          "line": 70,
          "end_line": 110,
          "label": "make_graph Factory"
        }
      ]
    },
    {
      "id": "profile-engine",
      "type": "security",
      "label": "Profile Engine",
      "sublabel": "Provider Tuning",
      "pos": [260, 110],
      "size": [140, 60],
      "sources": [
        {
          "path": "libs/deepagents/deepagents/profiles/harness/harness_profiles.py",
          "line": 60,
          "end_line": 95,
          "label": "Profile Resolver"
        }
      ]
    },
    {
      "id": "pregel-loop",
      "type": "backend",
      "label": "Pregel Loop",
      "sublabel": "create_agent ReAct",
      "pos": [470, 270],
      "size": [150, 60],
      "tag": "recursion=9999",
      "sources": [
        {
          "path": "libs/deepagents/deepagents/graph.py",
          "line": 921,
          "end_line": 943,
          "label": "create_agent Compilation"
        }
      ]
    },
    {
      "id": "deltachannel-state",
      "type": "database",
      "label": "Delta Checkpoint",
      "sublabel": "O(N) Reducer",
      "pos": [470, 110],
      "size": [150, 60],
      "tag": "snapshot_freq=50",
      "sources": [
        {
          "path": "libs/deepagents/deepagents/graph.py",
          "line": 70,
          "end_line": 75,
          "label": "DeepAgentState"
        }
      ]
    },
    {
      "id": "fs-middleware",
      "type": "backend",
      "label": "FS Middleware",
      "sublabel": "Tools + Offload",
      "pos": [690, 270],
      "size": [150, 60],
      "tag": "ls, read, write",
      "sources": [
        {
          "path": "libs/deepagents/deepagents/middleware/filesystem.py",
          "line": 120,
          "end_line": 180,
          "label": "Filesystem Tools"
        }
      ]
    },
    {
      "id": "subagent-router",
      "type": "backend",
      "label": "SubAgent Router",
      "sublabel": "task Delegation",
      "pos": [470, 430],
      "size": [150, 60],
      "sources": [
        {
          "path": "libs/deepagents/deepagents/middleware/subagents.py",
          "line": 50,
          "end_line": 110,
          "label": "SubAgent Middleware"
        }
      ]
    },
    {
      "id": "composite-vfs",
      "type": "cloud",
      "label": "Composite VFS",
      "sublabel": "Virtual Router",
      "pos": [910, 270],
      "size": [140, 60],
      "sources": [
        {
          "path": "libs/deepagents/deepagents/backends/composite.py",
          "line": 20,
          "end_line": 85,
          "label": "CompositeBackend"
        }
      ]
    },
    {
      "id": "host-disk",
      "type": "database",
      "label": "FilesystemBackend",
      "sublabel": "Host /workspace",
      "pos": [910, 110],
      "size": [140, 60],
      "tag": "CWD Mount"
    },
    {
      "id": "state-storage",
      "type": "database",
      "label": "StateBackend",
      "sublabel": "Thread /scratch",
      "pos": [910, 430],
      "size": [140, 60],
      "tag": "Ephemeral"
    },
    {
      "id": "worker-subagent",
      "type": "backend",
      "label": "GP Subagent",
      "sublabel": "Worker StateGraph",
      "pos": [690, 430],
      "size": [150, 60],
      "tag": "Scrubbed State"
    }
  ],
  "boundaries": [
    {
      "kind": "region",
      "label": "Deep Agents Harness Control Plane",
      "wraps": ["server-graph", "profile-engine", "pregel-loop", "deltachannel-state", "fs-middleware", "subagent-router"]
    },
    {
      "kind": "security-group",
      "label": "Virtual Storage Domain",
      "wraps": ["composite-vfs", "host-disk", "state-storage"]
    }
  ],
  "connections": [
    {
      "id": "tui-to-server",
      "from": "client-tui",
      "to": "server-graph",
      "label": "stream",
      "variant": "emphasis"
    },
    {
      "id": "server-to-profile",
      "from": "server-graph",
      "to": "profile-engine",
      "label": "profile",
      "fromSide": "top",
      "toSide": "bottom"
    },
    {
      "id": "server-to-pregel",
      "from": "server-graph",
      "to": "pregel-loop",
      "label": "compile"
    },
    {
      "id": "pregel-to-delta",
      "from": "pregel-loop",
      "to": "deltachannel-state",
      "label": "deltas",
      "fromSide": "top",
      "toSide": "bottom"
    },
    {
      "id": "pregel-to-fs",
      "from": "pregel-loop",
      "to": "fs-middleware",
      "label": "tools"
    },
    {
      "id": "fs-to-vfs",
      "from": "fs-middleware",
      "to": "composite-vfs",
      "label": "vfs route",
      "variant": "emphasis"
    },
    {
      "id": "vfs-to-host",
      "from": "composite-vfs",
      "to": "host-disk",
      "label": "disk",
      "fromSide": "top",
      "toSide": "bottom"
    },
    {
      "id": "vfs-to-state",
      "from": "composite-vfs",
      "to": "state-storage",
      "label": "state",
      "fromSide": "bottom",
      "toSide": "top",
      "labelDy": 50
    },
    {
      "id": "pregel-to-subagent",
      "from": "pregel-loop",
      "to": "subagent-router",
      "label": "task",
      "fromSide": "bottom",
      "toSide": "top",
      "labelDy": 50
    },
    {
      "id": "router-to-worker",
      "from": "subagent-router",
      "to": "worker-subagent",
      "label": "spawn"
    }
  ],
  "cards": [
    {
      "dot": "cyan",
      "title": "DeltaChannel Checkpointing",
      "items": [
        "Replaces O(N^2) full message copies with incremental O(N) delta streams",
        "Consolidates full snapshot every 50 steps for fast recovery"
      ]
    },
    {
      "dot": "emerald",
      "title": "Composite Virtual Routing",
      "items": [
        "Routes tool calls across virtual paths (/workspace, /scratch)",
        "Translates virtual prefixes to host paths for execute shell commands",
        "Automatically evicts large outputs exceeding token limits"
      ]
    },
    {
      "dot": "violet",
      "title": "Subagent State Hygiene",
      "items": [
        "Scans and scrubs private parent middleware state keys",
        "Compiles isolated subgraphs returning sanitized turn summaries"
      ]
    }
  ]
}
