<@U090ER7JPHA> Read this comment: <https://github....
# slackbot-chatter
c
@nutritious-balloon-65098 Read this comment: https://github.com/All-Hands-AI/OpenHands/pull/10566#issuecomment-3214114626 This is how it works in one example: https://github.com/All-Hands-AI/openhands-resolver/blob/baa2f4515e3a68cb5b8d1fe1eba28c03e474c798/openhands_resolver/resolve_issue.py#L211 So I think you need somehow to get hold of the event stream for the run, and that is possible via the runtime, but it does mean you need to write a small script that first uses
create_runtime
, then picks up the event stream and registers your listener, then starts the actual run
run_controller
with that runtime instance 🤔 The mechanism we currently have works, but it’s too complicated to set up initially! Understand the mechanism. Then write a function we can plug into
run_controller
that allows the client developer to just write the implementation of a listener, and it will: • subscribe the registered listener to the stream • it will use the runtime created in run_controller, if one hasn’t been passed to it • consider if we need an abstract interface for the developer to just implement. Maybe DX is better? In that case, do it. The interface should probably live in the
events
module. Document it in the developer documentation (create an event_stream.mdx alongside backend.mdx and the like). Make sure you find and keep the docs patterns/position/sections. Make sure you include a real-world example of use!
n
I'm on it! can track my progress here.
Here’s a concise summary of the new work since the last update: What I changed • Made callback_id optional for listener subscriptions: ◦ subscribe_listener now accepts callback_id: str | None ◦ If omitted, we auto-derive a readable base id from the listener (module + class/function + on_event when applicable) and append an 8-char UUID suffix to guarantee uniqueness ◦ This makes client code even simpler: no need to invent IDs • Kept the original DX improvements: ◦ EventListener Protocol and subscribe_listener helper are available via openhands.events ◦ run_controller accepts event_listeners and auto-subscribes them to the runtime’s EventStream using the CLIENT bucket ◦ Documentation page event_stream.mdx added and linked in docs/docs.json Checklist against your latest note • Make callback_id optional and normalize when missing: done • Ensure uniqueness while keeping it readable (class/function/module-based + uuid): done • Keep everything concise and focused on developer ergonomics: done Git state • Commits on current branch: ◦ 0d74473ce events: add simple DX for event stream listeners ◦ 51d57b8ff events: listener callback_id optional with readable auto-id Would you like me to push this branch and open a PR, or keep the changes local? <sub>View full conversation</sub>