agent-architecture
Skill0 starsChanged 8 months agoMITView on GitHub
Use at the start of any LLM agent project, or when reconsidering an existing architecture. Guides decisions across four layers: workflow vs agent, single-agent vs multi-agent, tool-use vs specialized nodes, and retrieval strategy. Each decision has concrete tradeoffs and a recommended default.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- taixuann/development-spacetheir own version, first seen Nov 8, 2026
- github/awesome-copilottheir own version, first seen Oct 25, 2026
- eshwarvijay/agent-architecturetheir own version, first seen Oct 25, 2026
- ruvnet/ruflotheir own version, first seen Oct 21, 2026
- ruvnet/claude-flowtheir own version, first seen Oct 8, 2026
- Sathvikar01/Agent-engineering-skillstheir own version, first seen Oct 5, 2026
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- ruvnet/claude-flow★ 80ksame name
- ruvnet/ruflo★ 79ksame name
- github/awesome-copilot★ 41ksame name
- eshwarvijay/agent-architecture★ 9same name
- Sathvikar01/Agent-engineering-skills★ 3same name
- mattstruble/skills★ 2same name
- Zekiog/ruflo★ 2same name
- fidgetcoding/fidgetflo★ 1same name
- jpoindexter/theft-kit★ 1same name
- Soulcynics404/AgentForge★ 1same name
2 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- build-reliable-agentsSkill
- agent-integrationSkill
- ai-system-designSkill
- code-reviewSkill
- critic-judge-designSkill
- database-designSkill
- devopsSkill
- experiment-driven-developmentSkill
- harness-designSkill
- memory-systemSkill
- model-selectionSkill
- problem-explorationSkill
- prompt-change-managementSkill
- prompt-designSkill
- regression-testingSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
The question: Do your components need independent state and memory, or can they share state?
- Distinctive: line 44
The overkill test: If your "multi-agent" system has one orchestrator directing all other agents sequentially, it's a single agent with …
- Distinctive: line 50
The question: Should one LLM decide which tools to use, or should each step be a dedicated node?
- Distinctive: line 63
The sequence test: If you can write down the steps your pipeline takes before running it, use specialized nodes.
- Distinctive: line 79
Syntax validation: before execution (catch LLM SQL errors early)
- Distinctive: line 102
Principle: Every deterministic component you add reduces variance and improves debuggability.
- Distinctive: line 108
When starting a new project:
- Distinctive: line 135
When these appear, revisit the relevant decision rather than adding more complexity on top.
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Architecture Decision Framework
Overview
Agent architecture decisions compound. A wrong early decision (e.g. single agent with tool-use when you need observability) becomes expensive to fix later. Make these four decisions explicitly, in order, before writing any code.
Decision 1: Workflow vs Agent
The question: Does your pipeline need to recover from mid-step failures, or is it always the same sequence?
| Workflow | Agent | |
| Structure | Fixed sequence, always A→B→C→D | Can loop back: if B fails, retry A with different input |
| Use when | Steps never need to reorder or retry | Failures in one step should inform retries of earlier steps |
| Observability | High — path is always the same | Medium — path varies by run |
| Debugging | Easy — failure is always at a known step | Harder — need to trace which path was taken |
Default recommendation: Agent, unless your pipeline is truly linear with no recovery needed. The ability to route back on failure (e.g. SQL validation failure → regenerate SQL) is almost always worth the small added complexity.
Decision 2: Single Agent vs Multi-Agent
The question: Do your components need independent state and memory, or can they share state?
| Single Agent (shared state) | Multi-Agent | |
| State | One shared state across all nodes | Each agent has own state and memory |
| Communication | Direct via shared state dict | Message passing or shared memory |
| Use when | Components are steps in one pipeline | Components are truly independent actors with different goals |
| Complexity | Lower | Higher |
| Latency | Lower | Higher (inter-agent communication) |
| Debugging | Easier — one state to inspect | Harder — must trace across agent boundaries |
Default recommendation: Single agent with specialized nodes. For a single-pipeline system, multi-agent adds complexity that rarely pays off. Use multi-agent when you genuinely need independent memory per component, or when components run concurrently with different LLM models and goals.
The overkill test: If your "multi-agent" system has one orchestrator directing all other agents sequentially, it's a single agent with extra steps. Flatten it.
Decision 3: Tool-Use vs Specialized Nodes
The question: Should one LLM decide which tools to use, or should each step be a dedicated node?
| Single Agent + Tool-Use | Specialized Nodes | |
| Control | LLM decides which tool to call and when | You control the sequence explicitly |
| Observability | Low — hard to know which tool ran and why | High — each node is a named, traceable step |
| Step ordering | Not guaranteed — LLM may skip or reorder | Guaranteed — graph topology enforces order |
| Error attribution | Hard — which tool call failed? | Easy — which node failed? |
| Flexibility | High — LLM adapts to unexpected inputs | Medium — unexpected cases need explicit routing |
| Use when | Task is open-ended, steps unknown in advance | Task has known sequence of steps |
Default recommendation: Specialized nodes for any pipeline with known steps. Tool-use is better for open-ended tasks where you genuinely don't know what steps are needed (e.g. a research agent that might need 2 or 20 searches).
The sequence test: If you can write down the steps your pipeline takes before running it, use specialized nodes. If the steps only become clear at runtime, use tool-use.
Decision 4: Retrieval Strategy
The question: How does your agent get information from its data source?
| Strategy | Use When | Avoid When |
| Text-to-SQL | Data is structured (tables, rows, columns). Questions can be answered by querying known fields. | Data is unstructured prose. Schema is unknown or changes frequently. |
| RAG (vector search) | Data is unstructured text. Questions require semantic similarity ("find things like X"). | Data is structured. Exact answers are needed. SQL can express the query. |
| Hybrid (SQL + FTS) | Structured data with some free-text fields. Structured queries for enumerable fields, FTS for text search. | When either alone would work — don't add complexity without need. |
| Hardcoded templates | Query patterns are known and fixed. Determinism is critical. | Query variety is high. Schema changes frequently. |
For SQL-based retrieval, MUST implement these safety layers:
- Syntax validation before execution (catch LLM SQL errors early)
- Destructive keyword blocking (regex on stripped quoted content — block DROP, DELETE, UPDATE, INSERT, ALTER, TRUNCATE)
- Read-only connection (defense in depth even after validation)
- Row cap at Python level, not just in prompt (LLM may omit LIMIT clause)
Decision 5: Where to Put Intelligence
For each step in your pipeline, decide: LLM or deterministic?
| Step Type | Prefer LLM | Prefer Deterministic |
| Understanding intent | ✓ | |
| Decomposing a question | ✓ | |
| Generating SQL or queries | ✓ | |
| Validating SQL syntax | ✓ (use EXPLAIN QUERY PLAN) | |
| Blocking destructive keywords | ✓ (regex) | |
| Routing based on a score | ✓ (derive from numeric field) | |
| Formatting output | ✓ | |
| Enforcing row caps | ✓ (cursor.fetchmany()) | |
| Judging quality | ✓ |
Principle: Every deterministic component you add reduces variance and improves debuggability. Never use an LLM for something a simple function can do.
Step-by-Step Architecture Decision Process
When starting a new project:
- Write down the pipeline steps in order (even if approximate)
- Apply Decision 1 (workflow vs agent) — does any step need to retry an earlier step?
- Apply Decision 2 (single vs multi) — do any components need independent state?
- Apply Decision 3 (tool-use vs nodes) — is the step sequence known in advance?
- Apply Decision 4 (retrieval strategy) — what is the data source and query type?
- Apply Decision 5 (LLM vs deterministic) — for each step, which is appropriate?
- Draw the graph — nodes, edges, routing conditions, loop guards
- Identify the blast radius of each LLM node (what downstream nodes consume its output?)
- Write the loop guards — every cycle in the graph needs a hard exit condition
Architecture Evolution Warning
Systems evolve. The architecture that was right at design time may not be right after:
- New query types require new routing
- A simple node grows into a multi-step process
- An LLM node turns out to need deterministic behavior
Watch for these signals that architecture needs revisiting:
- A node's prompt is over 100 lines
- A single node is doing more than one conceptually distinct thing
- Debugging a failure requires tracing through more than 3 nodes to find root cause
- Adding a new feature requires changing 4+ files
When these appear, revisit the relevant decision rather than adding more complexity on top.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

