{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "Open-SWE Autonomous Software Engineering Agent & Sandbox Architecture",
    "quality_profile": "showcase",
    "repository": {
      "url": "https://github.com/langchain-ai/open-swe",
      "revision": "d0bfaf3cc69327cfabaebc3e2394c61f69460f44"
    },
    "views": [
      {
        "id": "issue-to-test",
        "label": "Issue Ingestion & Test Flow",
        "focus": ["github-issue", "swe-server", "react-loop", "docker-sandbox"],
        "note": "Follow issue triage and reproduction test execution inside the Docker sandbox."
      },
      {
        "id": "analyzer-index",
        "label": "Codebase AST Indexing",
        "focus": ["swe-server", "analyzer", "react-loop"],
        "note": "Inspect symbol dependency extraction and test file mapping."
      },
      {
        "id": "review-and-pr",
        "label": "Patch Review & PR Dispatch",
        "focus": ["react-loop", "reviewer", "git-pr"],
        "note": "Trace automated diff evaluation and GitHub pull request creation."
      }
    ]
  },
  "components": [
    {
      "id": "github-issue",
      "type": "external",
      "label": "GitHub Webhook",
      "sublabel": "Issue / Bug Report",
      "pos": [50, 270],
      "size": [140, 60],
      "tag": "Issue Ingress"
    },
    {
      "id": "swe-server",
      "type": "backend",
      "label": "SWE Server",
      "sublabel": "FastAPI Orchestrator",
      "pos": [260, 270],
      "size": [140, 60],
      "tag": "server.py",
      "sources": [
        {
          "path": "agent/server.py",
          "line": 40,
          "end_line": 90,
          "label": "SWE Server"
        }
      ]
    },
    {
      "id": "analyzer",
      "type": "backend",
      "label": "Codebase Analyzer",
      "sublabel": "AST Symbol Indexer",
      "pos": [260, 110],
      "size": [140, 60],
      "tag": "analyzer.py",
      "sources": [
        {
          "path": "agent/analyzer.py",
          "line": 20,
          "end_line": 75,
          "label": "Codebase Analyzer"
        }
      ]
    },
    {
      "id": "react-loop",
      "type": "backend",
      "label": "SWE ReAct Loop",
      "sublabel": "Tool Calling Agent",
      "pos": [470, 270],
      "size": [150, 60],
      "tag": "SWE Reasoner"
    },
    {
      "id": "task-supervisor",
      "type": "database",
      "label": "Task Supervisor",
      "sublabel": "baby_sit.py Watcher",
      "pos": [470, 110],
      "size": [150, 60],
      "tag": "Timeout Guard",
      "sources": [
        {
          "path": "agent/baby_sit.py",
          "line": 50,
          "end_line": 105,
          "label": "Task Supervisor"
        }
      ]
    },
    {
      "id": "docker-sandbox",
      "type": "cloud",
      "label": "Docker Sandbox",
      "sublabel": "Hardened Container",
      "pos": [690, 270],
      "size": [150, 60],
      "tag": "Isolated Linux"
    },
    {
      "id": "reviewer",
      "type": "security",
      "label": "Patch Reviewer",
      "sublabel": "Diff & Regression Gate",
      "pos": [470, 430],
      "size": [150, 60],
      "tag": "reviewer.py",
      "sources": [
        {
          "path": "agent/reviewer.py",
          "line": 30,
          "end_line": 110,
          "label": "Patch Reviewer"
        }
      ]
    },
    {
      "id": "terminal-pty",
      "type": "database",
      "label": "Pseudo-TTY Stream",
      "sublabel": "Live stdout/stderr",
      "pos": [690, 110],
      "size": [150, 60],
      "tag": "Terminal IO"
    },
    {
      "id": "git-pr",
      "type": "external",
      "label": "GitHub Pull Request",
      "sublabel": "Verified Solution",
      "pos": [690, 430],
      "size": [150, 60],
      "tag": "PR Output"
    },
    {
      "id": "workspace-fs",
      "type": "database",
      "label": "Mounted Workspace",
      "sublabel": "Read-Write Repo",
      "pos": [910, 270],
      "size": [140, 60],
      "tag": "/workspace"
    }
  ],
  "boundaries": [
    {
      "kind": "region",
      "label": "Open-SWE Control Plane",
      "wraps": ["swe-server", "analyzer", "react-loop", "task-supervisor", "reviewer"]
    },
    {
      "kind": "security-group",
      "label": "Hardened Sandbox Boundary",
      "wraps": ["docker-sandbox", "terminal-pty", "workspace-fs"]
    }
  ],
  "connections": [
    {
      "id": "issue-to-server",
      "from": "github-issue",
      "to": "swe-server",
      "label": "ingest",
      "variant": "emphasis"
    },
    {
      "id": "server-to-analyzer",
      "from": "swe-server",
      "to": "analyzer",
      "label": "index AST",
      "fromSide": "top",
      "toSide": "bottom"
    },
    {
      "id": "server-to-react",
      "from": "swe-server",
      "to": "react-loop",
      "label": "start loop",
      "variant": "emphasis"
    },
    {
      "id": "react-to-supervisor",
      "from": "react-loop",
      "to": "task-supervisor",
      "label": "monitor",
      "fromSide": "top",
      "toSide": "bottom"
    },
    {
      "id": "supervisor-to-pty",
      "from": "task-supervisor",
      "to": "terminal-pty",
      "label": "poll logs"
    },
    {
      "id": "react-to-sandbox",
      "from": "react-loop",
      "to": "docker-sandbox",
      "label": "exec tools",
      "variant": "emphasis"
    },
    {
      "id": "react-to-reviewer",
      "from": "react-loop",
      "to": "reviewer",
      "label": "submit diff",
      "fromSide": "bottom",
      "toSide": "top",
      "labelDy": 50
    },
    {
      "id": "reviewer-to-pr",
      "from": "reviewer",
      "to": "git-pr",
      "label": "create PR"
    },
    {
      "id": "sandbox-to-fs",
      "from": "docker-sandbox",
      "to": "workspace-fs",
      "label": "modify files"
    }
  ],
  "cards": [
    {
      "dot": "cyan",
      "title": "Autonomous SWE ReAct Loop",
      "items": [
        "Iteratively decomposes bug reports, authors reproduction tests, and applies source edits",
        "Executes all commands within isolated Docker container sandboxes"
      ]
    },
    {
      "dot": "emerald",
      "title": "Codebase AST Symbol Indexing",
      "items": [
        "Extracts symbol definitions, import graphs, and test discovery mappings",
        "Provides precise surgical context to LLM reasoning prompts"
      ]
    },
    {
      "dot": "violet",
      "title": "Automated Pull Request Review",
      "items": [
        "Evaluates candidate git diffs against style rules, test suites, and regression checks",
        "Dispatches pull requests only when all verification criteria pass"
      ]
    }
  ]
}
