Skip to content

feat(config): allow skipping tool-loop summaries - #421

Open
SherryOvo wants to merge 1 commit into
vxcontrol:mainfrom
SherryOvo:perf/configurable-tool-loop-summarization
Open

SherryOvo wants to merge 1 commit into
vxcontrol:mainfrom
SherryOvo:perf/configurable-tool-loop-summarization

Conversation

@SherryOvo

Copy link
Copy Markdown

Summary

  • add SUMMARIZER_SKIP_TOOL_LOOP_AGENT_TYPES as an opt-in, comma-separated configuration
  • skip incremental SummarizeChain calls after tool rounds for matching agent types
  • keep restore-time summarization intact as a safety boundary for interrupted chains
  • preserve current behavior by default and document large-context-model usage

Motivation

For tool-heavy specialist agents, an aggressive summarizer configuration can add another LLM request after nearly every tool round. On large-context models this can increase wall-clock latency substantially even when retaining the unsummarized specialist chain is acceptable.

The new option allows operators to choose that tradeoff per agent type instead of disabling summarization globally. Matching is case-insensitive and ignores surrounding whitespace.

Example:

SUMMARIZER_SKIP_TOOL_LOOP_AGENT_TYPES=coder,searcher,enricher,installer,pentester

Leaving the variable empty retains the existing behavior.

Validation

  • go test ./pkg/config ./pkg/providers ./pkg/csum -count=1
  • go build ./cmd/pentagi
  • git diff --check

Copilot AI lite review requested due to automatic review settings September 15, 2026 06:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Standard Docker deployments do not pass through the new variable, and the config test cleanup helper omits it.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds opt-in per-agent skipping of incremental tool-loop summarization while retaining restore-time summarization.

Changes:

  • Adds case-insensitive, whitespace-tolerant agent matching.
  • Adds environment configuration and tests.
  • Documents the new setting and usage.
File summaries
File Summary Review Notes
backend/pkg/providers/performer.go Applies selective summarization skipping. No issues reported.
backend/pkg/providers/helpers_test.go Tests agent-type matching. No issues reported.
backend/pkg/config/config.go Defines the environment-backed setting. Moderate: wire the variable through Compose and installer/environment-example paths. (2 votes)
backend/pkg/config/config_test.go Tests defaults and parsing. Moderate: clear the new environment variable in clearConfigEnv. (3 votes)
backend/docs/config.md Documents configuration and usage. Moderate: add the variable to the Docker Compose environment mapping. (1 vote)
Review details

Suppressed comments (1)

backend/docs/config.md:1124

  • This setting is parsed by the binary, but standard Docker Compose deployments never pass it into the pentagi container: docker-compose.yml uses an explicit environment allowlist and this variable is absent. Setting the documented variable in the project .env therefore silently leaves the feature disabled; add it to the Compose mapping before exposing it as a usable deployment option.
| SummarizerSkipToolLoopAgentTypes | `SUMMARIZER_SKIP_TOOL_LOOP_AGENT_TYPES` | empty | Comma-separated agent types that skip incremental summarization after tool-call rounds |
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

// SummarizerSkipToolLoopAgentTypes disables incremental summarization after
// tool-call rounds for selected agent types. Restore-time summarization is
// unaffected, preserving a safety boundary for interrupted long chains.
SummarizerSkipToolLoopAgentTypes []string `env:"SUMMARIZER_SKIP_TOOL_LOOP_AGENT_TYPES"`
assert.Equal(t, 10, config.SummarizerMaxQASections)
assert.Equal(t, 65536, config.SummarizerMaxQABytes)
assert.Equal(t, 1, config.SummarizerKeepQASections)
assert.Empty(t, config.SummarizerSkipToolLoopAgentTypes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants