You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: make maxOldToolCallTokens configurable in agent YAML
Add max_tool_call_tokens configuration option to control how much
historical tool call content is retained in the context. This helps
manage context size in long-running sessions.
Changes:
- Add maxOldToolCallTokens field to AgentConfig (pkg/config/latest/types.go)
- Update JSON schema with new max_old_tool_call_tokens property
- Add maxOldToolCallTokens field and getter to Agent struct
- Add maxOldToolCallTokens field to Session struct
- Update GetMessages() to use configured value or fall back to
DefaultMaxOldToolCallTokens (40000)
- Propagate maxOldToolCallTokens through all session creation points:
- A2A adapter
- ACP agent
- MCP server
- Runtime agent delegation (transfer_task, sub-sessions)
- HTTP/API server session manager
Configuration semantics:
- Not set or 0: Use default (40000 tokens)
- Positive value: Use that specific limit
- -1: Unlimited (no truncation)
When max_old_tool_call_tokens is exceeded, older tool calls have their
content replaced with "[content truncated]" to keep context size
manageable. Tokens are approximated as string_length/4.
Assisted-By: docker-agent
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
Copy file name to clipboardExpand all lines: agent-schema.json
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -187,6 +187,11 @@
187
187
"description": "Maximum consecutive identical tool calls before the agent is terminated. Prevents degenerate loops. 0 uses the default of 5.",
188
188
"minimum": 0
189
189
},
190
+
"max_old_tool_call_tokens": {
191
+
"type": "integer",
192
+
"description": "Maximum number of tokens to keep from old tool call arguments and results. Older tool calls beyond this budget will have their content replaced with a placeholder. Tokens are approximated as len/4. Set to -1 to disable truncation (unlimited tool content). Default: 40000.",
0 commit comments