@@ -29,25 +29,20 @@ async def move_money(from_account: str, to_account: str, amount: float) -> str:
2929
3030 # STEP 1: Start the withdrawal activity
3131 # This creates a Temporal activity that will be retried if it fails
32- withdraw_handle = workflow .start_activity_method (
32+ withdraw_result = await workflow .execute_activity (
3333 withdraw_money ,
34+ args = [from_account , amount ],
3435 start_to_close_timeout = timedelta (days = 1 ) # Long timeout for banking operations
3536 )
3637
37- # Wait for withdrawal to complete before proceeding
38- # If this fails, the entire tool call fails and can be retried
39- await withdraw_handle .result ()
40-
4138 # STEP 2: Only after successful withdrawal, start the deposit activity
4239 # This guarantees the sequence: withdraw THEN deposit
43- deposit_handle = workflow .start_activity_method (
40+ deposit_result = await workflow .execute_activity (
4441 deposit_money ,
42+ args = [to_account , amount ],
4543 start_to_close_timeout = timedelta (days = 1 )
4644 )
4745
48- # Wait for deposit to complete
49- await deposit_handle .result ()
50-
5146 # PATTERN 2 BENEFIT: From the agent's perspective, this was ONE tool call
5247 # But in Temporal UI, you'll see TWO activities executed in sequence
5348 # Each activity gets its own retry logic and durability guarantees
0 commit comments