Logo van Agent Architecture Design

Agent Architecture Design

Community
selvarajmurugesan90
agent-architecture-design

Guides designing the control loop, state/memory model, and tool boundaries for an LLM-driven agent. Use when a user asks to "design an agent architecture," choose between a ReAct loop / plan-and-execute / finite-state agent, decide on single-agent vs multi-agent decomposition, define how an agent should manage state and memory across turns, or review whether an existing agent's control flow is safe to run unattended.

Overzicht

Uitgeverselvarajmurugesan90
Repositoryops-engineering-skills
Skillnaamagent-architecture-design
Sterren
44
Forks
18
Meegeleverde bestanden
Alleen instructies
LicentieApache-2.0
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Compleet zonder extra bestanden

    Alles wat het model nodig heeft, staat in de instructies — geen extra bestanden om te synchroniseren.

  • Open source

    Gepubliceerd door selvarajmurugesan90 op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Agent Architecture Design in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/selvarajmurugesan90/ops-engineering-skills/tree/main/plugins/ai-agent/skills/agent-architecture-design
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/selvarajmurugesan90/ops-engineering-skills.git /tmp/ops-engineering-skills
mkdir -p .claude/skills
cp -r /tmp/ops-engineering-skills/plugins/ai-agent/skills/agent-architecture-design .claude/skills/agent-architecture-design
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Agent Architecture Design in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Agent Architecture Design automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Agent Architecture Design niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

Agent Architecture Design

Purpose

An "agent" is a loop: an LLM repeatedly observes state, decides on an action (call a tool, ask the user, or finish), and updates state based on the result, until some termination condition is met. Getting this loop's shape wrong is the single biggest source of production incidents in agentic systems — not model quality. Agents that loop forever, that accumulate unbounded context, that hold too many high-privilege tools in one prompt, or that have no checkpoint for a human to intervene, fail in ways that are expensive, hard to debug, and sometimes destructive. This skill defines a small set of proven architecture patterns (ReAct-style loop, plan-and-execute, finite-state/graph) and the state, memory, and control-flow decisions that make an agent safe and debuggable to operate, independent of which model or vendor SDK is driving it.

When to use

  • Starting a new agent project and deciding "should this be one prompt with tools, a ReAct loop, or a directed graph of steps?"
  • An existing agent occasionally loops, stalls, or takes an unexpected destructive action, and you need to redesign its control flow.
  • Deciding whether a task needs one agent with many tools or several narrower agents (see multi-agent-orchestration).
  • Designing how an agent's memory persists across sessions (vs. what lives only in the current context window).
  • Code review of an agent's main loop before it is given write access to production systems (files, cloud APIs, payment systems, ticketing).
  • Adding a human-in-the-loop approval checkpoint to an agent that currently runs fully autonomously.

Prerequisites & environment

  • Working knowledge of an LLM API that supports structured tool/function calling (the concept is portable across Anthropic, OpenAI, Google, and open models — exact request/response shapes differ by vendor).
  • A chosen orchestration surface: a raw API loop you write yourself, or a framework/runtime (e.g. an agent SDK, LangGraph-style graph runtime, or a CLI agent host like Claude Code). This skill is framework-agnostic; adapt the patterns to whichever runtime you use.
  • Access to the tools/APIs the agent will call, ideally in a sandboxed or staging environment before granting production credentials.
  • A way to capture traces/logs of each loop iteration (even a structured log file is enough to start).

Step-by-step guidance

  1. Write down the termination condition before writing any prompt. Every agent loop needs an explicit "done" signal: a tool call that means completion, a structured final-answer format, or a supervisor check. If you cannot state in one sentence how the loop knows to stop, do not start building.

  2. Pick a control-flow pattern that matches the task's shape:

    • ReAct-style loop (reason → act → observe, repeat): best for open-ended tasks where the next step genuinely depends on the last tool result (debugging, research, exploratory coding).
    • Plan-and-execute: the model first emits a multi-step plan, then a (possibly separate, cheaper) executor runs each step; best when steps are largely independent and you want a reviewable plan before any action runs.
    • Finite-state / graph: fixed set of named states and explicit transitions (e.g. triage → gather_info → draft → approve → send); best for compliance-sensitive or repeatable business processes where you want to reason about which states can reach which other states.
  3. Bound the loop explicitly. Set a hard maximum iteration count and a wall-clock timeout, independent of the model's own judgment about when it's done. Fail closed (stop and surface an error) rather than fail open (silently keep going or silently give up and claim success).

    python
    MAX_ITERATIONS = 12
    TIMEOUT_SECONDS = 180
    
    def run_agent_loop(task, tools):
        start = time.monotonic()
        for i in range(MAX_ITERATIONS):
            if time.monotonic() - start > TIMEOUT_SECONDS:
                return AgentResult(status="timeout", partial=state.transcript)
            response = llm.call(messages=state.messages, tools=tools)
            if response.stop_reason == "end_turn":
                return AgentResult(status="done", output=response.text)
            if response.stop_reason == "tool_use":
                for call in response.tool_calls:
                    result = dispatch_tool(call, allowlist=tools)  # see agent-tool-use-patterns
                    state.messages.append(tool_result_message(call, result))
        return AgentResult(status="max_iterations_exceeded", partial=state.transcript)
  4. Design the state/memory model as two tiers. Keep a small working state (current task, plan, last N tool results) that lives in the context window, and a separate persisted memory (a database, vector store, or file) for anything that must survive across sessions or is too large to keep in-context. Never treat the raw conversation transcript as your only memory store — it grows unbounded and degrades reasoning quality long before it hits a hard token limit.

  5. Define tool boundaries per agent, not per task. List every tool the agent can call and classify each as read-only, reversible-write, or irreversible-write. Irreversible-write tools (send email, delete resource, execute payment) should require either a dedicated confirmation step in the state machine or a human-in-the-loop gate — do not rely on prompt instructions alone to prevent misuse.

  6. Add a human checkpoint at the highest-leverage point, not everywhere. For a finite-state design, this is usually a dedicated state (awaiting_approval) the graph cannot exit without external input. For a ReAct loop, it's a policy check inside dispatch_tool that intercepts specific tool names.

  7. Instrument before you optimize. Log, at minimum: the input to each LLM call, the tool calls it emitted, the tool results, and the final stop reason. Without this, pitfalls like loops and context bloat are invisible until they cause an incident.

  8. Decide single-agent vs multi-agent last, not first. Start with the simplest single agent with a well-scoped tool set; only split into multiple agents once you have concrete evidence of context overload, role confusion, or the need for parallel independent workstreams (see multi-agent-orchestration for when that split is justified).

Best practices

  • Treat the agent loop's termination and iteration cap as safety-critical code, not a minor implementation detail — review it like you would review authentication logic.
  • Prefer fewer, well-scoped tools over many overlapping ones; tool proliferation increases both hallucinated tool calls and prompt size (see agent-tool-use-patterns).
  • Keep the system prompt's description of "what this agent is for" narrow. A narrowly scoped agent is both easier to evaluate and less prone to scope creep mid-task.
  • Make every state transition in a finite-state design observable externally (emit an event), so a supervising process or human can watch progress without parsing free-text output.
  • Separate "planning" model calls from "execution" model calls when cost or latency matters — a cheaper/faster model can often execute a well-specified plan step, reserving the strongest model for planning and ambiguous judgment calls (see llm-cost-and-latency-optimization).
  • Version your system prompt and tool schemas together; a tool schema change without a matching prompt update is a common source of silent regressions.
  • Design for idempotent retries: if a tool call's result is ambiguous (e.g. a network timeout after a write), the agent should be able to safely check current state rather than blindly retrying a non-idempotent action.

Common pitfalls

  • Symptom: Agent runs for minutes issuing tool calls that don't make progress, eventually timing out or exhausting a rate limit. Fix: Enforce a hard iteration cap and a "no progress" detector (e.g. compare the last two tool calls; if identical, break and surface the stall rather than retrying silently).

  • Symptom: Agent's context window fills with entire raw outputs of every tool call (full file contents, entire API responses), degrading reasoning quality on later turns even though the token limit hasn't been hit yet. Fix: Summarize or truncate tool results before appending to state; keep only what later steps actually need, and move anything bulky to persisted memory that can be fetched again on demand.

  • Symptom: A single "god agent" with 30+ tools spanning unrelated domains (billing, infra, customer messaging) occasionally calls the wrong tool for a superficially similar request. Fix: Split by domain into narrower agents or narrower tool subsets activated per task, rather than exposing the full tool surface on every call.

  • Symptom: An irreversible action (e.g. deleting a cloud resource, sending a customer email) executes because the agent "decided" the task was done, with no external checkpoint. Fix: Move irreversible tools behind an explicit approval state or a policy layer in the dispatcher, never rely on prompt wording ("ask before deleting") as the only safeguard.

  • Symptom: Errors from a tool call are swallowed and the agent reports success anyway. Fix: Propagate tool errors into the next model turn as explicit failure content (not silently retried or hidden), and require the loop's terminal state to distinguish done, failed, and partial.

Worked example

Task: an internal agent that triages incoming support tickets, drafts a reply, and — only after a human approves — sends it.

Finite-state design:

states:
  triage:        classify ticket category + urgency (read-only tools: search_kb, get_ticket)
  gather_info:   pull account/order history if category requires it (read-only tools)
  draft_reply:   produce a draft reply grounded in gathered context
  awaiting_approval:  present draft to a human reviewer; no tools available here
  send:          call send_reply tool (irreversible-write, only reachable from awaiting_approval)
  escalate:      hand off to a human agent directly (terminal state, no send)

transitions:
  triage -> gather_info | escalate
  gather_info -> draft_reply | escalate
  draft_reply -> awaiting_approval
  awaiting_approval -> send | draft_reply (reviewer requests changes)

Loop bound: max 6 state transitions per ticket, 60s timeout per LLM call. Every transition emits a ticket.state_changed event with ticket id, from state, to state, and the tool calls made in that state — this is what an observability dashboard and later agent-evaluation-and-guardrails checks consume. The send state is the only place send_reply (an irreversible-write tool) is even present in the tool list passed to the model, so a prompt-injection attempt from ticket content cannot cause a send from an earlier state — the tool literally isn't offered.

Cross-references

Veelgestelde vragen

Wat doet de AI-skill Agent Architecture Design?

Guides designing the control loop, state/memory model, and tool boundaries for an LLM-driven agent. Use when a user asks to "design an agent architecture," choose between a ReAct loop / plan-and-execute / finite-state agent, decide on single-agent vs multi-agent decomposition, define how an agent should manage state and memory across turns, or review whether an existing agent's control flow is safe to run unattended.

Waarom Agent Architecture Design gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Agent Architecture Design bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Agent Architecture Design in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/selvarajmurugesan90/ops-engineering-skills/tree/main/plugins/ai-agent/skills/agent-architecture-design. TypingMind leest het bestand SKILL.md en installeert het als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Agent Architecture Design gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Agent Architecture Design gebruiken?

Zoveel als je wilt. Je kunt Agent Architecture Design gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Agent Architecture Design gratis?

Ja. Deze skill is door selvarajmurugesan90 op GitHub gepubliceerd onder de licentie Apache-2.0. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇