Signal · Tool calling

Iteration limit (E_MAX_ITERATIONS)

A run that keeps requesting tool calls rejects with code E_MAX_ITERATIONS: Signal allows ten tool turns, plus one per retry (two by default), then fails the call. Example: the model answers every tool result with the same tool call, so 12 requests are sent and the function runs 12 times. The model’s turn is scripted; no model is called.

Tool
defineTool({
  name: 'seatsLeft',
  description: 'How many seats are left on a night',
  input: z.object({ night: z.string().describe('The night, as YYYY-MM-DD') }),
  execute: ({ night }) => ({ night, left: seatsLeftOn(night) }),
})
Scripted model reply, every turn
{
  calls: [{ name: 'seatsLeft', args: '{"night":"2026-10-24"}' }],
}
Error
{
  requests: 12,
  ran: 12,
  code: 'E_MAX_ITERATIONS',
  message: 'Max tool iterations reached',
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.