Repository navigation
v0.2.0
New: max_overshoot
The budget is strict by default: when a result lands over it, a whole item is dropped to bring it back. The overrun is usually a few dozen characters, because the size of the _meta block is estimated while filling, so that can cost a large item for the sake of a few characters.
max_overshoot=200 accepts a result up to 200 characters over the budget and keeps the item. Use it when the budget is a cost target; keep the default, 0, when it is a hard limit.
reduce_tool_result(payload, "crm.search", budget=12_000, max_overshoot=200)Fixed: items dropped for nothing
If the first item plus the _meta block is already over the budget, dropping the other items cannot bring the result under it. v0.1.0 dropped them anyway; they are now kept.
Behaviour with default arguments is otherwise unchanged.
pip install git+https://github.com/AryabhattaLabs/agent-tool-result-reducer@v0.2.0