Skip to content

v0.8.1

Latest

Choose a tag to compare

@dalehurley dalehurley released this 18 Mar 08:04

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_KEY constant to PausesLoop contract — implementations must include this key in their __toString() output
  • Created PauseSignal::isSignal() static helper for string-based detection (mirrors AskHumanSignal::isSignal())
  • Updated both ReActLoop and PlanExecuteLoop to detect pauses via instanceof || PauseSignal::isSignal()
  • LoopResult::$pauseSignal and PlanResult::$pauseSignal are now ?string (stringified JSON) instead of ?PausesLoop
  • onPause callbacks now receive string $signal as 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
    ]);
}