Condensation request signal in event stream
- [ ] This change is worth documenting at https://docs.all-hands.dev/
- [ ] Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below
End-user friendly description of the problem this fixes or functionality this introduces.
Summarize what the PR does, explaining any non-trivial design decisions.
This PR adds a new event that represents a request for a condensation. This is intended to clean up the control flow of the agent controller by allowing us to use existing condensation implementations instead of the apply_conversation_window logic (which is a bit brittle and doesn't produce any kind of summary for the forgotten events).
To make this transition easier I've also added a condenser which applies precisely the logic from apply_conversation_window, but we can deprecate that in favor of a summarizing condenser at a later date.
(As a bonus, it becomes possible to trigger condensation with a tool call, meaning the agent can now choose to condense or can do so when requested by the user.)
The control flow of the condensation request looks a little like this:
- REQUEST 1: while taking a step, the agent throws some kind of exception in response to having too much context.
- The agent controller intercepts this exception and adds a
CondensationRequestActionto the event stream. This triggers another step. - REQUEST 2: another step, but with the condensation request now also in the context. This is caught by the condenser (which relies on the
Viewobject to see if there are any "hanging" requests while it processes the event stream), which will produce aCondensationActioninstead of letting the agent pick the next action. - The agent controller sees the condensation action and triggers another step.
- REQUEST 3: another step, but the
Viewnow processes the condensation and presents a smaller context to the agent.
Link of any specific issues this addresses:
To run this PR locally, use the following command:
docker run -it --rm -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock --add-host host.docker.internal:host-gateway -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:c2f3da1-nikolaik --name openhands-app-c2f3da1 docker.all-hands.dev/all-hands-ai/openhands:c2f3da1
Looks like there are a few issues preventing this PR from being merged!
- GitHub Actions are failing:
- Docker
If you'd like me to help, just leave a comment, like
@OpenHands please fix the failing actions on PR #9097
Feel free to include any additional details that might help me get this PR into a better state.
You can manage your notification settings
@csmith49 Just curious: I see enable_condensation_request is disabled by default. Has this option been ever evaluated? I feel like it might be useful for web browsing tasks.