The system_prompt.md incorrectly documented the browser state format as:
[index]<type>text</type>
Example: [33]<div>User form</div>
But the actual serializer output format is:
[index]<tagname attribute=value />
With text content as child nodes on separate lines
This update:
- Corrects the format description to match actual DOMTreeSerializer output
- Updates examples to show realistic tree structure
- Documents |SCROLL| prefix for scrollable containers
- Documents |SHADOW(open/closed)| prefix for shadow DOM elements
Fixes#3782
The circuit breaker and agent error handler were using a hardcoded 20s
timeout, but the worst-case auto-reconnect window is ~48s (3 attempts *
15s + 7s delays). Handlers would raise ConnectionError while reconnection
was still in progress. Now both use BrowserSession.RECONNECT_WAIT_TIMEOUT
(54s) derived from the actual reconnect parameters.
Move action_name extraction before the try block so it's always
defined when the except block references it. Previously, if
_check_stop_or_pause() raised InterruptedError before action_name
was assigned, the exception handler would fail with:
UnboundLocalError: cannot access local variable 'action_name'
where it is not associated with a value
Also reuse the action_data dict for the 'done' action check since
it's now available earlier in the loop.
Co-authored-by: Magnus Müller <MagMueller@users.noreply.github.com>
The done_output field has max_length=100000, but agent.history.final_result()
can return arbitrarily long strings (e.g., large data extractions). This caused
Pydantic validation errors when constructing UpdateAgentTaskEvent at the end of
agent.run(), crashing the entire run even though the task itself succeeded.
Truncate done_output to MAX_STRING_LENGTH before passing to the constructor.
Co-authored-by: Magnus Müller <MagMueller@users.noreply.github.com>
- Add max_clickable_elements_length parameter to Agent.__init__ with default 40000
- Add max_clickable_elements_length to AgentSettings
- Pass parameter through MessageManager to AgentMessagePrompt
- Bump version to 0.11.10a2
Co-authored-by: Magnus Müller <MagMueller@users.noreply.github.com>
Fixes#3970
The LLM was typing literal placeholder names (e.g., 'user_name') instead
of wrapping them in <secret> tags (e.g., '<secret>user_name</secret>').
Changes to _get_sensitive_data_description():
- Added clear 'SENSITIVE DATA' header to draw attention
- Changed placeholder list format from Python list to bullet points
- Added explicit 'MUST' instruction emphasizing the required format
- Added concrete example using the first actual placeholder name
- Added explanation that the system will replace tags with actual values
This makes it much clearer to the LLM that it needs to wrap placeholder
names in <secret> tags for the automatic replacement mechanism to work.