A progressive collection of hands-on exercises for building muscle memory with Temporal workflow orchestration. These exercises are designed for daily practice to develop fluency across Python, Java, Go, and TypeScript.
This repository contains "warm-up" exercises where I take ordinary code and temporalize itβconverting procedural operations into durable Temporal workflows with proper activity separation, retry policies, and error handling.
Goal: Complete each exercise in ~1 hour, building speed and confidence over time.
Each exercise includes:
- Original code: The "before" version (messy, procedural, no durability)
- Temporalized version: The "after" version with proper workflow/activity separation
- Multiple languages: Python, Java, Go, and (eventually) TypeScript implementations
- Progressive complexity: Starting simple, adding real-world patterns over time
Week 1-2: Fundamentals
- Basic workflow β activity patterns
- Simple retry policies
- Clean starting code
- Focus: Getting the pattern down
Week 3-4: Realistic Scenarios
- Messier starting code
- Compensation patterns (sagas)
- Partial failure handling
- Focus: Real-world challenges
Week 5+: Advanced Patterns
- Signals and queries (introduced in Exercise 06)
- Parallel execution (fan-out/fan-in)
- Parent-child workflows
- Workflow versioning
- Continue-as-new
- Focus: Production patterns
Start Here: Exercise 901 (Multi-agent AI PR review system)
This series transforms a multi-agent AI system from plain Java through full production deployment:
Complete Progression:
- Exercise 901: Multi-agent sequential execution (Plain Java + Temporal basics)
- Exercise 902: Spring Boot integration (REST API + dependency injection)
- Exercise 903: Production deployment (Kubernetes + Prometheus + Grafana)
- Exercise 904: Temporal Cloud migration (mTLS + Cloud UI)
- Exercise 905: Batch processing + Continue-as-New (100+ PRs, event history management)
- Exercise 906: Parallel agent execution (Performance optimization: 6-9s β 2-3s)
- Exercise 907: Comprehensive testing (TestWorkflowEnvironment + integration tests)
- Exercise 908: Query methods for real-time progress (Observability patterns)
- Exercise 909: Human-in-the-loop with signals (Advanced interaction patterns)
Total Time: ~12-15 hours across all exercises Difficulty: ββββ (Production-grade) Focus: End-to-end production Temporal application lifecycle What You'll Build: A real-world AI-powered PR review system from prototype to production
temporal-warmups/
βββ exercise-01-registration/ # User registration flow
β βββ README.md # Exercise description & goals
β βββ original/ # Starting code (before Temporal)
β β βββ registration.py
β βββ python/ # Python solution
β β βββ models.py
β β βββ activities.py
β β βββ workflow.py
β β βββ worker.py
β β βββ client.py
β β βββ requirements.txt
β βββ java/ # Java solution
β βββ go/ # Go solution
β βββ typescript/ # TypeScript solution
βββ exercise-02-email/ # Email verification
βββ exercise-02-orders/ # Order processing
βββ exercise-03-hotel/ # Hotel booking with fallbacks
βββ exercise-04-registration-java/ # Java-specific registration
βββ exercise-05-booking/ # Travel booking (sagas)
βββ exercise-06-support-triage/ # β AI support triage (SIGNALS!)
β βββ exercise-06-README.md # @Signal and OpenAI Java SDK
β βββ src/main/java/
β βββ exercise/ # Pre-Temporal baseline
β βββ solution/temporal/ # Temporal solution with signals
βββ README.md
For all exercises:
- Temporal server running locally
temporal server start-devOR
docker-compose upLanguage-specific:
- Python: Python 3.8+,
pip - Java: JDK 11+, Maven or Gradle
- Go: Go 1.21+
- TypeScript: Node.js 18+, npm
Each exercise contains language-specific instructions in its README. General pattern:
- Start Temporal server (if not already running)
- Navigate to exercise directory
- Choose your language (e.g.,
cd python/) - Install dependencies (language-specific)
- Run the worker (in one terminal)
- Run the client (in another terminal)
- Check Temporal UI at http://localhost:8233
Exercise 06 - Support Triage introduces Signals for the first time in this curriculum!
@SignalMethod(Java) - Define signal handlers in workflows- Human-in-the-loop patterns - Workflows pause for external approval
- Signal timing - Understanding when signals arrive vs when workflow reaches
await() - Sending signals via CLI -
temporal workflow signalcommands for testing - Multi-agent AI orchestration - Coordinating multiple LLM API calls with Temporal
- State tracking in workflows - Using instance fields to track signal receipt
Signals enable workflows to pause and wait for external events like:
- Human approvals (compliance, risk management)
- External system notifications
- User input or decisions
- Real-time updates from other services
This is a production-critical pattern for building reliable, auditable systems with human oversight.
- Pick an exercise
- Time yourself (aim for ~1 hour)
- Focus on one language at a time
- Review the solution afterward
- Start with Python (most comfortable)
- Progress to Java (building on ecommerce experience)
- Tackle Go (new territory, steepest curve)
- Add TypeScript when ready
- Workflow vs Activity boundaries
- Deterministic vs non-deterministic code
- Retry policies and error handling
- State management and durability
- Compensation patterns (sagas)
- Parallel execution patterns
- Signals and queries β NEW in Exercise 06!
- Human-in-the-loop approvals
- External events triggering workflow state changes
- Sending signals via Java client code or Temporal CLI
- Workflow versioning
These exercises are part of a larger learning journey to:
- Build deep Temporal expertise for interviews and presentations
- Develop workshop materials for customer on-site training
- Create progressively complex examples for teaching distributed systems concepts
- Not production code: These are learning exercises, optimized for clarity
- Iterations expected: Solutions may be revised as patterns evolve
- Language parity: Not all exercises will have all 4 languages immediately
- Timing tracked: Each exercise notes approximate completion time
- Temporal Documentation
- Temporal Python SDK
- Temporal Java SDK
- Temporal Go SDK
- Temporal TypeScript SDK
| Exercise | Python | Java | Go | TypeScript | Concepts |
|---|---|---|---|---|---|
| 01 - Registration | β | β | β¬ | β¬ | Basic workflow, activities, retries |
| 02 - Email Verification | β | β | β¬ | β¬ | Muscle memory building |
| 02 - Order Processing | β | β¬ | β¬ | β¬ | Multiple activities, external state |
| 03 - Hotel Booking | β | β¬ | β¬ | β¬ | Messy code refactoring, fallback patterns |
| 04 - Registration (Java) | β¬ | β | β¬ | β¬ | Java-specific patterns |
| 05 - Travel Booking | β | β¬ | β¬ | β¬ | Saga/compensation patterns |
| 06 - Support Triage | β¬ | β | β¬ | β¬ | Signals (NEW!), human-in-the-loop, multi-agent AI |
Status: Active development (Dec 2024 - Jan 2025)