Files
lettabot/src
Cameron 9cb35228fd fix: deduplicate tool_call stream events by toolCallId (#199)
The Letta server streams tool_call_message events token-by-token as
the model generates tool arguments. A single tool call (e.g.
memory_rethink with a large new_memory arg) can produce hundreds of
wire events, all sharing the same toolCallId. Without dedup, the bot
miscounts these as separate tool calls -- logging "Calling tool: X"
hundreds of times and potentially triggering the tool-loop abort at
maxToolCalls (default 100) for what is actually a single call.

Track seen toolCallIds per stream and skip chunks already yielded.

Written by Cameron and Letta Code

"In the beginner's mind there are many possibilities, but in the
expert's mind there are few." -- Shunryu Suzuki
2026-02-06 16:52:33 -08:00
..