-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
Before submitting an issue, please:
- Check the documentation for relevant information
- Search existing issues to avoid duplicates
Environment Information
Please provide the following information to help us reproduce and resolve your issue:
Stagehand:
- Language/SDK: python
- Stagehand version: 0.5.4
AI Provider:
- Provider: google gemini
- Model: gemini-2.5-computer-use-preview-10-2025
Issue Description
It seems like the agent fails to execute when it gets an empty or undefined response from gemini api, plz fix
Steps to Reproduce
- run the agent for more than 1-2 minutes, I get this from time to time
Minimal Reproduction Code
config = StagehandConfig(
env="BROWSERBASE",
api_key=os.getenv("BROWSERBASE_API_KEY"),
project_id=os.getenv("BROWSERBASE_PROJECT_ID"),
headless=True,
dom_settle_timeout_ms=3000,
browserbase_session_create_params={
"browser_settings": {
"context": {
"id": os.getenv("BROWSERBASE_CONTEXT_ID"),
"persist": True
},
"viewport": {
"width": 1288,
"height": 711
}
},
"user_metadata": {
"test_name": test.name,
"suite_id": self.suite_id
}
},
model_name="google/gemini-2.5-flash-preview-05-20",
model_client_options={"apiKey": os.getenv("GEMINI_API_KEY")}
)
# Initialize Stagehand
stagehand = Stagehand(config)
await stagehand.init()
# Create agent
agent = stagehand.agent(
model="gemini-2.5-computer-use-preview-10-2025",
instructions=(
"You are a helpful web navigation assistant that helps test user interfaces. "
),
options={"apiKey": os.getenv("GEMINI_API_KEY")}
)
result = await agent.execute(instruction=instruction, max_steps=40)Error Messages / Log trace
2025-10-20 03:11:33 ERROR - Error executing step: Cannot read properties of
undefined (reading 'parts')
2025-10-20 03:11:33 ERROR - Error executing agent task: Cannot read properties
of undefined (reading 'parts')
{'sessionId': 'f44c4ba2-6d61-4200-a8b2-09a2436361a4'}
Screenshots / Videos
[Attach screenshots or videos here]
Metadata
Metadata
Assignees
Labels
No labels