Hey everyone, experimenting with the agentSDK for ...
# questions
a
Hey everyone, experimenting with the agentSDK for a research project. Trying to wrap my head around condensations. Let's say the agent makes some tool calls with super massive observations. A naive condenser might be to just compress/truncate a significant portion of the tool observations after a few rounds. But keep the tool call/tool response structure as it is. After reaching the condenser docs and code, I am a bit unsure if this can be done currently. Looking at the view implementation, it seems to be opimized for doing the forgetting and injecting the summary at a particular location. I wonder if maybe the strat is to get a condenser that returns a view where the events are modified themselves, but i am not sure if that breaks some other abstractions on opnehands
w
The condenser abstraction should make it easy to swap in new condensation strategies!
@wide-doctor-37830 might be able to advise
I think the main footprint is you mark sequences of messages to be ignored when building context for the LLM, optionally inserting a summary at that location
a
Thanks for replying Robert!! The only issue I am seeing is that • summary has to be text and not tool response(which maybe it's okay) • there can only be one summary For instance if I have TC1 TR1 TC2 TR2 .... If I want to summarize it so that it's TC1 TR1' TC2 TR2' .... where TC = tool call and TR = tool response TR' = compressed tool response. This pattern seems potentially useful when tool responses are long and matter for the immediate action but the call seqence is still useful
w
Hey Peter! If you want to experiment with this I’d suggest just extending the base Condenser class and doing your per-event rewriting in the condense function. Instead of returning a Condensation, you can just return a modified View. We do something similar in the non-SDK condensers (take a look at the BrowserOutputCondenser, for example).
One thing to watch out for is you’ll want to keep the event types the same for the TRs — if the metadata linking the tool results to the tool calls are disrupted the entire TC/TR pair will be removed from the context to keep the LLM APIs happy.
a
Ah gotcha thanks!!!
BTW the
BrowserOutputCondenser
is exactly what I wanted to do!!
🙌 1