You Let the Model Call Two Tools at Once and the Order Went to a Customer Number It Made Up
The assistant had two tools. create_account, which returned a new account number. place_order, which needed one. A new customer said: "Open an account for me and order the forty bags we talked about." The model repl
The assistant
had two tools.
create_account,
which returned
a new account number.
place_order,
which needed one.
A new customer said:
"Open an account for me
and order the forty bags
we talked about."
The model replied
with both tool calls
in the same turn.
Your code ran them both.
The account was created.
The order was placed
on account 10001.
Which belonged
to somebody else.
Here is the mechanism.
The major APIs
let a model return
several tool calls
in one response.
On OpenAI
that is parallel_tool_calls,
and it is on by default.
Anthropic
has a switch
to turn it off.
That is useful
when the calls are independent.
Check stock here.
Check stock there.
It is a trap
when one call needs
the answer to the other.
The model had to fill in
account_id
before create_account
had returned anything.
So it did what models do
with a required field.
It wrote something
that looked like an account number.
Your schema said string.
10001 is a string.
Your executor
saw two valid calls
and ran them,
possibly at the same time.
Nothing in the logs
looked wrong.
Two calls.
Two successes.
The customer
got a confirmation email
for an order
he could not see
in his new account.
The other customer
got forty bags of plaster
she had never asked for.
In testing
this never happened.
The test prompts
asked for one thing at a time.
Real customers
ask for the whole job
in one breath.
What fixed it:
Parallel calls turned off
for any tool
that writes.
One tool
for a job that is really one job:
create_account_with_order.
And a rule in code,
not in the prompt.
Any ID the model passes in
must be one
a tool returned
in this conversation,
or one that belongs
to the signed in customer.
Anything else
is rejected,
and the model is told why.
A model is fluent
in the shape of an identifier.
It has no idea
which ones exist.
An ID it typed itself
is a guess
until your code
has checked it.
β Serguey Asael Shinder
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.