Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://github.com/githubnext/gh-aw-internal/pull/768
This PR implements the
max-turnsfrontmatter parameter to limit the number of chat iterations within a single agentic run, providing a crucial safety mechanism to prevent runaway chat loops and control API costs.Overview
The
max-turnsfeature works by passing a turn limit directly to the AI engine (currently Claude Code action), which enforces the restriction at the engine level. This is different frommax-runswhich limits the number of separate workflow executions.New in this version: Engine capability validation ensures
max-turnscan only be used with compatible engines, preventing compilation errors at runtime.Usage
Add
max-turnsto any workflow frontmatter with a supported engine:When compiled, this generates a GitHub Actions workflow that passes
max_turns: 5to the Claude Code action, ensuring the AI stops after the specified number of iterations.Engine Compatibility
The system now validates engine capabilities during compilation:
Implementation Details
max-turnsas an integer field to the JSON schemamax_turnsin action inputsSupportsMaxTurns()method toAgenticEngineinterfaceBenefits
The feature seamlessly integrates with existing workflows and maintains backward compatibility - workflows without
max-turnscontinue to work unchanged.Fixes #713.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.