End-to-End Architecture Design (Input to Feedback Loop)
Reference architecture (design guidance; components are verified Claude capabilities)
1Input -> Intake & validation -> Context assembly -> Orchestration -> Tools / integrations2 | |3 Model + prompt <----------+-----------------+4 |5 Output validation -> Guardrails / human review -> Delivery6 |7 Logging & telemetry -> Evaluation -> Feedback -> Change| Layer | Responsibilities | Claude features (verified) |
|---|---|---|
| Intake and validation | Authenticate, size-limit, screen for abuse, normalise | Haiku-class screening with structured output (see D5.2); token counting API |
| Context assembly | Retrieve, rank, trim; assemble system, tools, documents | Search-result blocks and citations; memory tool; compaction and context editing; prompt caching |
| Orchestration | Workflow or agent; subagents; retries; budgets | Agent SDK loop, subagents, hooks, maxTurns, maxBudgetUsd |
| Model and prompt | Pick tier and effort; versioned prompt | Model lineup and effort levels (D2.5) |
| Tools and integrations | Business systems, search, code execution | Tool use, strict tool use, MCP, tool search |
| Output handling | Schema, business-rule validation, citations | Structured outputs; validation and retry (CCAR-F 4.4) |
| Safety and oversight | Guardrails, approvals, audit | Hooks (PreToolUse deny/ask/defer), permissions, sandboxing |
| Observability | Traces, metrics, cost, quality | OpenTelemetry export, usage fields (D3.4) |
| Evaluation and feedback | Regression suite, drift checks, user feedback | Held-out evals, LLM-based grading (D4.1) |
The feedback loop is part of the design
Log every request with the model, prompt version, tool calls, stop reason, token usage and outcome. Turn failures and user corrections into new evaluation cases. Re-run the suite on every prompt, tool or model change. Without this, quality decays silently (D6.5).
Cross-cutting decisions
- Sync vs async: user waiting = real-time API with streaming; backlog work = Batches at 50% (verified, up to 24 hours).
- Cost levers: prompt caching first (Anthropic measured it as usually the largest lever), then effort, tier, trimming.
- Failure behaviour: what the user sees when a tool, model or validator fails (5.3 error propagation).
- Security boundary: keep credentials outside the agent's environment; least privilege (D3.2).
Exam traps
- Designing only the happy path, with no failure, escalation or rollback.
- No telemetry or evaluation loop, so nothing improves.
- One model for every step regardless of difficulty.
- Putting secrets in the prompt or the agent's reach.
- Using real-time calls for bulk back-fills.
References
- Building effective agents — checked Oct 16, 2026
- Agent SDK overview — checked Oct 16, 2026
- Observability with OpenTelemetry (Agent SDK) — checked Oct 16, 2026
- Prompt caching — checked Oct 16, 2026
- Batch processing — checked Oct 16, 2026
- Structured outputs — checked Oct 16, 2026
- Define success criteria and build evaluations — checked Oct 16, 2026
Check your understanding
Name the components that turn production failures into improvements.Show answerHide answer
Answer
Logging and telemetry, evaluation cases built from failures, regression runs on every change.Where do credentials belong relative to the agent?Show answerHide answer
Answer
Outside its security boundary, injected by a proxy.Bulk re-classification overnight: sync or batch?Show answerHide answer
Answer
Batch (cheaper, asynchronous).