SWE-Agent and OpenDevin Architectures
Tour the source code of two leading open coding agents to see how the pros structure tool surfaces and prompts.
SWE-Agent and OpenDevin Architectures is a free AI Agents lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AI Agents learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Study Existing Agents?
SWE-Agent and OpenDevin (now OpenHands) are leading open-source coding agents. Reading their code teaches you what the pros do.
SWE-Agent (Princeton)
SWE-Agent introduced the "Agent-Computer Interface" (ACI) concept — a tightly designed CLI for the agent to manipulate code.
SWE-Agent Tool Surface
open/goto/scroll_up/scroll_down— file vieweredit— line-range editingcreate— new filesfind_file/search_dir— searchsubmit— finish task
The "Window" Concept
SWE-Agent only shows the model a 100-line "window" of a file at a time. Forces explicit scrolling, which surprisingly helps focus.
Lint Feedback Loop
After every edit, SWE-Agent runs a linter. If new errors appeared, the edit is rejected and the model must retry.
OpenDevin / OpenHands
OpenDevin (renamed OpenHands) is a multi-agent platform built around a docker sandbox. It supports many "agent" backends (CodeAct, BrowsingAgent, etc.).
OpenHands Tool Set
execute_bash— run shellstr_replace_editor— Anthropic-style editorbrowse— browser tool for web researchfinish— task complete
Action and Observation Loop
OpenHands explicitly models agent steps as Action -> Observation pairs:
{'action': 'execute_bash', 'args': {'command': 'pytest'}, 'observation': '5 failed, 3 passed', 'next_thought': 'I need to look at the failing tests.'}CodeAct Insight
CodeAct (UIUC) showed that letting the model emit PYTHON CODE for every tool call (instead of fixed JSON tool calls) often outperforms.
Reason: code naturally composes, the model can use loops/conditions/intermediates.
OpenAI Codex CLI
OpenAI shipped Codex CLI — their open-source coding agent reference. Similar pattern: editor, shell, search, finish.
Common Architectural Patterns
- Sandboxed Docker workspace per task
- Read / edit / run / search tool set
- Per-edit verification (lint or test)
- Step caps (50-100 iterations)
- Trace logging for everything
Where Implementations Differ
- Edit format: line-range vs string-replace vs full-file
- File viewer: windowed scroll vs jump-to-line
- Memory: scratchpad vs system-prompt notes
- Verification cadence: per-step vs at-end
Build Your Own
You can build a competitive coding agent in 500-1000 lines of Python by combining:
- The tools from Lesson 2
- The fix loop from Lesson 3
- A planning step from Lesson 1
- Sandboxing from Course 23
- Eval from Course 21
Read the Source
Both SWE-Agent and OpenHands are public on GitHub. Spend an afternoon reading their main loops — best education in agent engineering you can get.
Common Design
What is a near-universal architectural pattern across coding agents?
Recap
SWE-Agent's ACI, OpenHands' action-observation loop, CodeAct's code-as-action. Read their source. Borrow what works. Build your own slimmer version.
Frequently asked questions
Is the “SWE-Agent and OpenDevin Architectures” lesson free?
Yes — the full text of “SWE-Agent and OpenDevin Architectures” is free to read here on the web, and the AI Agents course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AI Agents course, upgrade to CoddyKit PRO.
What will I learn in “SWE-Agent and OpenDevin Architectures”?
Tour the source code of two leading open coding agents to see how the pros structure tool surfaces and prompts. You practise AI Agents with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start AI Agents?
No prior experience is required. AI Agents on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “SWE-Agent and OpenDevin Architectures” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this AI Agents lesson?
Yes. Every AI Agents lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Agentic Patterns: Plan-Execute-Verify
- Tool Surfaces for Coding (Read, Edit, Bash)
- Iterative Self-Correction Loops
- SWE-Agent and OpenDevin Architectures