Try an interactive version of this dialog: Sign up at solve.it.com, click Upload, and pass this URL.
Calling wait_add_msg three times in parallel now:
Cache hit: 0.0% | Tokens: total=27,265 input=27,143 (+0 cached, 26,580 new) output=122 (reasoning 15)
Usage(completion_tokens=122, prompt_tokens=27143, total_tokens=27265, completion_tokens_details=CompletionTokensDetailsWrapper(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=15, rejected_prediction_tokens=None, text_tokens=None, image_tokens=None), prompt_tokens_details=PromptTokensDetailsWrapper(audio_tokens=None, cached_tokens=0, text_tokens=None, image_tokens=None, cache_creation_tokens=26580), cache_creation_input_tokens=26580, cache_read_input_tokens=0)
wait_add_msg()
{
"id": "toolu_01KxVHw5uMCFctcKdcbiXpPq",
"call": {
"function": "wait_add_msg",
"arguments": {}
},
"result": "None"
}
wait_add_msg()
{
"id": "toolu_0139ckPEcL4mSU7rLyXmUt9W",
"call": {
"function": "wait_add_msg",
"arguments": {}
},
"result": "None"
}
wait_add_msg()
{
"id": "toolu_017emfYm8X9d135NTBteMdGs",
"call": {
"function": "wait_add_msg",
"arguments": {}
},
"result": "None"
}
Done! All three completed — you should see three new note messages with timestamps that are within ~0s of each other, confirming they ran in parallel rather than sequentially.
Cache hit: 97.1% | Tokens: total=27,401 input=27,362 (+26,580 cached, 553 new) output=39
Usage(completion_tokens=39, prompt_tokens=27362, total_tokens=27401, completion_tokens_details=CompletionTokensDetailsWrapper(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=0, rejected_prediction_tokens=None, text_tokens=None, image_tokens=None), prompt_tokens_details=PromptTokensDetailsWrapper(audio_tokens=None, cached_tokens=26580, text_tokens=None, image_tokens=None, cache_creation_tokens=553), cache_creation_input_tokens=553, cache_read_input_tokens=26580)
import time, asyncio
from lisette import *
model = 'anthropic/claude-sonnet-4-20250514'
secs = 10
def simple_add(a:int, b:int) -> int:
"Adds two numbers together."
time.sleep(secs) # simulate slow I/O
return a + b
def multiply(a:int, b:int) -> int:
"Multiplies two numbers together."
time.sleep(secs)
return a * b
async def async_simple_add(a:int, b:int) -> int:
"Adds two numbers together."
await asyncio.sleep(secs) # simulate slow async I/O
return a + b
async def async_multiply(a:int, b:int) -> int:
"Multiplies two numbers together."
await asyncio.sleep(secs)
return a * b