Skip to content

Add max-tokens and max-iterations execution bounds to engine configuration#14149

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/add-engine-front-matter-flags
Closed

Add max-tokens and max-iterations execution bounds to engine configuration#14149
Copilot wants to merge 3 commits intomainfrom
copilot/add-engine-front-matter-flags

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

Extends execution bounding configuration beyond max-turns to support max-tokens (context window limit) and max-iterations (alternative turn limit nomenclature) based on Claude and Copilot CLI capabilities.

Changes

  • EngineConfig extensions: Added MaxTokens and MaxIterations string fields for token budget and iteration limits
  • Capability detection: Extended CapabilityProvider interface with SupportsMaxTokens() and SupportsMaxIterations() methods
  • Engine support matrix:
    • Claude: max-turns ✓, max-tokens ✓ (documented in CLI)
    • Custom: All flags ✓ (maximum flexibility)
    • Copilot/Codex: None ✓ (pending CLI verification)
  • Validation: Added validateMaxTokensSupport() and validateMaxIterationsSupport() with strict/non-strict mode handling (error vs warn)
  • Schema: Extended engine_config definition with field examples and descriptions
  • Tests: 12 integration tests covering supported/unsupported engine scenarios and capability detection

Usage

engine:
  id: claude
  max-turns: 15      # existing
  max-tokens: 4096   # new: context window limit

engine:
  id: custom
  max-iterations: 3  # new: alternative to max-turns

Unsupported flags produce errors in strict mode, warnings otherwise, maintaining compilation safety while allowing engine capability evolution.

Original prompt

Review the Claude cli documentation and add every flag that allows to bound the execution of the agent to the engine front matter element.

Typically a "max-"...

Look for compatibility for other engines. Centralize in a single interface . Adapt the agentic engine interface to review the flags and refuse unsupported flags in strict mode, warning in non strict.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 6, 2026 14:13
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add flags for binding agent execution to engine front matter Add max-tokens and max-iterations execution bounds to engine configuration Feb 6, 2026
Copilot AI requested a review from pelikhan February 6, 2026 14:19
@pelikhan
Copy link
Contributor

pelikhan commented Feb 6, 2026

@copilot remove max-iterations, we already have max turns

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