Set onError: "return-to-model" when the model can recover from a tool failure. The error becomes a structured tool result and the run can choose another action. Keep fail-run behavior for unsafe or unrecoverable operations.
PHP tool callbacks execute synchronously. Tool concurrency and interruption are therefore constrained by the PHP runtime and the underlying I/O client. Use explicit timeouts in network and process tools, and avoid claiming that a timed-out callback can always be forcibly stopped.
Every pending call needs an approval, rejection, or externally supplied output keyed by its tool-call ID. Persist the complete returned run state before showing an approval UI.
Capture run ID, step index, request ID, provider, model, finish reason, tool-call ID, and stop reason. Use lifecycle hooks or DevTools instead of logging raw prompts and credentials.