Cut long tool results
An agent sends every earlier tool result again on each step of its tool loop. A long log or test report makes each later step larger, although the agent needs only a small part of it. Proxium can cut such a result to its head and its tail before the call goes to the vendor.
The cut is off for every app until you set a limit.
How it works
- You set a limit for one app. The app is the value of the header
x-proxium-source. - Proxium checks each tool result in the history of a call. A result is eligible when its tool is in the list of the rule and its text is longer than the limit.
- Proxium keeps the first characters and the last characters of an eligible result. It puts a one-line notice in the middle that gives the number of removed characters.
- Proxium sends the shortened history to the vendor.
The cut is a fixed function of the result text. The same result gives the same shortened text on every call, so the cache of the vendor still holds the prefix. A call with nothing to cut goes to the vendor with no change.
A tool that is not in the list stays whole. The list of a new rule is bash, shell and execute. bash is the shell tool of OpenCode. Name the shell tool of your own agent in keep_tools. Keep read out of the list: an agent that edits a file needs the exact text.
Set the limit
The cut is off for an app until you set a limit for it. There are three ways to set it:
- On Overview in the console.
- With the MCP tool
proxium_set_app_limit. - With a request to the source limits of your team.
In each way, a field that you leave out keeps its stored value. A change of the cut keeps the ceilings of the app.
| Field | Meaning | Default |
|---|---|---|
keep_limit_chars | The length above which a result is cut. 0 switches the cut off. | 0 |
keep_head_chars | The characters that stay at the start. | 3000 |
keep_tail_chars | The characters that stay at the end. | 3000 |
keep_tools | The tool names that the cut applies to. | bash, shell, execute |
The limit must be larger than the head, plus the tail, plus 200 characters. Proxium refuses a rule that breaks this, because such a rule could never cut a result.
curl -X PUT "$PROXIUM_URL/api/teams/$TEAM/source-limits" \
-H "authorization: Bearer $PROXIUM_TOKEN" \
-H "content-type: application/json" \
-d '{"source": "my-agent", "keep_limit_chars": 8000}'
To switch the cut off, send "keep_limit_chars": 0.
What you can see
The tokens that a cut removes go into the request trace as saved tokens. The number is the removed characters divided by four.
A fact in the middle of a long result is lost. If your agent needs the middle of a result, raise the limit or add the tail you need. Test a new limit on your own tasks before you set it for an app that does real work.