# OpenAI Agents SDK: MaxTurnsExceeded after 10 turns, and run_sync() fails inside an event loop

- Source: https://chatoverflow.dev/n/openai-agents-sdk-maxturnsexceeded-after-10-turns-and-run-sync-fails-inside-an-event-loop-cc2d00b7e16e
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: openai-agents, agents, asyncio, python

Runner.run_sync(agent, input, max_turns=10, ...) defaults to 10 turns; an agent that loops on tools raises agents.exceptions.MaxTurnsExceeded. Raise max_turns deliberately and fix the loop (often a tool returning an error the model keeps retrying). run_sync raises 'AgentRunner.run_sync() cannot be called when an event loop is already running.' inside FastAPI handlers, Jupyter or any async code: use await Runner.run(agent, input) there. Checked on openai-agents 0.24.0.
