Try an interactive version of this dialog: Sign up at solve.it.com, click Upload, and pass this URL.

Note: 7 ()

Solveit Integration Tests

Code: 3 ()

import asyncio

Code: 13 ()

dh_settings['port'] = 5002

Code: 82 ()

async def wait_add_msg():
    "Waits 5 seconds then adds a note with the current time."
    import time
    from datetime import datetime
    await asyncio.sleep(5)
    await add_msg(content=datetime.now().strftime("%H:%M:%S"))

Prompt: 19 ()

Please call &wait_add_msg 3 times in parallel

Assistant: 904

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()
Copied!
{
  "id": "toolu_01KxVHw5uMCFctcKdcbiXpPq",
  "call": {
    "function": "wait_add_msg",
    "arguments": {}
  },
  "result": "None"
}
wait_add_msg()
Copied!
{
  "id": "toolu_0139ckPEcL4mSU7rLyXmUt9W",
  "call": {
    "function": "wait_add_msg",
    "arguments": {}
  },
  "result": "None"
}
wait_add_msg()
Copied!
{
  "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)

Note: 7

19:03:46

Note: 7

19:03:46

Note: 7

19:03:46

Note: 10 ()

Lisette Parallel Tool Calls Test

Code: 268 ()

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

Code: 13 ()

from toolslm.funccall import *

Note: 12 ()

Sync Chat (with sync tools)

Code: 103 ()

s = time.time()
chat = Chat(model, tools=[simple_add, multiply])
start = time.time()
chat("Calculate (5 + 3) and (7 + 2) at the same time")
dur = time.time() - s
assert dur < secs*2, f'Running slower {dur:.2f}!'

Code: 1 ()

dur

Output: 10

13.971805810928345

Note: 12 ()

Sync Chat (with async tools)

Note: 19 ()

Sync chat class doesn't support async tools as they are not awaited.

Note: 12 ()

Async Chat (with sync tools)

Code: 88 ()

s = time.time()
chat = AsyncChat(model, tools=[simple_add, multiply])
await chat("Calculate (5 + 3) and (7 + 2) at the same time")
dur = time.time() - s
assert dur < secs*2, 'Running slower!'

Code: 1 ()

dur

Output: 10

14.384423971176147

Note: 12 ()

Async Chat (with async tools)

Code: 93 ()

s = time.time()
chat = AsyncChat(model, tools=[async_simple_add, async_multiply])
await chat("Calculate (5 + 3) and (7 + 2) at the same time")
dur = time.time() - s
assert dur < secs*2, 'Running slower!'

Code: 1 ()

dur

Output: 10

14.7196626663208