Claude Architect Hands-on Labs: 8 Practical Exercises
π In plain words: Reading builds knowledge, but the exam tests judgement, and judgement comes from doing. These eight labs take you from your first API call to a working CI review bot. Each ends with a 'prove it' check so you know when you are ready.
The exam rewards judgement you only build by doing. These eight labs follow the official preparation exercises and cover all five domains. Each ends with a “prove it” check β if you can explain the answer, you’re ready for that topic.
π Key terms
- API key: A secret key that lets your code call Claude. Keep it out of Git.
- SDK: A library that makes calling the API easier, such as
anthropicfor Python. - Pydantic: A Python library that checks data matches a schema.
- GitHub Actions: GitHub's built-in CI system, which runs jobs on each push or pull request.
π The story in this lesson
Each lab builds one small piece of ShopNest: the support bot's loop, invoice extraction, the nightly review batch, the research team, the team's Claude Code setup, a ticket MCP server and Ravi's CI reviewer.
π‘ Think of it like this
The labs are like driving lessons after the theory test. You only really learn when to brake by driving the car.
pip install anthropic, set ANTHROPIC_API_KEY, and install Claude Code from the official docs at code.claude.com. For the Agent SDK use pip install claude-agent-sdk.π Lab 1: Your first calls and stop reasons (45 min)
- Send a basic request; print
stop_reasonandusage. - Set
max_tokens=20on a long answer and observe"max_tokens". - Add a system prompt and compare the behaviour.
Prove it: name every stop_reason and what your code should do for each.
π Real-world example: Where you'd use this at work
Before building ShopNest's bot, Asha's team checks how every stop reason looks in practice, so their code handles max_tokens and refusal properly instead of crashing on the first long answer.
π Lab 2: Agentic loop with structured errors (90 min)
- Define
get_customerandlookup_orderwith detailed descriptions. - Implement the loop on
stop_reason. - Return a transient error (retryable) and a business error (not retryable); watch how Claude reacts.
- Add a code gate: no
lookup_orderuntilget_customerreturns verified.
Prove it: explain the three loop-termination anti-patterns.
π Real-world example: Where you'd use this at work
This is the core of ShopNest's support bot: look up the customer, then the order, and react sensibly when the order service times out (retry) or the refund window has passed (explain).
π§ͺ Lab 3: Structured extraction pipeline (90 min)
- Create a
record_invoicetool with nullable fields, an enum with “other” + detail, and calculated vs stated totals. - Feed an invoice with no PO number β confirm you get
null, not an invented value. - Validate with Pydantic; retry with the document, the failed output and the specific error.
- Add two few-shot examples for different layouts and compare empty-field rates.
Prove it: list which failures retries fix and which they can’t.
π Real-world example: Where you'd use this at work
This is ShopNest's invoice pipeline in miniature. The invoice with no PO number is exactly the case that once produced invented values in production.
π¦ Lab 4: Message Batches (45 min)
- Submit 20 requests with
custom_ids; poll until ended. - Match results by
custom_id(note the order). - Resubmit only the failed IDs after chunking oversized inputs.
Prove it: calculate the submission cadence for a 30-hour SLA.
π Real-world example: Where you'd use this at work
ShopNest's nightly review classification works this way: submit, wait, match the results by custom_id, and resubmit only the failures.
π€ Lab 5: Agent SDK coordinator, subagents and hooks (2 h)
- Define searcher, analyst and synthesizer AgentDefinitions with scoped tools.
- Include
"Task"in the coordinator’s allowedTools; check it emits parallel Task calls in one turn. - Pass findings explicitly as structured JSON with source URL and date.
- Add a PostToolUse hook that normalises dates, and a pre-tool hook that blocks
rm -rf. - Simulate a timeout and return structured error context; confirm the report lists coverage gaps.
Prove it: show that a subagent can’t see the coordinator’s history unless you pass it.
π Real-world example: Where you'd use this at work
This mirrors the carrier-comparison research team, with a safety hook added. When the timeout is simulated, the report must say which section is weaker, not hide the gap.
π§ͺ Lab 6: Claude Code team configuration (90 min)
- Run
/init; add a personal preference in~/.claude/CLAUDE.md; confirm both with/memory. - Create
.claude/rules/testing.mdwithpaths: ["**/*.test.*"]and check when it loads. - Add
.claude/commands/review.mdand a skill withcontext: fork,allowed-toolsandargument-hint. - Configure
.mcp.jsonwith${GITHUB_TOKEN}plus a personal server; confirm both are available. - Try a one-line fix directly and a 30-file change in plan mode.
Prove it: explain why a teammate wouldn’t receive your user-level rules.
π Real-world example: Where you'd use this at work
This is exactly what Ravi did so that new testers get the team's rules, commands and MCP servers the moment they clone the repository.
π Lab 7: Build an MCP server (2 h)
- With the Python MCP SDK, expose
search_ticketsandget_tickettools and atickets://catalogresource. - Return
isErrorwith categories for failures, and an empty list (not an error) for no matches. - Connect it to Claude Code over stdio; improve descriptions until Claude prefers it over Grep.
Prove it: explain when to use a resource instead of a tool.
π Real-world example: Where you'd use this at work
ShopNest's support team wanted Claude to search their ticket system. A tiny MCP server with two tools and one resource was all it took.
π Lab 8: CI review bot (90 min)
- In a GitHub Actions job, run
claude -pwith--output-format json --json-schema. - Put explicit report/skip criteria and a severity rubric in CLAUDE.md.
- Compare a single pass with per-file plus integration passes on a 14-file PR.
- Re-run after a new commit, passing earlier findings, and confirm there are no duplicate comments.
Prove it: explain why “only report high-confidence findings” doesn’t reduce false positives.
π Real-world example: Where you'd use this at work
This is Ravi's pull-request reviewer: non-interactive, JSON output, explicit criteria, and no duplicate comments when developers push fixes.
π οΈ Try it yourself (about 10 minutes)
- Create an empty folder or repository called
claude-labs. - Run
pip install anthropicand set yourANTHROPIC_API_KEYenvironment variable. - Send one 'Hello' request and print
stop_reasonandusage.
β
You are done when: you see end_turn and token counts printed, which is the first step of Lab 1.
π§ͺ Exam-Style Practice Questions
Try these before opening the answers. They use the same scenario style as the real exam.
Question 1. What must be true for a coordinator built with the Agent SDK to spawn subagents?
- A.
tool_choicemust be"any" - B. The coordinator's
allowedToolsmust include"Task" - C. Each subagent must share the coordinator's session
- D. Subagents must be MCP servers
Show answer
Answer: B. The Task tool is how subagents are spawned, so it must be allowed. C: subagents run in isolated contexts. D: subagents are AgentDefinitions, not MCP servers. A: tool_choice isn't related.
Question 2. You must ensure extract_metadata runs before any enrichment tool on each document. Per the exam guide, what's the mechanism?
- A.
tool_choice: "none" - B.
tool_choice: "auto" - C.
tool_choice: {"type": "tool", "name": "extract_metadata"}on the first call, then later steps in follow-up turns - D. Put
extract_metadatafirst in the tools array
Show answer
Answer: C. Forced selection guarantees that specific tool runs first. B leaves it to the model. A prevents tool calls. D: array order doesn't enforce anything. π On the newest models, forced selection returns a 400; use auto, a clear instruction, and code-side enforcement or structured outputs instead.
Question 3. How many few-shot examples does the guide recommend for ambiguous cases, and what should they contain?
- A. 2β4 targeted examples showing the reasoning for why one option was chosen over plausible alternatives
- B. None; use instructions
- C. 20+, with answers only
- D. 1 generic example
Show answer
Answer: A. Targeted examples with reasoning help the model generalise. C wastes tokens and teaches pattern-matching. D is too thin. B ignores the most effective technique.
π Assignment
Do these tasks in order. Each one has a Done when check, so you know when it is complete. The stretch task is optional but close to what the exam expects from an architect. Keep your answers in one notes file or Git repository, and revisit them in your final week of revision together with the cheat sheet in the last lesson of this course.
- Task 1: Complete Labs 1β3 and keep your code in one repository.
β Done when: Labs 1β3 run end to end from a clean checkout, using only the README you wrote. - Task 2: Complete Labs 5β7 and write two sentences on what surprised you in each.
β Done when: Each of Labs 5β7 has two sentences of notes covering what surprised you and what you would do differently. - Stretch: finish Lab 8 and run it on a real pull request.
β Done when: Your CI review bot posted at least one useful comment on a real pull request without duplicates.
β Frequently Asked Questions
π€ Do I need to pay for the labs?
You need a Claude API key with credit for API labs; Claude Code needs an eligible plan or API access.
π€ Which language should I use?
Python or TypeScript. The labs use Python examples, and both SDKs work the same way.
π€ How long do the labs take?
About 12 hours in total, spread over the six-week study plan.
π€ Are the labs required to pass?
No, but the exam tests practical judgement, which the labs build faster than reading.
π Summary
- Each lab ends with a “prove it” check: if you can explain the answer, you are ready for that topic.
- Labs 1β4 cover the API (loop, errors, extraction, batches); Labs 5β8 cover the Agent SDK, Claude Code, MCP and CI.
- About 12 hours in total; spread them across the six-week study plan.
Next, continue with Claude Architect Exam: 6-Week Study Plan, Cheat Sheet and Exam-Day Tips.
Independent study material by SQA Tools. Not affiliated with, endorsed by or sponsored by Anthropic. Claude is a trademark of Anthropic. Mock questions are original practice items, not real exam content. Exam facts checked against Anthropic's official exam guides and certification FAQ on 11 November 2026.