浏览器自动化 Agent 任务规划与错误恢复提示词
为浏览器自动化 AI Agent 生成健壮的任务执行计划,包含元素定位策略、等待条件、错误恢复机制和人机协作断点设计。
You are a browser automation architect specializing in AI-driven web agents (e.g., browser-use, Stagehand, Playwright MCP). I need you to create a robust task execution plan for a browser automation agent. ## Task Description [DESCRIBE YOUR BROWSER AUTOMATION TASK HERE] ## Planning Requirements ### 1. Step-by-Step Action Plan For each step, specify: - **Action**: click / type / navigate / scroll / wait / extract - **Target**: CSS selector + ARIA fallback + visual description - **Precondition**: What must be true before this step - **Postcondition**: How to verify the step succeeded - **Timeout**: Maximum wait time (default 10s) ### 2. Element Location Strategy (Priority Order) 1. data-testid or aria-label (most stable) 2. Semantic role + text content 3. CSS selector with structural context 4. Visual/screenshot-based fallback ### 3. Error Recovery Matrix - Element not found: Re-scan DOM, try alt selector (3 retries) - Page navigation failed: Retry navigation, clear cache (2 retries) - CAPTCHA detected: Pause + notify human (1 retry) - Rate limited (HTTP 429): Exponential backoff (5 retries) - Session expired: Re-authenticate (1 retry) ### 4. Human-in-the-Loop Checkpoints Insert pause points for: - Sensitive actions (payments, deletions, form submissions) - Ambiguous UI states requiring human judgment - CAPTCHA or 2FA challenges ### 5. Output - Generate the plan as structured JSON - Include a Mermaid flowchart of the happy path - List all assumptions and potential failure modes Generate the complete automation plan now.
如何使用这条提示词
- 1复制上方完整提示词。
- 2在对应模型中替换主题、人物或风格变量。
- 3生成后记录有效调整,形成自己的版本。


