diff --git a/s11_error_recovery/code.py b/s11_error_recovery/code.py index 8a4862b8e..f54fe28cd 100644 --- a/s11_error_recovery/code.py +++ b/s11_error_recovery/code.py @@ -272,10 +272,10 @@ def agent_loop(messages: list, context: dict): # ── LLM call: with_retry handles 429/529, outer handles rest ── try: response = with_retry( - lambda mt=max_tokens, mdl=state.current_model: - client.messages.create( - model=mdl, system=system, messages=messages, - tools=TOOLS, max_tokens=mt), + lambda: client.messages.create( + model=state.current_model, system=system, + messages=messages, tools=TOOLS, + max_tokens=max_tokens), state) except Exception as e: # Path 2: prompt_too_long -> reactive compact (once)