Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix: truncate done_output to max length in UpdateAgentTaskEvent.from_agent()

Cursor Agentcc4e5185d5e7
diff --git a/browser_use/agent/cloud_events.py b/browser_use/agent/cloud_events.py
index ed7b3c4b3..be6f00b1f 100644
--- a/browser_use/agent/cloud_events.py
+++ b/browser_use/agent/cloud_events.py
@@ -38,6 +38,8 @@ class UpdateAgentTaskEvent(BaseEvent):
raise ValueError('Agent must have _task_start_time attribute')
done_output = agent.history.final_result() if agent.history else None
+ if done_output and len(done_output) > MAX_STRING_LENGTH:
+ done_output = done_output[:MAX_STRING_LENGTH]
return cls(
id=str(agent.task_id),
user_id='', # To be filled by cloud handler