---
type: email
from: Deniz Özdemirli  <notifications@github.com>
subject: [openai/openai-agents-python] agents.exceptions.MaxTurnsExceeded:

 (Issue #1442)
received: 2026-03-05 10:04:07
date_header: Wed, 13 Aug 2025 04:03:17 -0700
priority: normal
status: awaiting_approval
uid: 27437
---

## Email Content

**From:** Deniz Özdemirli  <notifications@github.com>
**Subject:** [openai/openai-agents-python] agents.exceptions.MaxTurnsExceeded:

 (Issue #1442)
**Date:** Wed, 13 Aug 2025 04:03:17 -0700

### Body (preview)

02deno created an issue (openai/openai-agents-python#1442)





### Describe the bug

Whatever I do I always encounter this error: agents.exceptions.MaxTurnsExceeded: Max turns (10) exceeded. I am returning dummy string and output type is correct. I did try to increase/decrease max_turns parameter too.



### Debug information

openai  ->  1.99.1

openai-agents   -> 0.2.5

python -> 3..11.9





This is my code: 



import asyncio, json

from typing import Any, Dict, List, Optional

from dataclasses import dataclass, field



import httpx

import mlflow

from openai import AsyncOpenAI

from agents import Agent, OpenAIChatCompletionsModel, Runner, WebSearchTool, enable_verbose_stdout_logging, function_tool, set_default_openai_api, set_default_openai_client, set_trace_processors

from pydantic import BaseModel, Field

import requests



enable_verbose_stdout_logging()

set_trace_processors([])  # disable OpenAI tracing



# # Enable auto tracing for OpenAI Agents SDK

mlflow.openai.autolog()



# Optional: Set a tracking URI and an experiment

mlflow.set_tracking_uri("http://localhost:5000")

mlflow.set_experiment("OpenAI Agent Plan")



class Step(BaseModel):

    agent: str

    input: Any = "last"   # could be "last" or an object



class Plan(BaseModel):

    stages: List[List[Step]] = Field(default_factory=list)

    target_language: Optional[str] = None



class WebSearchResult(BaseModel):

    result: str



local_client = AsyncOpenAI(

    base_url= llama_3_3_url,

    api_key="local",

    http_client=httpx.AsyncClient(verify = False),

    timeout=10

)

set_default_openai_client(local_client)

set_default_openai_api("chat_completions")



model = OpenAIChatCompletionsModel(model=llama_3_3_model_name, openai_client=local_client)





# ── Agent registry (add/remove freely) ──────────────────────────────────────

@dataclass

class AgentSpec:

    name: str

    model: str

    instructions: str

    capabilities: List[str]            # natural-language descri

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
