AWS Builder Center
The Building Blocks That Outlive Your Agent Framework

The Building Blocks That Outlive Your Agent Framework

For software engineers building agents.

The Building Blocks That Outlive Your Agent Framework

For software engineers building agents.


Pick any agentic framework from eighteen months ago. Half of them have either pivoted, merged, or been made redundant by the model improvements that shipped in the meantime.
This is the nature of the space right now. Frameworks are hypotheses about how models will behave. Models improve. The hypothesis expires.
But some things don’t change. This post is about those things.



Nouns and Verbs

Before building anything, apply three questions:
Is it a noun or a verb? "Search documents" — noun. "Route research questions to the retrieval agent" — verb.
Can you describe its contract without referencing a specific model or framework? "Accepts a search query, returns ranked results with source citations" — yes. "Uses framework X's RetrievalChain" — no.
Does it compose without a mediator? "The model uses the search tool and the code execution tool in the same turn" — yes. "The router must classify the query before dispatching" — no.
All three yes → primitive. Invest deeply. It will outlive your current framework and your next model upgrade.
Any no → implementation detail. Keep it thin and replaceable.
The core claim: invest in nouns — tools, skills, memory, data access, streaming. Keep verbs thin — routing, classification, orchestration. The nouns encode what your system can do. The verbs encode how it decides. Better models make better decisions. When you upgrade the model, the verbs become redundant. The nouns remain.



The 5 Durable Primitives

Tool — The Unit of Capability

Why it matters: Every capability your agent has lives in a tool. A bad tool description means the model calls the wrong tool. A leaky tool boundary means an attacker can access data through the agent that they couldn't access directly.
A tool is a function with a name, a natural-language description, a typed input schema, and a typed output. It sits at the boundary between the AI system and the external world.
The model changes. The database does not. The framework changes. The API endpoint does not.
The description is load-bearing. A vague description means the model calls the wrong tool at the wrong time. A precise description means the model composes tools correctly without a router — because the model's reasoning is the router. This is the Unix philosophy applied to AI: small, focused tools that compose freely through a reasoning engine.
One tool, one capability. Descriptions written for a smart engineer who hasn't seen your system. Input schemas strict — enums, required fields, descriptions. Output self-describing — named fields. Idempotent where possible, because models retry.
Litmus test: Give only the tool's name, description, and schema to an engineer who has never seen your system. Can they predict exactly what it does and what it returns? If not, the contract is underspecified.
Durability test: Can you swap the underlying model and keep the tool definition unchanged? If yes, it's a primitive.

Skill — Declarative Domain Knowledge

Why it matters: A general-purpose model with no domain context produces general-purpose answers. The gap between a useful agent and a generic chatbot is almost entirely explained by skill quality.
A skill is a bundle of domain knowledge, behavioral instructions, and constraints injected into the model's context for a specific task domain. It is not code. It is declarative context.
The difference between a tool and a skill: a tool does something; a skill knows something. A web search tool fetches pages. A knowledge base skill tells the model which sources are authoritative, how to evaluate conflicting results, and what the domain terminology means.
Skills are durable because domain knowledge changes slowly. The schema doesn't change when you upgrade models. Business rules don't change when you migrate frameworks. The skill travels with your system.
Anthropic's context engineering research identifies context quality as the primary lever for agent performance — more impactful than orchestration complexity. Your competitive advantage isn't the model. It's the domain knowledge you've encoded in skills.
Skills compose by stacking. Multiple skills can be active simultaneously. The model synthesizes their instructions without a mediator.
Litmus test: Can you run five test cases with and without the skill and measure a quality difference? If the skill's impact isn't measurable, it's not earning its token budget.

Memory — State Across Time

Why it matters: Without memory, every session is the agent's first. With it, the agent builds context across weeks of interactions. The quality of retrieval — not the volume of storage — is what separates useful memory from noise.
Memory is what allows an agent to operate across time. Without it, every interaction starts from zero. With it, the agent knows your preferences, what you asked last week, and what it already tried.
Three layers, each with different lifecycles:
Layer
Stores
Retrieved when
Session
Current conversation, tool results
Every turn
Episodic
Summaries of past sessions
When relevant to current query
Semantic
Extracted facts and preferences
By similarity
The primitive here is retrieval quality, not storage volume. An agent with 10 well-retrieved memories outperforms one with 1,000 poorly retrieved ones. Design around retrieval quality, not storage volume.
Memory quality is a prerequisite for autonomy expansion. An agent at low autonomy can survive with naive memory — a human catches errors. An agent operating autonomously runs for hundreds of turns. Naive memory fills the context window with noise, degrading decisions with no human to catch them. Autonomy must not outpace memory quality.
Litmus test: After 50 turns, does your agent surface the right prior context when asked about something from earlier in the conversation? If it retrieves nothing or retrieves irrelevant history, your retrieval strategy needs work before you expand autonomy.

Data Access Control — Enforced at the Data Layer

Why it matters: An agent that can access data a user shouldn't see is a data breach with extra steps. Enforcement at the prompt layer is not enforcement.
Data access control ensures an agent only accesses data the requesting user is authorized to see. The enforcement point is the data layer — not the system prompt.
Relying on prompt instructions like "only show data for the current user" is a polite request, not a security boundary. Models hallucinate. Models can be manipulated. Prompt-layer access control is not access control.
The contract: enforce the scope at query time, before execution. User identity propagates from the entry point through the entire call chain. Every query is scoped before it touches the database. The model never sees out-of-scope data.
Authorization requirements are determined by business policy, not AI architecture. When you add more agents, the rules don't change. When you upgrade the model, the rules don't change. When you migrate frameworks, the rules don't change. The tool carries the enforcement — not the prompt.
Litmus test: Remove all access-control-related text from your system prompt. Does the system still enforce authorization correctly? If removing prompt text breaks your security model, you don't have a security model.

Streaming Protocol — The Agent-to-Consumer Contract

Streaming is what makes autonomy tolerable.
When an agent takes 60+ seconds to complete a task across multiple tool calls, users cannot see a blank screen. They will assume it broke and cancel — creating orphaned side effects, duplicate resources, user frustration. Streaming is not optional for agentic systems that take meaningful time to operate.
The contract: typed event types (content, tool start, tool result, progress, error, final), ordering guarantees, a terminal event that closes the stream, and error handling mid-stream.
Structured streaming is more useful than raw text streaming. The UI can render progress, show which tool is running, and display partial results. The event types are the protocol's API — version them.
Litmus test: Can a new UI team build a client from your event type documentation alone, without reading server code? If they need implementation details to understand the protocol, the contract is underspecified.



The Growth Path

Every agentic system follows this path — or should. Two axes run through it independently.
Architecture (Stages 1–4): How many agents, how they coordinate. Autonomy (Gates 0–4): How much the agent does without asking.
These are not the same dial. A Stage 1 single-agent system at Gate 4 is more autonomous than a Stage 4 multi-agent ecosystem at Gate 0. Architectural complexity does not produce autonomy. Primitive quality and a mature trust policy do.

Stage 1: Single Agent + Tools

Start here. Always.
A single agent with a well-chosen model, a focused system prompt, and a set of well-designed tools handles a remarkable range of tasks. The model's native reasoning provides routing, planning, and error recovery. You don't need to build those things separately.
What you do not build at Stage 1: routers or classifiers, multiple specialized agents, inter-agent communication protocols, orchestration graphs.
The common mistake: jumping to multi-agent because it sounds more sophisticated. A single agent with 10 well-designed tools consistently outperforms five agents with two tools each. Inter-agent coordination has real costs — latency, context loss, error propagation, and debugging complexity that compounds.
You know you need Stage 2 when:
  • A single query requires 8+ tool calls with branching logic, and intermediate results are polluting the context window, degrading later reasoning
  • Independent subtasks execute sequentially when they could run in parallel
  • You find yourself writing "ignore the previous tool results, focus on this" — a sign the context is too noisy for one agent

Stage 2: Dynamic Workers

The first scaling step is not specialized agents. It is giving your single agent the ability to spawn dynamic workers — temporary, focused agents that handle subtasks with clean context.
Dynamic workers are defined by the query, not a static role. They are disposable. They inherit the parent's tools and data access scope, but not its full conversation history. The parent receives their output as a tool result and synthesizes.
The common mistake: creating permanent agents when temporary workers suffice. Every permanent agent is a maintenance commitment. Dynamic workers are disposable. The spawn mechanism itself is the primitive — thin and replaceable.
Reversibility test: Remove the spawn mechanism. Are you cleanly back to Stage 1 with no residue? If yes, Stage 2 is healthy. If removing it would require a rewrite, orchestration has leaked into your primitives.
You know you need Stage 3 when:
  • The same worker configuration is spawned for more than 20% of queries
  • A specific task domain needs a different model, different tools, or a skill payload so large it would dilute other domains

Stage 3: Hardened Specialists

Only after you have usage data — real queries, real failure modes, real performance metrics — should you harden a pattern into a specialized agent. All four criteria must be met:
  1. Frequency — the pattern handles >20% of queries
  1. Stability — the pattern has not changed significantly in 3+ months
  1. Differentiation — the pattern genuinely benefits from a different model, different tools, or different skills
  1. Isolation — the pattern's context requirements conflict with other patterns
If any criterion is not met, keep it as a dynamic worker or a skill.
The common mistake: hardening too early. A pattern stable for three weeks is not stable. A pattern handling 5% of queries is not frequent enough to justify the maintenance commitment.
Reversibility test: Can you dissolve the specialist back into a skill plus worker configuration on the general agent? The tools and skills survive; only the agent boundary is removed.

Stage 4: Ecosystem

The end state is not a multi-agent system. It is an ecosystem — a self-reinforcing system where new capabilities emerge from composition of existing primitives.
The general agent from Stage 1 becomes the orchestrator and the handler of last resort. It routes known patterns to specialists and handles everything else — the innovation surface where new tools and skills are tested before hardening.
The growth cycle: a novel query arrives and the dynamic layer handles it. The pattern repeats and a skill captures it. When hardening criteria are met, a specialist forms. The dynamic layer continues handling novel queries. No big-bang redesign at any step.
A healthy ecosystem: 10–30% of traffic handled dynamically. Below 10% means the system has hardened too aggressively and can't absorb new patterns. Above 30% means not enough patterns have been promoted to specialists.



Progressive Autonomy: The Trust Ladder

The jump from a chatbot to a single agent with tools is an architecture change. The jump from Stage 1 to fully agentic is a policy change — expanding what the agent may do without asking — combined with primitive quality improvements. No rewrite required.
Gate
Policy
Prerequisite
0
Approve everything
None — start here
1
Read autonomy
Data access control verified at the tool layer, not the prompt layer
2
Safe writes
Idempotent write tools, rollback verified, scope-limited
3
Scoped execution
Memory quality holds at 50+ turns; streaming shows progress in production
4
Full autonomy with exception reporting
Full eval suite at ~100% pass rate; error rate flat across session length
Each gate is a policy table update, not a code change. The human-in-the-loop mechanism stays the same. What changes is what triggers it.
The most capable production agents — coding assistants that edit files, run tests, fix errors, and commit code across multi-hundred-turn sessions — are architecturally Stage 1–2 systems. What makes them "fully agentic" is not architectural complexity. It is the quality of their primitives and how far they've expanded the trust boundary.



Evaluation: The Discipline That Validates Every Transition

Primitives are what you build. Evaluation is how you know they're ready. Every stage transition and every gate expansion should be answerable with a metric, not a feeling.
Build evals before building capabilities. The eval defines success. Then iterate until the agent passes. This is test-driven development for agentic systems — it forces precise requirements, catches regressions when you upgrade models, and makes architectural transitions defensible.
What to evaluate at each primitive:
Primitive
What to measure
Grader type
Tool
Correct invocation, right parameters, error handling
Code-based
Skill
Output quality delta with/without skill
Model-based A/B
Memory
Retrieval relevance at turn 5, 20, 50, 100
Code + model
Data access
Scope enforcement — no out-of-scope data returned
Code-based (adversarial)
Streaming
Event ordering, terminal event, client renderability
Code-based
The failure mode of skipping evals: premature stage and gate transitions. You move to Stage 2 because "it feels like we need workers" without measuring whether single-agent quality actually degrades on complex queries. You expand to Gate 3 because "the agent seems reliable" without verifying memory quality at 50 turns. Architecture decisions made on intuition instead of measurement.
The litmus test: Can you answer "why did we move to Stage 2?" with a metric? Can you answer "why did we open Gate 3?" with a test suite result? If the answer is "it seemed like the right time," you skipped evaluation.



Failure Modes

Over-classification. The intent taxonomy becomes the product. You start with 3 categories, grow to 15, then 30. Each needs training data and edge case handling. Meanwhile, a single agent with good tools would handle the same queries through tool descriptions alone. The tell: your team spends more time debating category boundaries than improving tool quality.
Premature multi-agent. Five agents for a one-agent problem. Each has 2–3 tools. You can describe what each agent does in one sentence — and those sentences could all be tool descriptions on a single agent. Inter-agent coordination adds latency, context loss, and failure modes that compound.
Premature autonomy. Expanding the trust boundary before the primitives support it. Gate 3 execution permissions with Gate 0 memory — the agent forgets what it already tried and retries the same failing command. Gate 4 autonomy without streaming — users cancel long-running operations because they can't see progress, creating orphaned side effects. The tell: error rates increase with session length. Users restart sessions to "fix" the agent.
Prompt coupling. Changing one prompt breaks three agents. Shared context copy-pasted instead of extracted into a skill. The tell: a prompt change requires a "blast radius" analysis.
Framework lock-in. Primitives tangled with framework internals. Your tools import framework-specific base classes. The tell: estimating a framework migration takes more than a week.
Memory hoarding. Context window filled with low-relevance history. Every turn stored, every memory loaded. Retrieval quality degrades as volume grows. The tell: response quality decreases over long sessions. The agent was better at turn 3 than turn 30.



Where to Put Your Engineering Time

Area
Recommended allocation
Tools and data access
~40%
Skills and domain knowledge
~25%
Memory and state
~15%
Streaming protocol
~10%
Orchestration and routing
~10%
If you're spending more than 10–15% on orchestration, that's investment going into verbs instead of nouns. The orchestration will be rewritten. The tools and skills will not.
Deep investment (3+ year horizon): tool contracts, testing, observability, versioning; skills with evaluation sets and A/B testing; memory retrieval strategy and eviction; data access enforcement and audit. These are durable. Models are commodities. Your domain knowledge encoded in skills and tools is your competitive advantage.
Thin investment (expect replacement): routing logic, model selection wiring, orchestration patterns, agent definitions. Keep them in configuration, not code.



Conclusion

The frameworks will keep changing. The models will keep improving. The orchestration patterns you're using today will look dated in 18 months.
A tool with a tight contract will still be useful. A skill encoding domain knowledge will still be accurate. Memory that retrieves the right context will still help the model reason correctly. Access control enforced at the tool boundary will still be secure.
Build the nouns. Keep the verbs thin.


Building something where this framework breaks down? Or a case where premature multi-agent or premature autonomy caused real problems? Post it in the comments.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article