Enhanced condenser visibility
Condensation (trimming events down before sending them to the LLM) happens in two contexts:
- When a
ContextWindowExceededErroris thrown, the agent controller cuts the event history in half (see here). - When a custom
Condenseris registered with the agent and the condenser's trigger condition is met (see here).
In the first context, an event is added to the event stream. While the intent is just to trigger another step of the agent, events in the event stream can also be rendered on the front-end. The second context has no such option.
I suggest we find a way to record condensation events from custom condensers with the event stream.
Questions
What is the proper UX for condensation events?
Do we always want to show a user when a condensation happens? (I expect the answer is somewhere between "never" and "always", for example perhaps when settings similar to #6679 are set.)
Possible Solutions
I see three natural solutions:
Move condensers to the agent controller instead of the agent. This would require reworking the condenser interface and means agents cannot control the call to the condenser (although this may not be a bad thing).
Push a reference to the event stream into the condenser. This means threading it through the agent, which seems to mix concerns we would rather keep separate.
Bubble additional events from step to the controller. This would also let us raise extra information from inside the agent for future uses, but I'm not sure what happens when we dump a lot of events into the stream at once.