# AI agent architecture: skills and a loop, not roles

URL: https://sdclabs.com/blog/ai-agent-architecture/

> AI agent architecture that works: one agent with skills, a run, verify, learn loop, and subagents only for parallel work or a fresh-context checker.

# AI agent architecture: skills and a loop, not an org chart of role agents

[Mykhailo Poliarush](https://sdclabs.com/author/poliarush/) 2026-12-0413 min read

**AI agent architecture** is how you arrange models, instructions, tools and checks so agents finish real work. The pattern that holds up best is not a team of role agents. It is one agent that loads skills when a task needs them, works inside a run, verify, learn loop, and splits into subagents only for technical reasons.

My feed is full of AI agent teams right now. A PM agent. An architect agent. A QA agent. Each has a markdown file that starts with "You are a senior…". I think it is the wrong approach. It is an org chart pasted onto something that does not work like people.

A job title tells the agent who to be. It does not tell it how to do anything, and it does not check if the result was any good. After running agents on my own projects, I would build a different AI agent architecture: skills and a loop. In 2026, Anthropic, Google Research and Cognition published evidence that points the same way.

## What is AI agent architecture?

Every agent has the same core parts: a model, instructions and tools, running in a loop until it reaches a stop condition. We cover those components in [how to build AI agents](https://sdclabs.com/blog/how-to-build-ai-agents/) . The AI agent architecture question this post answers is the next one: how do you divide the work?

There are two common answers:

- **Roles.** Several agents, each named after a job (planner, developer, tester, reviewer), passing work down a chain.
- **Skills and a loop.** One agent with a library of skills it loads on demand, a verification step after every run, and a written record of what went wrong.

Microsoft's [Azure Architecture Center guide to AI agent orchestration patterns](https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/ai-agent-design-patterns) (updated 12 February 2026) sets a default for any AI agent architecture: "Use the lowest level of complexity that reliably meets your requirements." It calls a single agent with tools "often the right default for enterprise use cases."

## Why do role-based AI agent teams fall short?

Every handoff between roles costs tokens and loses context. Anthropic has documented both.

In its January 2026 guide to [building multi-agent systems](https://claude.com/resources/articles/building-multi-agent-systems-when-and-how-to-use-them) , Anthropic describes teams that built "separate agents for planning, execution, review, and iteration, only to discover that they suffered from lost context at each handoff and spent more tokens coordinating than executing." In its testing, multi-agent implementations "typically use 3-10x more tokens than single-agent approaches for equivalent tasks" ([Anthropic](https://claude.com/resources/articles/building-multi-agent-systems-when-and-how-to-use-them) ).

One experiment tested roles directly. "In one experiment with agents specialized by software development role (planner, implementer, tester, reviewer), the subagents spent more tokens on coordination than on actual work." Anthropic calls the effect a "telephone game": each handoff degrades what the next agent knows.

In October 2026, Anthropic's Applied AI team described the pattern behind it. Enterprises "give each team or problem type its own subagent, with the agent architecture becoming a copy of their org chart (Conway's law at work)" ([Anthropic](https://claude.com/resources/articles/building-agents-when-to-fold-subagents-into-your-main-agent-loop) ). Across several enterprise deployments, "a single agent with skills frequently outperformed both the one-prompt-for-everything design and the subagent design on quality, and often at a lower cost and latency per task." One customer saw a roughly 2x faster runtime with a single agent loop ([Anthropic](https://claude.com/resources/articles/building-agents-when-to-fold-subagents-into-your-main-agent-loop) ). These are vendor observations, not a controlled study, but they come from the company that sells the multi-agent tooling.

You are paying for theater. I have spent years building products and watching teams argue about roles instead of fixing how work gets done. It is funny to see us repeat it in markdown.

### Does "You are a senior engineer" make an agent better?

Not at getting answers right. In the Wharton Generative AI Labs [Prompting Science Report 4](https://arxiv.org/abs/2512.05858) (5 December 2025), researchers tested six models on graduate-level questions from GPQA Diamond and MMLU-Pro. "Persona prompts generally did not improve accuracy relative to a no-persona baseline." Matched expert personas had no significant effect, with one exception (Gemini 2.0 Flash), and low-knowledge personas often reduced accuracy.

The study measured multiple-choice accuracy, not agent tasks, and the authors note that personas may still change tone. Cognition, the company behind the Devin coding agent, puts it bluntly in [its April 2026 post](https://cognition.com/blog/multi-agents-working) : prompt engineering encourages "gimmicky techniques" like "you're a senior software engineer." It argues for [context engineering](https://sdclabs.com/glossary/context-engineering/) instead: giving the model the right information.

## What are agent skills?

**Agent skills** describe how a thing is done: the steps, the tools, and what good looks like. Anthropic, which created the format, defines them as "organized folders of instructions, scripts, and resources that agents can discover and load dynamically to perform better at specific tasks" ([Anthropic, October 2025](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills) ). It compares writing a skill to "putting together an onboarding guide for a new hire."

Skills are the first half of this AI agent architecture, and the difference from a role is simple. An onboarding guide tells a new hire how the work is done here. A job title does not. For the file format, loading rules and how to test a skill, see our guide to agent skills.

Skills load in stages, which the [Agent Skills specification](https://agentskills.io/specification) calls progressive disclosure:

1. **Metadata (about 100 tokens).** The name and description of every skill load at startup.
1. **Instructions (under 5,000 tokens recommended).** The full SKILL.md body loads only when a task matches the description.
1. **Resources (as needed).** Scripts, references and templates load only when required.

Anthropic published the format as an open standard in December 2025. OpenAI's Codex documentation also describes [skills as a directory with a SKILL.md file](https://developers.openai.com/codex/skills) that uses progressive disclosure.

### Agent skills vs tools: what is the difference?

A **tool** is an action the agent can take: run a command, query a database, call an API. A **skill** is the procedure for a task: which tools to use, in what order, and how to tell the result is right. Tools are verbs. Skills are the know-how that strings them together.

### What does a skill file look like?

Here is a short skill for adding an [end-to-end test](https://sdclabs.com/glossary/end-to-end-testing/) with CodeceptJS, the open-source framework SDCLabs founded. The frontmatter follows the specification's rules: a lowercase hyphenated name that matches the folder, and a description that says what the skill does and when to use it. We checked it against those rules with a script.

--- name: add-e2e-test description: Adds an end-to-end test for a user flow with CodeceptJS and runs it. Use when a feature is built or changed and needs proof that it works in the browser, or when someone asks for an E2E test. --- # Add an end-to-end test ## Steps 1. Read the feature's acceptance criteria. If there are none, ask for them before writing code. 2. Find an existing test for a similar flow in tests/e2e/ and follow its structure. 3. Write one scenario per user flow in tests/e2e/<feature>_test.js and tag it @<feature>. 4. Run it: npx codeceptjs run --grep "@<feature>" 5. If it fails, read the error and the failure screenshot, fix the cause and run again. Stop after 3 failed runs and report what you tried. ## What good looks like - The test checks what the user sees (I.see, I.seeInCurrentUrl), not internal state. - It passes 3 runs in a row. - It fails when the feature change is reverted. ## Known mistakes Read lessons.md in this folder before you start. When a run fails for a new reason, add one line to lessons.md.
Notice what is missing: no "You are a senior QA engineer." The skill carries the procedure, the definition of done and the memory of past mistakes.

## What is an agentic loop, and why run, verify, learn?

An **agentic loop** is the cycle an agent repeats until the work is done. It is the second half of this AI agent architecture. The version that improves over time has three steps:

1. **Run.** The agent does the task with the relevant skills loaded.
1. **Verify.** Checks the agent cannot edit decide whether the result passes: tests, linters, schemas, a fresh-context reviewer.
1. **Learn.** What went wrong is written down, and the next run reads it.

Without the verify step, agents declare victory early. In its [November 2025 work on long-running agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) , Anthropic saw Claude "mark a feature as complete without proper testing." It did much better once explicitly prompted to test end to end with browser automation, as a user would. Two more fixes kept agents from stopping early or losing track between sessions: a JSON feature list with every feature marked failing at the start, and a progress file plus git history that each new session reads first.

The Claude Code team now treats verification as the core of its process. In a [November 2026 post](https://claude.dev/blog/how-the-claude-code-team-thinks-about-verification) , it says about 90% of its code is written and reviewed by Claude, and that "Verification loops are the building block that lets you delegate more work to Claude." In Anthropic's internal testing on structured file generation, a separate grader checking work against a rubric improved task success by up to 10 points over a standard prompting loop ([Anthropic](https://claude.dev/blog/how-the-claude-code-team-thinks-about-verification) ).

The same post describes the learn step. If an agent keeps failing a check, add a hook or a more explicit rule to the project instructions. If a check still fails after three rounds, Claude stops and brings in a person. And: "If a change can modify the check that judges it, the check is broken."

### A minimal run, verify, learn loop in JavaScript

This loop has no dependencies; we ran it on Node.js 22. The agent is a stub, so you can run it as is; replace runAgent with your model call and send lessons.md with the prompt. The checks are plain functions, so a pass means the same thing every time.

// loop.mjs: run -> verify -> learn. Plain Node.js, no dependencies. import { existsSync, readFileSync, appendFileSync } from 'node:fs'; const LESSONS = './lessons.md'; const MAX_ATTEMPTS = 3; // Run. Replace this stub with your model call: send the task plus lessons.md. // The stub writes a summary that is too long until a lesson tells it the limit. async function runAgent(task, lessons) { if (lessons.includes('[max-length]')) { return `${task.title} shows how to structure AI agents with skills and a verification loop.`; } return `${task.title} shows how to structure AI agents with skills, a verification loop, ` + 'and subagents only for parallel work or fresh-context checks.'; } // Verify. Deterministic checks, written before the agent runs. const checks = [ { id: 'max-length', ok: (out, t) => out.length <= t.maxChars, lesson: (t) => `Keep the summary at or under ${t.maxChars} characters.` }, { id: 'keyword', ok: (out, t) => out.toLowerCase().includes(t.keyword), lesson: (t) => `Use the phrase "${t.keyword}".` }, ]; async function loop(task) { for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) { const lessons = existsSync(LESSONS) ? readFileSync(LESSONS, 'utf8') : ''; const out = await runAgent(task, lessons); const failed = checks.filter((c) => !c.ok(out, task)); console.log(`attempt ${attempt}: ${failed.length ? 'failed ' + failed.map((c) => c.id).join(', ') : 'passed'}`); if (failed.length === 0) return out; // Learn. Write down what went wrong, so the next attempt and the next run read it. for (const c of failed) { if (!lessons.includes(`[${c.id}]`)) appendFileSync(LESSONS, `- [${c.id}] ${c.lesson(task)}\n`); } } throw new Error(`No pass after ${MAX_ATTEMPTS} attempts: hand it to a person.`); } console.log(await loop({ title: 'This guide', keyword: 'skills', maxChars: 100 }));
The first run fails the length check on attempt 1, writes - [max-length] Keep the summary at or under 100 characters. to lessons.md, and passes on attempt 2. The second run reads the lesson and passes on attempt 1. That is the whole idea: the mistake is paid for once.

Building agents into a product and want an AI agent architecture that is tested from day one? Our [AI agent development team](https://sdclabs.com/services/ai-agents/) builds agents with an [eval suite](https://sdclabs.com/glossary/ai-evals/) from your own examples, least-privilege tools and human approval for costly actions.

## When should you split work across multiple agents?

In a good AI agent architecture, you split agents for technical reasons only. Never because a company would have had two people there. Two reasons come up again and again:

- **Parallel work.** Independent pieces that can run at the same time, such as research across separate sources. Desktop tools such as [OpenBot](https://sdclabs.com/blog/openbot/) run agents from several providers side by side.
- **A checker with fresh context.** A verifier that judges the result without the history of how it was built. Our Claude Code subagents guide builds and tests one.

Anthropic's [January 2026 guide](https://claude.com/resources/articles/building-multi-agent-systems-when-and-how-to-use-them) lists three situations where multiple agents consistently win: context pollution, parallel tasks, and specialization when one agent has too many tools (often 20 or more) or conflicting instructions. All three are technical limits, not job titles. Its rule for dividing work: split by context, not by type of work, because "an agent handling a feature should also handle its tests." The one pattern it says "consistently works well across domains" is the verification subagent.

Cognition reached the same conclusion from building Devin. Multi-agent systems "work best today when writes stay single-threaded and the additional agents contribute intelligence rather than actions." Its code reviewer works "best when the coding and review agents do not share any context beforehand." Cognition reports that Devin Review catches an average of 2 bugs per pull request, roughly 58% of them severe ([Cognition](https://cognition.com/blog/multi-agents-working) ); that is vendor data.

A controlled study of AI agent architecture explains why task shape matters. In [Towards a Science of Scaling Agent Systems](https://arxiv.org/abs/2512.08296) (Google Research, Google DeepMind and MIT; revised 8 April 2026), researchers ran 260 configurations across six benchmarks and three model families. Compared with a single agent, multi-agent setups ranged from +80.8% on decomposable financial reasoning to -70.0% on sequential planning ([Kim et al.](https://arxiv.org/abs/2512.08296) ). Independent agents amplified errors 17.2 times; a central coordinator that verified work cut that to 4.4 times ([Kim et al.](https://arxiv.org/abs/2512.08296) ). Their model picked the best architecture for 87% of held-out configurations from task properties such as tool count and decomposability ([Kim et al.](https://arxiv.org/abs/2512.08296) ).

### Why do multi-agent LLM systems fail?

A taxonomy built for exactly this question is MAST, from UC Berkeley researchers ([Cemri et al.](https://arxiv.org/abs/2503.13657) , first published March 2025 and revised 26 October 2025, so older than a year). They [built](https://arxiv.org/abs/2503.13657) a taxonomy of 14 failure modes in 3 groups from more than 150 traces, then used it to annotate more than 1,600 traces from 7 popular multi-agent frameworks. The groups are system design issues, inter-agent misalignment, and task verification. In my reading, role chains make two of the three groups worse: more handoffs to misalign, and verification left to another role.

## Roles vs skills and a loop: which AI agent architecture works better?

The table sums up the two options, using the sources above.

|   | Role agents | Skills and a loop |
|---|---|---|
| What the prompt says | Who to be: "You are a senior QA engineer" | How the task is done: steps, tools, what good looks like |
| When instructions load | Always, as an identity | On demand, when a task matches the skill description |
| How quality is checked | Another role reviews, often with partial context | Deterministic checks first, then a fresh-context verifier |
| What it learns | Nothing persists between runs | Failures go into a lessons file or the skill, read next run |
| Context | Split at every handoff | One context, split only at a clean context boundary |
| Token cost | Multi-agent setups use 3-10x more tokens ([Anthropic](https://claude.com/resources/articles/building-multi-agent-systems-when-and-how-to-use-them) ) | Single-agent baseline, plus a verifier when needed |
| Why agents are split | It mirrors the org chart | Parallel work or a checker with fresh context |

## How do you move an AI agent architecture from roles to skills?

You do not need a rewrite. Anthropic's [October 2026 migration advice](https://claude.com/resources/articles/building-agents-when-to-fold-subagents-into-your-main-agent-loop) is to fold subagents in one at a time and measure each step.

1. **Build a small eval set first.** Anthropic notes that "Even a set of 10 golden examples is enough to start" ([Anthropic](https://claude.com/resources/articles/building-agents-when-to-fold-subagents-into-your-main-agent-loop) ). Use real tasks with known good results. Our guide to [AI agent testing](https://sdclabs.com/blog/ai-agent-testing/) covers how.
1. **Rewrite each role prompt as a skill.** Delete "You are a…". Keep the steps, the tools, and the definition of done.
1. **Write the checks before the agent runs.** Tests, linters, schemas and end-to-end runs. Keep them where the agent cannot change them.
1. **Add a lessons file.** The agent reads it at the start and appends a line after every new kind of failure.
1. **Fold one role agent at a time into the main loop.** Compare eval results with and without it, and look at which tasks flipped, not just the total score.
1. **Keep a subagent only for a technical reason.** Parallel work, a fresh-context verifier, or a tool set too large for one agent.
1. **Cap the loop.** Set a maximum number of attempts, then hand the task to a person.

## How SDCLabs can help

SDCLabs has built and tested software since 2011 and founded the open-source testing frameworks Codeception and CodeceptJS. Senior engineers run AI-assisted workflows, and automated tests verify every change before it ships. That is the same principle as the loop above: the check decides, not the title.

Our [AI agent development](https://sdclabs.com/services/ai-agents/) service builds agents into your product with scoped tools, evals that score every change, and tracing for every run. Not sure which AI agent architecture your use case needs, one agent or several? An [AI readiness assessment](https://sdclabs.com/services/ai-readiness-assessment/) reviews your processes, data and systems and hands over a roadmap with a first pilot. Engagements start in 1 to 2 weeks.

How are you structuring yours? [Tell us](https://sdclabs.com/contact/) .

## Frequently asked questions

### What is AI agent architecture?

It is how you arrange models, instructions, tools and checks so agents finish real work. The key choice is how to divide the work: role agents that hand off to each other, or one agent that loads skills on demand and runs a run, verify, learn loop.

### What are agent skills?

Folders of instructions, scripts and resources that an agent loads only when a task needs them, defined by a SKILL.md file with a name and description ([Agent Skills specification](https://agentskills.io/specification) ). A skill describes how a task is done; a tool is a single action.

### Should I use a single agent or multiple agents?

Start with one. Split only for technical reasons: parallel work, a verifier with fresh context, or a tool set too large for one agent. Anthropic reports that multi-agent setups typically use 3-10x more tokens for equivalent tasks ([Anthropic](https://claude.com/resources/articles/building-multi-agent-systems-when-and-how-to-use-them) ).

### Does role prompting improve AI agent accuracy?

Not reliably. A Wharton study of six models found that persona prompts generally did not improve accuracy on graduate-level questions compared with no persona ([arXiv](https://arxiv.org/abs/2512.05858) ). Personas may still change tone.

### Why do multi-agent LLM systems fail?

The MAST taxonomy groups 14 failure modes into system design issues, inter-agent misalignment and task verification ([Cemri et al.](https://arxiv.org/abs/2503.13657) ). A Google study found independent agents amplified errors 17.2 times, against 4.4 times with a coordinator that verifies work ([arXiv](https://arxiv.org/abs/2512.08296) ).

#ai-agents#agent-skills#multi-agent-systems#agentic-engineering

[Mykhailo Poliarush](https://sdclabs.com/author/poliarush/) Founder and CEOLeads SDCLabs, an AI development company founded in Krakow in 2011.[LinkedIn](https://www.linkedin.com/in/poliarush/) [GitHub](https://github.com/poliarush)

## Related posts

[
### Best MCP servers for engineering teams (2026): 10 maintained picks, four tested

Ten maintained, official MCP servers for engineering work, with tools, install lines, licenses and limits, plus a security checklist.

AI agentic engineering · 2026-12-04

](https://sdclabs.com/blog/best-mcp-servers/) [
### OpenBot reviewed: a team of AI agents on your desktop, and what the license means for your company

OpenBot (openbot.run) runs Codex, Claude Code and Gemini agents as a team. It is source-available under PolyForm Noncommercial, so commercial use needs a license.

AI agentic engineering · 2026-12-04

](https://sdclabs.com/blog/openbot/) [
### Vercel UI SDK tested: what it adds for agent-built interfaces, and what it costs

Vercel UI SDK is a beta library of 50+ UI behaviors for coding agents. One independent test: about 5 times as long and 3.5 to 6.3 times the cost of plain Claude.

AI agentic engineering · 2026-12-04

](https://sdclabs.com/blog/ui-sdk/)

## Get an estimate for your product.

[Get an estimate](https://sdclabs.com/contact/) [Book a call with the CEO](https://calendly.com/sdclabs/60min)
