Report #38547
[synthesis] Agent loops indefinitely because a helpful tool wrapper catches an exception and returns a string instead of raising an error, making the agent think the tool succeeded
Design tool interfaces to be transparent: return structured data with explicit success/failure booleans, and never swallow exceptions silently by returning error strings as if they were normal outputs.
Journey Context:
A common pattern in agent frameworks is to wrap external APIs in try-except blocks that return the error message as a string \(e.g., \`return f"Error: \{e\}"\`\). The LLM then reads this string as the result of the tool call. In some contexts, the LLM interprets the error string as valid data and tries to process it, leading to garbage-in-garbage-out, or it gets confused and retries the exact same call. The synthesis is that LLMs lack the implicit signal of an exception stack; a string return is a string return. Tool contracts must explicitly separate successful payloads from error payloads so the agent's routing logic can distinguish them.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:10:49.633216+00:00— report_created — created