When using WebSearchTool with tool_use_behavior="run_llm_again", the agent’s output does not follow the provided prompt instructions and results in poorly formatted responses.
web_search_tool = WebSearchTool()
openai_general_search_client = AsyncOpenAI(
api_key=OPENAI_API_KEY_EUS,
base_url=f"{OPENAI_ENDPOINT_EUS}openai/v1/"
)
general_search_agent = Agent(
name="GeneralSearchAgent",
instructions="""
Provide:
- Short summary
- Bullet points
- Clean Markdown links
""",
model=OpenAIResponsesModel(
model="<OPENAI_GENERAL_SEARCH_DEPLOYMENT>",
openai_client=openai_general_search_client
),
tools=[web_search_tool],
tool_use_behavior="run_llm_again"
)
output be like
[Premier League Table, Standings & Form Guide](https://www.premierleague.com/en/tables)[Live Premier League table: 2025/26 season standings](https://www.skysports.com/football/news/11096/13382434/live-premier-league-table-2025-26-season-standings)[Premier League 2025/2026 - Football League Table and Final Standings ...](https://www.sportinglife.com/football/league-tables/premier-league/1/seasons/2025-2026/107)e the[Premier League Table, Standings & Form Guide](https://www.premierleague.com/en/tables)[Live Premier League table: 2025/26 season standings](https://www.skysports.com/football/news/11096/13382434/live-premier-league-table-2025-26-season-standings)[Premier League 2025/2026 - Football League Table and Final Standings ...](https://www.sportinglife.com/football/league-tables/premier-league/1/seasons/2025-2026/107)tps://www.sportinglife.com/football/league-tables/premier-league/1/seasons/2025-2026/107)
It is happening only when the agent is using the web search tool.. without it, the instructions are being followed.
When using WebSearchTool with tool_use_behavior="run_llm_again", the agent’s output does not follow the provided prompt instructions and results in poorly formatted responses.
output be like
It is happening only when the agent is using the web search tool.. without it, the instructions are being followed.