feat(runtime): configurable per-tool-result truncation cap
Adds LoopConfig.MaxToolResultLen with the same config > env > default precedence as the existing MaxToolConcurrency / MaxAgentDepth knobs: 1. Runtime.AgentLoop.MaxToolResultLen (>0) — config wins 2. HARNESS_MAX_TOOL_RESULT_LEN env (>0) — env fallback 3. defaultMaxToolResultLen (4000) — unchanged for back-compat The previous 4000-char cap was conservative for agents doing real engineering work (read_file, web_fetch, browser, bash output). Setting MaxToolResultLen to 16000-25000 lets a typical source file or test run land in-context without hitting spillover; spill remains the safety net for genuinely large outputs. No behaviour change for callers that don't set the field.
This commit is contained in:
1 parent
65021e1fe2
commit
2d557bb7f5
5 files changed
+95
-5
No files matched your search
@@ -71,6 +71,14 @@ type LoopConfig struct {
|
||||
// StreamingTools enables mid-stream concurrency-safe tool kickoff.
|
||||
// false ⇒ env fallback (HARNESS_STREAMING_TOOLS=1) then off.
|
||||
StreamingTools bool
|
||||
// MaxToolResultLen caps the in-context length of any single tool
|
||||
// result; longer results are truncated to their first MaxToolResultLen
|
||||
// chars (cut at a newline boundary) with the remainder either spilled
|
||||
// to disk via spillConfig or simply dropped. 0 ⇒ env fallback
|
||||
// (HARNESS_MAX_TOOL_RESULT_LEN) then default 4000. Common pick for
|
||||
// engineering-style agents (reading source files, running tests) is
|
||||
// 16000-25000.
|
||||
MaxToolResultLen int
|
||||
// Hooks are optional callbacks the runtime fires at well-known
|
||||
// points in the loop. Zero value (all nil fields) disables every
|
||||
// hook with no overhead.
|
||||
|
||||
Reference in new issue
Block a user