Open
Description
from openai import OpenAI
from openai.agent import Agent
client = OpenAI(api_key="sk-...") # Use your key here
Define a simple agent (no tools used)
agent = Agent(
name="TestAgent",
instructions="Answer questions as helpfully as possible.",
)
Try running the agent with an empty string (or malformed query)
response = agent.run("")
print(response)
OUTPUT:
openai.BadRequestError: Error code: 400 - {'error': {'message': 'Invalid request: prompt is empty or malformed.', 'type': 'invalid_request_error', 'param': None, 'code': None}}
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
yusuf-eren commentedon May 19, 2025
Hi @aliraza108 , I tried to reproduce the bug but couldn't get the same response.
Here is my full code;
Output:
Which version do you use? And how you ran the file?
aliraza108 commentedon May 20, 2025