Skip to content

Practical Exercises

Exercise 1: Multi-tool Agent with Escalation Logic

Goal: Design an agent loop with tool integration, structured error handling, and escalation.

Steps:

  1. Define 3–4 MCP tools with detailed descriptions (include two similar tools to test tool selection)
  2. Implement an agent loop checking stop_reason ("tool_use" / "end_turn")
  3. Add structured error responses: errorCategory, isRetryable, description
  4. Implement an interceptor hook that blocks operations above a threshold and routes to escalation
  5. 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:

  1. Create a project-level CLAUDE.md with universal standards
  2. Create .claude/rules/ files with YAML frontmatter for different code areas (paths: ["src/api/**/*"], paths: ["**/*.test.*"])
  3. Create a project skill under .claude/skills/ with context: fork and allowed-tools
  4. Configure an MCP server in .mcp.json with environment variables + a personal override in ~/.claude.json
  5. 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:

  1. Define an extraction tool with a JSON schema (required/optional fields, enums with "other", nullable fields)
  2. Build a validation loop: on error, retry with the document, the incorrect extraction, and the specific validation error
  3. Add few-shot examples for documents with different structures
  4. Use batch processing via the Message Batches API: 100 documents, handle failures via custom_id
  5. 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:

  1. A coordinator with 2+ subagents (allowedTools includes "Task", context is passed explicitly in prompts)
  2. Run subagents in parallel via multiple Task calls in a single response
  3. Require structured subagent output: claim, quote, source URL, publication date
  4. Simulate a subagent timeout: return structured error context to the coordinator and continue with partial results
  5. 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)