browser-use
browser-use copied to clipboard
Invalid schema for function 'AgentOutput': [] is not of type 'object'.
Bug Description
while running the following code:
load_dotenv()
api_key = "bc049c........"
base_url = 'https://api.zhizengzeng.com/v1'
os.environ['OPENAI_API_KEY'] = api_key
async def main():
agent = Agent(
task="Go to Reddit, search for 'browser-use', click on the first post and return the first comment.",
llm=ChatOpenAI(model="gpt-4o", base_url="https://api.zhizengzeng.com/v1"),
)
result = await agent.run()
print(result)
asyncio.run(main())
I got the following error:
(browser-use) ~/aigc/browser-use/examples $ python3 reddit.py
INFO [browser_use] BrowserUse logging setup complete with level info
INFO [root] Anonymized telemetry enabled. See https://docs.browser-use.com/development/telemetry for more information.
INFO [agent] 🚀 Starting task: Go to Reddit, search for 'browser-use', click on the first post and return the first comment.
INFO [agent] 📍 Step 1
ERROR [agent] ❌ Result failed 1/3 times:
{'message': "Invalid schema for function 'AgentOutput': [] is not of type 'object'. (request id: 20250218192810419602350YUx7SzXc)", 'type': 'invalid_request_error', 'param': 'tools[0].function.parameters', 'code': 'invalid_function_parameters'}
INFO [agent] 📍 Step 1
ERROR [agent] ❌ Result failed 2/3 times:
{'message': "Invalid schema for function 'AgentOutput': [] is not of type 'object'. (request id: 20250218192814976962507QsF6dnb4)", 'type': 'invalid_request_error', 'param': 'tools[0].function.parameters', 'code': 'invalid_function_parameters'}
INFO [agent] 📍 Step 1
ERROR [agent] ❌ Result failed 3/3 times:
{'message': "Invalid schema for function 'AgentOutput': [] is not of type 'object'. (request id: 20250218192817310528704QvzosFbH)", 'type': 'invalid_request_error', 'param': 'tools[0].function.parameters', 'code': 'invalid_function_parameters'}
ERROR [agent] ❌ Stopping due to 3 consecutive failures
INFO [agent] Created GIF at agent_history.gif
AgentHistoryList(all_results=[ActionResult(is_done=False, extracted_content=None, error='{\'message\': "Invalid schema for function \'AgentOutput\': [] is not of type \'object\'. (request id: 20250218192810419602350YUx7SzXc)", \'type\': \'invalid_request_error\', \'param\': \'tools[0].function.parameters\', \'code\': \'invalid_function_parameters\'}', include_in_memory=True), ActionResult(is_done=False, extracted_content=None, error='{\'message\': "Invalid schema for function \'AgentOutput\': [] is not of type \'object\'. (request id: 20250218192814976962507QsF6dnb4)", \'type\': \'invalid_request_error\', \'param\': \'tools[0].function.parameters\', \'code\': \'invalid_function_parameters\'}', include_in_memory=True), ActionResult(is_done=False, extracted_content=None, error='{\'message\': "Invalid schema for function \'AgentOutput\': [] is not of type \'object\'. (request id: 20250218192817310528704QvzosFbH)", \'type\': \'invalid_request_error\', \'param\': \'tools[0].function.parameters\', \'code\': \'invalid_function_parameters\'}', include_in_memory=True)], all_model_outputs=[])
Reproduction Steps
- install local development of browser use version 0.1.37
- run the above code
- see the error
Code Sample
load_dotenv()
api_key = "bc049c........"
base_url = 'https://api.zhizengzeng.com/v1'
os.environ['OPENAI_API_KEY'] = api_key
async def main():
agent = Agent(
task="Go to Reddit, search for 'browser-use', click on the first post and return the first comment.",
llm=ChatOpenAI(model="gpt-4o", base_url="https://api.zhizengzeng.com/v1"),
)
result = await agent.run()
print(result)
asyncio.run(main())
Version
Version: 0.1.37
LLM Model
GPT-4o
Operating System
macos 15.3
Relevant Log Output
(browser-use) ~/aigc/browser-use/examples $ python3 reddit.py
INFO [browser_use] BrowserUse logging setup complete with level info
INFO [root] Anonymized telemetry enabled. See https://docs.browser-use.com/development/telemetry for more information.
INFO [agent] 🚀 Starting task: Go to Reddit, search for 'browser-use', click on the first post and return the first comment.
INFO [agent] 📍 Step 1
ERROR [agent] ❌ Result failed 1/3 times:
{'message': "Invalid schema for function 'AgentOutput': [] is not of type 'object'. (request id: 20250218192810419602350YUx7SzXc)", 'type': 'invalid_request_error', 'param': 'tools[0].function.parameters', 'code': 'invalid_function_parameters'}
INFO [agent] 📍 Step 1
ERROR [agent] ❌ Result failed 2/3 times:
{'message': "Invalid schema for function 'AgentOutput': [] is not of type 'object'. (request id: 20250218192814976962507QsF6dnb4)", 'type': 'invalid_request_error', 'param': 'tools[0].function.parameters', 'code': 'invalid_function_parameters'}
INFO [agent] 📍 Step 1
ERROR [agent] ❌ Result failed 3/3 times:
{'message': "Invalid schema for function 'AgentOutput': [] is not of type 'object'. (request id: 20250218192817310528704QvzosFbH)", 'type': 'invalid_request_error', 'param': 'tools[0].function.parameters', 'code': 'invalid_function_parameters'}
ERROR [agent] ❌ Stopping due to 3 consecutive failures
INFO [agent] Created GIF at agent_history.gif
AgentHistoryList(all_results=[ActionResult(is_done=False, extracted_content=None, error='{\'message\': "Invalid schema for function \'AgentOutput\': [] is not of type \'object\'. (request id: 20250218192810419602350YUx7SzXc)", \'type\': \'invalid_request_error\', \'param\': \'tools[0].function.parameters\', \'code\': \'invalid_function_parameters\'}', include_in_memory=True), ActionResult(is_done=False, extracted_content=None, error='{\'message\': "Invalid schema for function \'AgentOutput\': [] is not of type \'object\'. (request id: 20250218192814976962507QsF6dnb4)", \'type\': \'invalid_request_error\', \'param\': \'tools[0].function.parameters\', \'code\': \'invalid_function_parameters\'}', include_in_memory=True), ActionResult(is_done=False, extracted_content=None, error='{\'message\': "Invalid schema for function \'AgentOutput\': [] is not of type \'object\'. (request id: 20250218192817310528704QvzosFbH)", \'type\': \'invalid_request_error\', \'param\': \'tools[0].function.parameters\', \'code\': \'invalid_function_parameters\'}', include_in_memory=True)], all_model_outputs=[])