Set-default-parameter (#2128)

Auto-generated PR for branch: Set-default-parameter
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Changed default settings to allow up to 10 actions per step, disable
memory by default, and reduce structured data extraction size to 40,000
characters. Improved error message for missing element indices.

- **Bug Fixes**
- Updated error message to suggest scrolling for more elements when an
index is missing.

- **Refactors**
  - Set max_actions_per_step default to 10.
  - Set enable_memory default to False.
  - Reduced max_chars for extraction to 40,000.

<!-- End of auto-generated description by cubic. -->
This commit is contained in:
Magnus Müller
2025-06-26 17:23:48 +02:00
committed by GitHub
2 changed files with 5 additions and 5 deletions

View File

@@ -165,7 +165,7 @@ class Agent(Generic[Context]):
'data-state',
'aria-checked',
],
max_actions_per_step: int = 1,
max_actions_per_step: int = 10,
use_thinking: bool = True,
page_extraction_llm: BaseChatModel | None = None,
planner_llm: BaseChatModel | None = None,
@@ -174,7 +174,7 @@ class Agent(Generic[Context]):
extend_planner_system_message: str | None = None,
injected_agent_state: AgentState | None = None,
context: Context | None = None,
enable_memory: bool = True,
enable_memory: bool = False,
memory_config: MemoryConfig | None = None,
source: str | None = None,
file_system_path: str | None = None,

View File

@@ -224,7 +224,7 @@ class Controller(Generic[Context]):
if params.index not in selector_map:
# Return informative message with the new state instead of error
max_index = max(selector_map.keys()) if selector_map else -1
msg = f'Element with index {params.index} does not exist. Page has {len(selector_map)} interactive elements (indices 0-{max_index}). State has been refreshed - please use the updated element indices.'
msg = f'Element with index {params.index} does not exist. Page has {len(selector_map)} interactive elements (indices 0-{max_index}). State has been refreshed - please use the updated element indices or scroll to see more elements'
return ActionResult(extracted_content=msg, include_in_memory=True, success=False, long_term_memory=msg)
element_node = await browser_session.get_dom_element_by_index(params.index)
@@ -414,8 +414,8 @@ Only use this for extracting info from a single product/article page, not for en
iframe_markdown = ''
content += iframe_markdown
# limit to 60000 characters - remove text in the middle this is approx 20000 tokens
max_chars = 60000
# limit to 40000 characters - remove text in the middle this is approx 20000 tokens
max_chars = 40000
if len(content) > max_chars:
content = (
content[: max_chars // 2]