Repository navigation
Bug Fix
String-based PausesLoop detection for SDK-resolved tool results
The Prism gateway stringifies all tool results before they reach the agentic loop, so instanceof PausesLoop checks never matched for SDK-resolved tools. This caused loops to continue iterating instead of pausing when a tool returned a PausesLoop signal.
Changes
- Added
MARKER_KEYconstant toPausesLoopcontract — implementations must include this key in their__toString()output - Created
PauseSignal::isSignal()static helper for string-based detection (mirrorsAskHumanSignal::isSignal()) - Updated both
ReActLoopandPlanExecuteLoopto detect pauses viainstanceof || PauseSignal::isSignal() LoopResult::$pauseSignalandPlanResult::$pauseSignalare now?string(stringified JSON) instead of?PausesLooponPausecallbacks now receivestring $signalas the first argument
Migration
If you have onPause callbacks, update the first parameter type from PausesLoop to string:
// Before
->onPause(function (PausesLoop $signal, ...) { ... })
// After
->onPause(function (string $signal, ...) { ... })If you have custom PausesLoop implementations, include the marker in __toString():
public function __toString(): string
{
return json_encode([
self::MARKER_KEY => true,
// ... your payload
]);
}