Skip to content

Releases

v0.2.4

Choose a tag to compare

@ajeetsk ajeetsk released this 24 Nov 17:13

Pagination fields now survive reduction (#9, reported in the feedback thread).

  • When a result is over budget, the reducer rebuilds it and used to keep only the source's total. Cursors and next-page links were lost, so the model could not ask for more.
  • The source's pagination fields are now found by name anywhere in the response around the items: next_cursor, response_metadata.next_cursor, paging.next.after, pageInfo.endCursor, nextRecordsUrl, has_more, links.next and similar.
  • Your code always gets them on ReducedResult.paging.
  • The model gets them in _meta.source_paging only when every item of the page is included. A cursor jumps past the whole page, so following it from a partial page would skip the items left out; in that case the existing warning asks for a narrower call instead.
  • New Messages.paging text, configurable like the others.

Tested with Claude Opus 5.5 on a three-page source: it followed the cursor through every page and listed all 30 items, including when the first page arrived partial and it had to narrow the call first. Without source_paging it stopped at 10.

v0.2.3

Choose a tag to compare

@ajeetsk ajeetsk released this 23 Nov 09:58

Documentation only; no code change.

  • The README's links to the examples now work on PyPI. They were relative paths, which PyPI resolved to its own site, giving a "not found" page.
  • The README links the feedback thread for design questions.

v0.2.2

Choose a tag to compare

@ajeetsk ajeetsk released this 23 Nov 08:34

Added

  • Examples for real agent loops, each a one-line change where the tool result enters the conversation:

    All three were run against live models (gpt-6-luna and claude-opus-5-5). In each, the model received all 30 of 30 items and listed every one correctly.

  • _meta.total_note: when the source reports more items than the response holds (a page of 30 out of 412), the model is told that complete covers this response only and that it should not present the items as the full set. Its wording is the new Messages.more_at_source template.

Changed

  • summary() now gives item counts and the selected fields when a select fits, instead of only the character count.

Upgrade note

Results from paginated sources carry the extra note, about 230 characters, within the same budget.

pip install -U agent-tool-result-reducer

v0.2.1

Choose a tag to compare

@ajeetsk ajeetsk released this 23 Nov 04:12

First release on PyPI.

pip install agent-tool-result-reducer

No change to the library's behaviour since v0.2.0. This release adds the publishing workflow and a clearer README title.

v0.2.0

Choose a tag to compare

@ajeetsk ajeetsk released this 22 Nov 14:09

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

v0.1.0

Choose a tag to compare

@ajeetsk ajeetsk released this 22 Nov 11:26

First public release.

agent-tool-result-reducer fits a large JSON tool result into a size budget before it goes into an LLM agent's context, without silently losing data.

  • Whole items, valid JSON. It never cuts a record in half.
  • Fields before items. When a result is too large, it drops the widest fields first so every item survives.
  • The model is told. A _meta block states how many items were included, how many exist, and which fields were dropped.
  • select. Keep only the fields the task needs, as dot-paths (id,summary.name).
  • No dependencies. Python 3.10 to 3.15.

It was extracted from a production agent runtime, where it handles every tool result.

pip install git+https://github.com/AryabhattaLabs/agent-tool-result-reducer@v0.1.0

Not yet on PyPI. See the README for a quick start.