Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions plugins/_code_execution/default_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ dialog_patterns: |
yes/no
:\s*$
\?\s*$

# Maximum terminal output size in characters before truncation (default: 30000 ≈ ~7.5K tokens)
max_output_chars: 30000
5 changes: 4 additions & 1 deletion plugins/_code_execution/tools/code_execution_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@ def get_heading_from_output(self, output: str, skip_lines=0, done=False):

def fix_full_output(self, output: str):
output = re.sub(r"(?<!\\)\\x[0-9A-Fa-f]{2}", "", output)
output = truncate_text_agent(agent=self.agent, output=output, threshold=1000000)
cfg = _get_config(self.agent)
max_chars = cfg.get("max_output_chars", 30000)
output = truncate_text_agent(agent=self.agent, output=output, threshold=max_chars)
return output

async def ensure_cwd(self) -> str | None:
Expand Down Expand Up @@ -550,6 +552,7 @@ def _get_config(agent) -> dict:
"output_timeouts": _parse_timeouts(cfg, "output", (120, 60, 600, 5)),
"prompt_patterns": _parse_patterns(cfg.get("prompt_patterns", "")),
"dialog_patterns": _parse_patterns(cfg.get("dialog_patterns", ""), re.IGNORECASE),
"max_output_chars": int(cfg.get("max_output_chars", 30000)),
}


Expand Down