Practical Exercises
Exercise 1: Multi-tool Agent with Escalation Logic
Goal: Design an agent loop with tool integration, structured error handling, and escalation.
Steps:
- Define 3–4 MCP tools with detailed descriptions (include two similar tools to test tool selection)
- Implement an agent loop checking
stop_reason("tool_use"/"end_turn") - Add structured error responses:
errorCategory,isRetryable, description - Implement an interceptor hook that blocks operations above a threshold and routes to escalation
- Test with multi-aspect requests
Domains: 1 (Agent architecture), 2 (Tools and MCP), 5 (Context and reliability)
Exercise 2: Configuring Claude Code for Team Development
Goal: Configure CLAUDE.md, custom commands, path-specific rules, and MCP servers.
Steps:
- Create a project-level CLAUDE.md with universal standards
- Create
.claude/rules/files with YAML frontmatter for different code areas (paths: ["src/api/**/*"],paths: ["**/*.test.*"]) - Create a project skill under
.claude/skills/withcontext: forkandallowed-tools - Configure an MCP server in
.mcp.jsonwith environment variables + a personal override in~/.claude.json - Test planning mode vs direct execution on tasks of different complexity
Domains: 3 (Claude Code configuration), 2 (Tools and MCP)
Exercise 3: Structured Data Extraction Pipeline
Goal: JSON schemas, tool_use for structured output, validation/retry loops, batch processing.
Steps:
- Define an extraction tool with a JSON schema (required/optional fields, enums with "other", nullable fields)
- Build a validation loop: on error, retry with the document, the incorrect extraction, and the specific validation error
- Add few-shot examples for documents with different structures
- Use batch processing via the Message Batches API: 100 documents, handle failures via
custom_id - Route to humans: field-level confidence scores, document-type analysis
Domains: 4 (Prompt engineering), 5 (Context and reliability)
Exercise 4: Designing and Debugging a Multi-agent Research Pipeline
Goal: Subagent orchestration, context passing, error propagation, synthesis with source tracking.
Steps:
- A coordinator with 2+ subagents (
allowedToolsincludes"Task", context is passed explicitly in prompts) - Run subagents in parallel via multiple
Taskcalls in a single response - Require structured subagent output: claim, quote, source URL, publication date
- Simulate a subagent timeout: return structured error context to the coordinator and continue with partial results
- Test with conflicting data: preserve both values with attribution; separate confirmed vs disputed findings
Domains: 1 (Agent architecture), 2 (Tools and MCP), 5 (Context and reliability)