I’ve been looking into Claude Code hooks, in parti...
# general
i
I’ve been looking into Claude Code hooks, in particular the Stop hook, which seems to be able to restart the agent after it decided to stop, if work remains outstanding. This possible “early exit” of agents was mentioned in the last webinar on “automating massive refactors”. I think it was referred to as the agent “being lazy”. Is there a way to implement something like that with openhands? I’m particularly interested in this way to keep the agent engaged for longer periods.
l
Yep, we have hooks in openhands! https://docs.openhands.dev/sdk/guides/hooks#hooks It’s a relatively new features so we’d like any feedback
👀 1
i
Thanks, looking at the event types and there doesn’t seem to be a stop event to react to, right? https://docs.openhands.dev/sdk/arch/events#event-types
l
I believe MessageEvent (Agent) is the one you’re looking for. When the agent just sends a message without an action I believe that the conversation terminates
👍 1
w
Would be nice to make this more explicit!
👍 1
@nutritious-balloon-65098 open an issue on the software-agent-sdk repo for a stop hook
🔥 1
n
I'm on it! Robert Brennan can track my progress here.
I've successfully created a GitHub issue on the OpenHands/software-agent-sdk repository for the Stop Hook feature request. Issue Created: Feature Request: Add Stop Hook to prevent early agent termination The issue includes: • Summary of the Stop Hook feature • Motivation explaining the "early exit" / "lazy agent" problem • Reference Implementation from Claude Code's Stop Hook documentation • Current State analysis of OpenHands' existing hooks system • Proposed Solution with specific requirements for the new hook event type • Use Cases for practical applications This feature would allow users to intercept agent termination decisions and evaluate whether all tasks are truly complete before allowing the agent to stop, helping to keep agents engaged for longer periods on complex tasks. <sub>View full conversation</sub>