Repository navigation
fix(openai-agents-sdk): increase agent max turns to 50 - #316
Merged
Merged
Conversation
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Member
Author
|
🌟 Thanks for the kind review @mwbrooks! |
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.
Summary
The OpenAI Agents SDK for Python stops a run after 10 model calls by default, so longer requests that use several tools (including Slack MCP tools) fail with
MaxTurnsExceeded: Max turns (10) exceeded.This adds a
MAX_TURNS = 50constant inopenai-agents-sdk/agent/agent.pyand passesmax_turns=MAX_TURNSto both runner calls (Runner.run_syncwithout the Slack MCP server andRunner.runwith it). This matches the pattern inslack-samples/bolt-python-team-agentandslack-samples/bolt-python-coding-agent.The other variants already have no such low limit (Claude Agent SDK sets no turn limit by default, Pydantic AI's default request limit is 50, and the Vercel AI SDK for Python sets no step limit), so they are unchanged.
Testing
ruff check .andruff format --check .: pass, 64 files already formattedpytest: 14 passed, 0 failedopenai-agents0.26.0:max_turnsis a keyword onRunner.runandRunner.run_sync🤖 Generated with Claude Code