{
  "canonical_name": "nottelabs/notte",
  "compilation_id": "pack_766828fa02bd41d69d8e0c46dad9697b",
  "created_at": "2026-05-14T05:11:43.570388+00:00",
  "created_by": "project-pack-compiler",
  "feedback": {
    "carrier_selection_notes": [
      "viable_asset_types=mcp_config, recipe, host_instruction, eval, preflight",
      "recommended_asset_types=mcp_config, recipe, host_instruction, eval, preflight"
    ],
    "evidence_delta": {
      "confirmed_claims": [
        "identity_anchor_present",
        "capability_and_host_targets_present",
        "install_path_declared_or_better"
      ],
      "missing_required_fields": [],
      "must_verify_forwarded": [
        "Run or inspect `pip install notte` in an isolated environment.",
        "Confirm the project exposes the claimed capability to at least one target host."
      ],
      "quickstart_execution_scope": "allowlisted_sandbox_smoke",
      "sandbox_command": "pip install notte",
      "sandbox_container_image": "python:3.12-slim",
      "sandbox_execution_backend": "docker",
      "sandbox_planner_decision": "llm_execute_isolated_install",
      "sandbox_validation_id": "sbx_7c72aa1d52be4f4f890b7156152c1ae7"
    },
    "feedback_event_type": "project_pack_compilation_feedback",
    "learning_candidate_reasons": [],
    "template_gaps": []
  },
  "identity": {
    "canonical_id": "project_810c7b266241f3f0371a8fe76b94e566",
    "canonical_name": "nottelabs/notte",
    "homepage_url": null,
    "license": "unknown",
    "repo_url": "https://github.com/nottelabs/notte",
    "slug": "notte",
    "source_packet_id": "phit_360abee9881e44c1aa85b0faa3ddff1f",
    "source_validation_id": "dval_ee6e6f447d8946f9a39f3a30f16f1c16"
  },
  "merchandising": {
    "best_for": "需要流程自动化能力，并使用 chatgpt的用户",
    "github_forks": 180,
    "github_stars": 1953,
    "one_liner_en": "🌸 Best framework to build web agents, and deploy serverless web automation functions on reliable browser infra.",
    "one_liner_zh": "🌸 Best framework to build web agents, and deploy serverless web automation functions on reliable browser infra.",
    "primary_category": {
      "category_id": "workflow-automation",
      "confidence": "high",
      "name_en": "Workflow Automation",
      "name_zh": "流程自动化",
      "reason": "matched_keywords:automation, agent, browser"
    },
    "target_user": "使用 chatgpt 等宿主 AI 的用户",
    "title_en": "notte",
    "title_zh": "notte 能力包",
    "visible_tags": [
      {
        "label_en": "Browser Agents",
        "label_zh": "浏览器 Agent",
        "source": "repo_evidence_project_characteristics",
        "tag_id": "product_domain-browser-agents",
        "type": "product_domain"
      },
      {
        "label_en": "Web Task Automation",
        "label_zh": "网页任务自动化",
        "source": "repo_evidence_project_characteristics",
        "tag_id": "user_job-web-task-automation",
        "type": "user_job"
      },
      {
        "label_en": "Natural-language Web Actions",
        "label_zh": "自然语言网页操作",
        "source": "repo_evidence_project_characteristics",
        "tag_id": "core_capability-natural-language-web-actions",
        "type": "core_capability"
      },
      {
        "label_en": "Page Observation and Action Planning",
        "label_zh": "页面观察与动作规划",
        "source": "repo_evidence_project_characteristics",
        "tag_id": "workflow_pattern-page-observation-and-action-planning",
        "type": "workflow_pattern"
      },
      {
        "label_en": "Structured Data Extraction",
        "label_zh": "结构化数据提取",
        "source": "repo_evidence_project_characteristics",
        "tag_id": "selection_signal-structured-data-extraction",
        "type": "selection_signal"
      }
    ]
  },
  "packet_id": "phit_360abee9881e44c1aa85b0faa3ddff1f",
  "page_model": {
    "artifacts": {
      "artifact_slug": "notte",
      "files": [
        "PROJECT_PACK.json",
        "QUICK_START.md",
        "PROMPT_PREVIEW.md",
        "HUMAN_MANUAL.md",
        "AI_CONTEXT_PACK.md",
        "BOUNDARY_RISK_CARD.md",
        "PITFALL_LOG.md",
        "REPO_INSPECTION.json",
        "REPO_INSPECTION.md",
        "CAPABILITY_CONTRACT.json",
        "EVIDENCE_INDEX.json",
        "CLAIM_GRAPH.json"
      ],
      "required_files": [
        "PROJECT_PACK.json",
        "QUICK_START.md",
        "PROMPT_PREVIEW.md",
        "HUMAN_MANUAL.md",
        "AI_CONTEXT_PACK.md",
        "BOUNDARY_RISK_CARD.md",
        "PITFALL_LOG.md",
        "REPO_INSPECTION.json"
      ]
    },
    "detail": {
      "capability_source": "Project Hit Packet + DownstreamValidationResult",
      "commands": [
        {
          "command": "pip install notte",
          "label": "Python / pip · 官方安装入口",
          "source": "https://github.com/nottelabs/notte#readme",
          "verified": true
        }
      ],
      "display_tags": [
        "浏览器 Agent",
        "网页任务自动化",
        "自然语言网页操作",
        "页面观察与动作规划",
        "结构化数据提取"
      ],
      "eyebrow": "流程自动化",
      "glance": [
        {
          "body": "判断自己是不是目标用户。",
          "label": "最适合谁",
          "value": "需要流程自动化能力，并使用 chatgpt的用户"
        },
        {
          "body": "先理解能力边界，再决定是否继续。",
          "label": "核心价值",
          "value": "🌸 Best framework to build web agents, and deploy serverless web automation functions on reliable browser infra."
        },
        {
          "body": "未完成验证前保持审慎。",
          "label": "继续前",
          "value": "publish to Doramagic.ai project surfaces"
        }
      ],
      "guardrail_source": "Boundary & Risk Card",
      "guardrails": [
        {
          "body": "Prompt Preview 只展示流程，不证明项目已安装或运行。",
          "label": "Check 1",
          "value": "不要把试用当真实运行"
        },
        {
          "body": "chatgpt",
          "label": "Check 2",
          "value": "确认宿主兼容"
        },
        {
          "body": "publish to Doramagic.ai project surfaces",
          "label": "Check 3",
          "value": "先隔离验证"
        }
      ],
      "mode": "mcp_config, recipe, host_instruction, eval, preflight",
      "pitfall_log": {
        "items": [
          {
            "body": "GitHub 社区证据显示该项目存在一个安装相关的待验证问题：v1.8.8",
            "category": "安装坑",
            "evidence": [
              "community_evidence:github | cevd_5224b46e2312471c976888e8a2f8f4a6 | https://github.com/nottelabs/notte/releases/tag/v1.8.8 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：v1.8.8",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.13",
            "category": "配置坑",
            "evidence": [
              "community_evidence:github | cevd_56505da48cd74758ab7a9a1d82092e18 | https://github.com/nottelabs/notte/releases/tag/v1.8.13 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：v1.8.13",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.14",
            "category": "配置坑",
            "evidence": [
              "community_evidence:github | cevd_8f78a2591cea4f5aad8bfa0cb0ea15a0 | https://github.com/nottelabs/notte/releases/tag/v1.8.14 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：v1.8.14",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.15",
            "category": "配置坑",
            "evidence": [
              "community_evidence:github | cevd_f611f1d0dd2440af8e84e9544ab1bdb6 | https://github.com/nottelabs/notte/releases/tag/v1.8.15 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：v1.8.15",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.6",
            "category": "配置坑",
            "evidence": [
              "community_evidence:github | cevd_0ed3c86ff7a34e5896a4daeb75552d4d | https://github.com/nottelabs/notte/releases/tag/v1.8.6 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：v1.8.6",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.9",
            "category": "配置坑",
            "evidence": [
              "community_evidence:github | cevd_6195971390e8494f88083c862aef7eb6 | https://github.com/nottelabs/notte/releases/tag/v1.8.9 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：v1.8.9",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "README/documentation is current enough for a first validation pass.",
            "category": "能力坑",
            "evidence": [
              "capability.assumptions | github_repo:900152988 | https://github.com/nottelabs/notte | README/documentation is current enough for a first validation pass."
            ],
            "severity": "medium",
            "suggested_check": "将假设转成下游验证清单。",
            "title": "能力判断依赖假设",
            "user_impact": "假设不成立时，用户拿不到承诺的能力。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个运行相关的待验证问题：v1.8.7",
            "category": "运行坑",
            "evidence": [
              "community_evidence:github | cevd_ab102ac99c2441118475601c34ab0ee9 | https://github.com/nottelabs/notte/releases/tag/v1.8.7 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：v1.8.7",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "未记录 last_activity_observed。",
            "category": "维护坑",
            "evidence": [
              "evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | last_activity_observed missing"
            ],
            "severity": "medium",
            "suggested_check": "补 GitHub 最近 commit、release、issue/PR 响应信号。",
            "title": "维护活跃度未知",
            "user_impact": "新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。"
          },
          {
            "body": "no_demo",
            "category": "安全/权限坑",
            "evidence": [
              "downstream_validation.risk_items | github_repo:900152988 | https://github.com/nottelabs/notte | no_demo; severity=medium"
            ],
            "severity": "medium",
            "suggested_check": "进入安全/权限治理复核队列。",
            "title": "下游验证发现风险项",
            "user_impact": "下游已经要求复核，不能在页面中弱化。"
          },
          {
            "body": "No sandbox install has been executed yet; downstream must verify before user use.",
            "category": "安全/权限坑",
            "evidence": [
              "risks.safety_notes | github_repo:900152988 | https://github.com/nottelabs/notte | No sandbox install has been executed yet; downstream must verify before user use."
            ],
            "severity": "medium",
            "suggested_check": "转成明确权限清单和安全审查提示。",
            "title": "存在安全注意事项",
            "user_impact": "用户安装前需要知道权限边界和敏感操作。"
          },
          {
            "body": "no_demo",
            "category": "安全/权限坑",
            "evidence": [
              "risks.scoring_risks | github_repo:900152988 | https://github.com/nottelabs/notte | no_demo; severity=medium"
            ],
            "severity": "medium",
            "suggested_check": "把风险写入边界卡，并确认是否需要人工复核。",
            "title": "存在评分风险",
            "user_impact": "风险会影响是否适合普通用户安装。"
          },
          {
            "body": "issue_or_pr_quality=unknown。",
            "category": "维护坑",
            "evidence": [
              "evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | issue_or_pr_quality=unknown"
            ],
            "severity": "low",
            "suggested_check": "抽样最近 issue/PR，判断是否长期无人处理。",
            "title": "issue/PR 响应质量未知",
            "user_impact": "用户无法判断遇到问题后是否有人维护。"
          },
          {
            "body": "release_recency=unknown。",
            "category": "维护坑",
            "evidence": [
              "evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | release_recency=unknown"
            ],
            "severity": "low",
            "suggested_check": "确认最近 release/tag 和 README 安装命令是否一致。",
            "title": "发布节奏不明确",
            "user_impact": "安装命令和文档可能落后于代码，用户踩坑概率升高。"
          }
        ],
        "source": "ProjectPitfallLog + ProjectHitPacket + validation + community signals",
        "summary": "发现 14 个潜在踩坑项，其中 0 个为 high/blocking；最高优先级：安装坑 - 来源证据：v1.8.8。",
        "title": "踩坑日志"
      },
      "snapshot": {
        "contributors": 13,
        "forks": 180,
        "license": "unknown",
        "note": "站点快照，非实时质量证明；用于开工前背景判断。",
        "stars": 1953
      },
      "source_url": "https://github.com/nottelabs/notte",
      "steps": [
        {
          "body": "不安装项目，先体验能力节奏。",
          "code": "preview",
          "title": "先试 Prompt"
        },
        {
          "body": "理解输入、输出、失败模式和边界。",
          "code": "manual",
          "title": "读说明书"
        },
        {
          "body": "把上下文交给宿主 AI 继续工作。",
          "code": "context",
          "title": "带给 AI"
        },
        {
          "body": "进入主力环境前先完成安装入口与风险边界验证。",
          "code": "verify",
          "title": "沙箱验证"
        }
      ],
      "subtitle": "🌸 Best framework to build web agents, and deploy serverless web automation functions on reliable browser infra.",
      "title": "notte 能力包",
      "trial_prompt": "# notte - Prompt Preview\n\n> 复制下面这段 Prompt 到你常用的 AI，先试一次，不需要安装。\n> 它的目标是让你直接体验这个项目的服务方式，而不是阅读项目介绍。\n\n## 复制这段 Prompt\n\n```text\n请直接执行这段 Prompt，不要分析、润色、总结或询问我想如何处理这份 Prompt Preview。\n\n你现在扮演 notte 的“安装前体验版”。\n这不是项目介绍、不是评价报告、不是 README 总结。你的任务是让我用最小成本体验它的核心服务。\n\n我的试用任务：我想用它完成一个真实的流程自动化任务。\n我常用的宿主 AI：chatgpt\n\n【体验目标】\n围绕我的真实任务，现场演示这个项目如何把输入转成 示例引导, 判断线索。重点是让我感受到工作方式，而不是给我项目背景。\n\n【业务流约束】\n- 你必须像一个正在提供服务的项目能力包，而不是像一个讲解员。\n- 每一轮只推进一个步骤；提出问题后必须停下来等我回答。\n- 每一步都必须让我感受到一个具体服务动作：澄清、整理、规划、检查、判断或收尾。\n- 每一步都要说明：当前目标、你需要我提供什么、我回答后你会产出什么。\n- 不要安装、不要运行命令、不要写代码、不要声称测试通过、不要声称已经修改文件。\n- 需要真实安装或宿主加载后才能验证的内容，必须明确说“这一步需要安装后验证”。\n- 如果我说“用示例继续”，你可以用虚构示例推进，但仍然不能声称真实执行。\n\n【可体验服务能力】\n- 安装前能力预览: 🌸 Best framework to build web agents, and deploy serverless web automation functions on reliable browser infra. 输入：用户任务, 当前 AI 对话上下文；输出：示例引导, 判断线索。\n\n【必须安装后才可验证的能力】\n- 命令行启动或安装流程: 项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 输入：终端环境, 包管理器, 项目依赖；输出：安装结果, 列表/更新/运行结果。\n\n【核心服务流】\n请严格按这个顺序带我体验。不要一次性输出完整流程：\n1. project-introduction：项目介绍。围绕“项目介绍”模拟一次用户任务，不展示安装或运行结果。\n2. quickstart-guide：快速入门指南。围绕“快速入门指南”模拟一次用户任务，不展示安装或运行结果。\n3. package-structure：包结构分析。围绕“包结构分析”模拟一次用户任务，不展示安装或运行结果。\n4. core-modules：核心模块实现。围绕“核心模块实现”模拟一次用户任务，不展示安装或运行结果。\n5. agent-implementation：Agent实现与生命周期。围绕“Agent实现与生命周期”模拟一次用户任务，不展示安装或运行结果。\n\n【核心能力体验剧本】\n每一步都必须按“输入 -> 服务动作 -> 中间产物”执行。不要只说流程名：\n1. project-introduction\n输入：用户提供的“项目介绍”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n2. quickstart-guide\n输入：用户提供的“快速入门指南”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n3. package-structure\n输入：用户提供的“包结构分析”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n4. core-modules\n输入：用户提供的“核心模块实现”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n5. agent-implementation\n输入：用户提供的“Agent实现与生命周期”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n【项目服务规则】\n这些规则决定你如何服务用户。不要解释规则本身，而要在每一步执行时遵守：\n- 先确认用户任务、输入材料和成功标准，再模拟项目能力。\n- 每一步都必须形成可检查的小产物，并等待用户确认后再继续。\n- 凡是需要安装、调用工具或访问外部服务的能力，都必须标记为安装后验证。\n\n【每一步的服务约束】\n- Step 1 / project-introduction：Step 1 必须围绕“项目介绍”形成一个小中间产物，并等待用户确认。\n- Step 2 / quickstart-guide：Step 2 必须围绕“快速入门指南”形成一个小中间产物，并等待用户确认。\n- Step 3 / package-structure：Step 3 必须围绕“包结构分析”形成一个小中间产物，并等待用户确认。\n- Step 4 / core-modules：Step 4 必须围绕“核心模块实现”形成一个小中间产物，并等待用户确认。\n- Step 5 / agent-implementation：Step 5 必须围绕“Agent实现与生命周期”形成一个小中间产物，并等待用户确认。\n\n【边界与风险】\n- 不要声称已经安装、运行、调用 API、读写本地文件或完成真实任务。\n- 安装前预览只能展示工作方式，不能证明兼容性、性能或输出质量。\n- 涉及安装、插件加载、工具调用或外部服务的能力必须安装后验证。\n\n【可追溯依据】\n这些路径只用于你内部校验或在我追问“依据是什么”时简要引用。不要在首次回复主动展开：\n- https://github.com/nottelabs/notte\n- https://github.com/nottelabs/notte#readme\n- README.md\n- pyproject.toml\n- docs/setup.md\n- docs/sdk_tutorial.md\n- .env.example\n- packages/notte-core/pyproject.toml\n- packages/notte-browser/pyproject.toml\n- packages/notte-agent/pyproject.toml\n- packages/notte-sdk/pyproject.toml\n- packages/notte-llm/pyproject.toml\n\n【首次问题规则】\n- 首次三问必须先确认用户目标、成功标准和边界，不要提前进入工具、安装或实现细节。\n- 如果后续需要技术条件、文件路径或运行环境，必须等用户确认目标后再追问。\n\n首次回复必须只输出下面 4 个部分：\n1. 体验开始：用 1 句话说明你将带我体验 notte 的核心服务。\n2. 当前步骤：明确进入 Step 1，并说明这一步要解决什么。\n3. 你会如何服务我：说明你会先改变我完成任务的哪个动作。\n4. 只问我 3 个问题，然后停下等待回答。\n\n首次回复禁止输出：后续完整流程、证据清单、安装命令、项目评价、营销文案、已经安装或运行的说法。\n\nStep 1 / brainstorming 的二轮协议：\n- 我回答首次三问后，你仍然停留在 Step 1 / brainstorming，不要进入 Step 2。\n- 第二次回复必须产出 6 个部分：澄清后的任务定义、成功标准、边界条件、\n  2-3 个可选方案、每个方案的权衡、推荐方案。\n- 第二次回复最后必须问我是否确认推荐方案；只有我明确确认后，才能进入下一步。\n- 第二次回复禁止输出 git worktree、代码计划、测试文件、命令或真实执行结果。\n\n后续对话规则：\n- 我回答后，你先完成当前步骤的中间产物并等待确认；只有我确认后，才能进入下一步。\n- 每一步都要生成一个小的中间产物，例如澄清后的目标、计划草案、测试意图、验证清单或继续/停止判断。\n- 所有演示都写成“我会建议/我会引导/这一步会形成”，不要写成已经真实执行。\n- 不要声称已经测试通过、文件已修改、命令已运行或结果已产生。\n- 如果某个能力必须安装后验证，请直接说“这一步需要安装后验证”。\n- 如果证据不足，请明确说“证据不足”，不要补事实。\n```\n",
      "voices": [
        {
          "body": "来源平台：github。github/github_release: v1.8.15（https://github.com/nottelabs/notte/releases/tag/v1.8.15）；github/github_release: v1.8.14（https://github.com/nottelabs/notte/releases/tag/v1.8.14）；github/github_release: v1.8.13（https://github.com/nottelabs/notte/releases/tag/v1.8.13）；github/github_release: v1.8.11（https://github.com/nottelabs/notte/releases/tag/v1.8.11）；github/github_release: v1.8.10（https://github.com/nottelabs/notte/releases/tag/v1.8.10）；github/github_release: v1.8.9（https://github.com/nottelabs/notte/releases/tag/v1.8.9）；github/github_release: v1.8.8（https://github.com/nottelabs/notte/releases/tag/v1.8.8）；github/github_release: v1.8.7（https://github.com/nottelabs/notte/releases/tag/v1.8.7）；github/github_release: v1.8.6（https://github.com/nottelabs/notte/releases/tag/v1.8.6）。这些是项目级外部声音，不作为单独质量证明。",
          "items": [
            {
              "kind": "github_release",
              "source": "github",
              "title": "v1.8.15",
              "url": "https://github.com/nottelabs/notte/releases/tag/v1.8.15"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "v1.8.14",
              "url": "https://github.com/nottelabs/notte/releases/tag/v1.8.14"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "v1.8.13",
              "url": "https://github.com/nottelabs/notte/releases/tag/v1.8.13"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "v1.8.11",
              "url": "https://github.com/nottelabs/notte/releases/tag/v1.8.11"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "v1.8.10",
              "url": "https://github.com/nottelabs/notte/releases/tag/v1.8.10"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "v1.8.9",
              "url": "https://github.com/nottelabs/notte/releases/tag/v1.8.9"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "v1.8.8",
              "url": "https://github.com/nottelabs/notte/releases/tag/v1.8.8"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "v1.8.7",
              "url": "https://github.com/nottelabs/notte/releases/tag/v1.8.7"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "v1.8.6",
              "url": "https://github.com/nottelabs/notte/releases/tag/v1.8.6"
            }
          ],
          "status": "已收录 9 条来源",
          "title": "社区讨论"
        }
      ]
    },
    "homepage_card": {
      "category": "流程自动化",
      "desc": "🌸 Best framework to build web agents, and deploy serverless web automation functions on reliable browser infra.",
      "effort": "安装已验证",
      "forks": 180,
      "icon": "bolt",
      "name": "notte 能力包",
      "risk": "可发布",
      "slug": "notte",
      "stars": 1953,
      "tags": [
        "浏览器 Agent",
        "网页任务自动化",
        "自然语言网页操作",
        "页面观察与动作规划",
        "结构化数据提取"
      ],
      "thumb": "gray",
      "type": "MCP 配置"
    },
    "manual": {
      "markdown": "# https://github.com/nottelabs/notte 项目说明书\n\n生成时间：2026-05-14 04:53:36 UTC\n\n## 目录\n\n- [项目介绍](#project-introduction)\n- [快速入门指南](#quickstart-guide)\n- [包结构分析](#package-structure)\n- [核心模块实现](#core-modules)\n- [Agent实现与生命周期](#agent-implementation)\n- [结构化输出](#structured-output)\n- [会话管理系统](#session-management)\n- [动作执行系统](#action-system)\n- [凭证保险库](#vault-credentials)\n- [文件存储系统](#file-storage)\n\n<a id='project-introduction'></a>\n\n## 项目介绍\n\n### 相关页面\n\n相关主题：[快速入门指南](#quickstart-guide), [包结构分析](#package-structure)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [README.md](https://github.com/nottelabs/notte/blob/main/README.md)\n- [packages/notte-core/src/notte_core/actions/actions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/actions/actions.py)\n- [packages/notte-core/src/notte_core/errors/processing.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/errors/processing.py)\n- [packages/notte-sdk/src/notte_sdk/endpoints/sessions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-sdk/src/notte_sdk/endpoints/sessions.py)\n- [packages/notte-agent/src/notte_agent/gufo/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/gufo/system.md)\n</details>\n\n# 项目介绍\n\n## 项目概述\n\nNotte 是一款面向互联网原生代理系统（Internet-native Agentic Systems）的软件套件，旨在为大型语言模型（LLM）代理提供强大的浏览器自动化和网页交互能力。Notte 将互联网转化为一个结构化、可导航的空间，使每个网站都成为智能代理可以精确解读和操作的地图。\n\n资料来源：[README.md:1]()\n\n## 核心定位\n\nNotte 的核心价值主张在于创建一个可编程的抽象层，覆盖在真实网页之上。通过该技术栈，AI 代理能够：\n\n- 精确解读网页内容结构\n- 执行复杂的浏览器交互操作\n- 实现端到端的自动化工作流\n\n资料来源：[README.md:1]()\n\n## 技术架构\n\n### 包结构\n\nNotte 采用多包架构设计，包含以下核心组件：\n\n| 包名 | 描述 |\n|------|------|\n| `notte-core` | 核心功能模块，包含动作定义、错误处理等基础组件 |\n| `notte-llm` | LLM 集成模块，提供提示词模板和文档分析能力 |\n| `notte-sdk` | Python SDK 模块，提供会话管理和 API 交互接口 |\n| `notte-agent` | 代理执行模块，处理代理决策和浏览器控制逻辑 |\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py:1]()\n资料来源：[packages/notte-core/src/notte_core/errors/processing.py:1]()\n\n### 架构分层图\n\n```mermaid\ngraph TD\n    A[用户/外部系统] --> B[notte-sdk]\n    B --> C[notte-agent]\n    C --> D[notte-llm]\n    D --> E[notte-core]\n    E --> F[浏览器/Playwright]\n    F --> G[网页 DOM]\n```\n\n## 核心功能模块\n\n### 浏览器动作系统\n\nNotte 定义了一套完整的浏览器动作类型，支持多种交互场景：\n\n| 动作类型 | 功能描述 |\n|----------|----------|\n| `goto` | 导航至指定 URL |\n| `goto_new_tab` | 在新标签页中打开 URL |\n| `close_tab` | 关闭当前标签页 |\n\n```python\n# 示例：导航动作\nclass GotoAction(BrowserAction):\n    type: Literal[\"goto\"] = \"goto\"\n    url: str\n    description: str = \"Goto to a URL\"\n```\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py:1-20]()\n\n### 会话管理\n\nNotte SDK 提供了灵活的会话管理能力，支持快速感知和深度感知两种模式：\n\n```python\n# 快速感知模式（默认）\nobs = session.observe(perception_type='fast')\n\n# 深度感知模式（使用 LLM）\nobs = session.observe(perception_type='deep')\n\n# 带指令的感知（自然语言过滤）\nactions = session.observe(instructions=\"Fill the email input\")\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:1-30]()\n\n### 文档分类与提取\n\nNotte LLM 模块提供了文档分析能力，支持对网页内容进行结构化处理：\n\n| 文档类别 | 说明 |\n|----------|------|\n| `search-results` | 搜索结果页面 |\n| `item` | 详情/物品页面 |\n| `other` | 其他类型页面 |\n\n资料来源：[packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md:1]()\n\n### 代理决策系统\n\nNotte Agent 模块实现了基于 LLM 的代理决策引擎，支持：\n\n- **元素识别**：通过 ID 系统标识可交互元素（`I`=输入、`B`=按钮、`L`=链接、`F`=图形、`O`=选项、`M`=杂项）\n- **动作序列**：支持表单填写、导航提取等常见操作序列\n- **验证码处理**：内置 CAPTCHA 检测和解决机制\n\n```mermaid\ngraph LR\n    A[网页状态] --> B[元素识别]\n    B --> C[动作规划]\n    C --> D[执行验证]\n    D -->|成功| E[下一状态]\n    D -->|失败| F[错误处理]\n```\n\n资料来源：[packages/notte-agent/src/notte_agent/gufo/system.md:1-40]()\n\n## 错误处理机制\n\nNotte 建立了完善的错误处理体系，涵盖内部检查和运行时异常：\n\n| 错误类型 | 触发条件 |\n|----------|----------|\n| `InvalidA11yTreeType` | 无效的辅助功能树类型 |\n| `InvalidA11yChildrenError` | 子元素数量不满足假设条件 |\n| `InvalidPlaceholderError` | 占位符未被 vault 处理 |\n| `ScrapeFailedError` | 结构化数据提取失败 |\n\n资料来源：[packages/notte-core/src/notte_core/errors/processing.py:1-40]()\n\n## 使用方式\n\n### 安装\n\nNotte 通过 Python 包管理器分发，可通过标准方式安装。\n\n### 基本工作流\n\n```mermaid\ngraph TD\n    A[创建会话] --> B[执行动作]\n    B --> C[观察状态]\n    C --> D{任务完成?}\n    D -->|否| B\n    D -->|是| E[返回结果]\n```\n\n```python\n# 完整示例\nobs = session.observe(perception_type='deep')\nprint(obs.space.description)\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:20-25]()\n\n## 项目信息\n\n| 属性 | 值 |\n|------|------|\n| 版本 | 1.4.4 |\n| 许可证 | SSPL-1.0 |\n| 版权 | © 2025 Notte Labs, Inc. |\n| 作者 | Pinto, Andrea, Giordano, Lucas, nottelabs-team |\n\n资料来源：[README.md:1-15]()\n\n## 引用格式\n\n如需在学术场合引用 Notte，请使用以下 BibTeX 格式：\n\n```bibtex\n@software{notte2025,\n  author = {Pinto, Andrea and Giordano, Lucas and {nottelabs-team}},\n  title = {Notte: Software suite for internet-native agentic systems},\n  url = {https://github.com/nottelabs/notte},\n  year = {2025},\n  publisher = {GitHub},\n  license = {SSPL-1.0},\n  version = {1.4.4},\n}\n```\n\n资料来源：[README.md:5-14]()\n\n---\n\n<a id='quickstart-guide'></a>\n\n## 快速入门指南\n\n### 相关页面\n\n相关主题：[项目介绍](#project-introduction)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [docs/setup.md](https://github.com/nottelabs/notte/blob/main/docs/setup.md)\n- [docs/sdk_tutorial.md](https://github.com/nottelabs/notte/blob/main/docs/sdk_tutorial.md)\n- [.env.example](https://github.com/nottelabs/notte/blob/main/.env.example)\n</details>\n\n# 快速入门指南\n\nNotte 是一个面向互联网原生代理系统的软件套件，旨在为 LLM 智能体提供可靠的网页浏览和交互能力。本指南将帮助您快速上手 Notte SDK，从环境配置到实现第一个网页交互任务。\n\n## 环境要求\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n| 组件 | 最低版本 | 说明 |\n|------|----------|------|\n| Python | 3.10+ | 推荐使用 Python 3.10 或更高版本 |\n| pip | 21.0+ | Python 包管理器 |\n| API 密钥 | Notte 账户 | 从 [notte.cc](https://notte.cc) 获取 |\n\n## 环境配置\n\n### 获取 API 密钥\n\n1. 访问 [notte.cc](https://notte.cc) 并注册账户\n2. 在仪表板中生成您的 API 密钥\n3. 将密钥安全存储，避免泄露\n\n### 配置环境变量\n\n创建 `.env` 文件，参考 `.env.example` 中的配置模板：\n\n```bash\n# Notte API 配置\nNOTTE_API_KEY=your_api_key_here\nNOTTE_API_BASE_URL=https://api.notte.cc  # 可选，默认为官方 API 地址\n```\n\n环境变量说明：\n\n| 变量名 | 必填 | 默认值 | 说明 |\n|--------|------|--------|------|\n| `NOTTE_API_KEY` | 是 | - | 您的 Notte API 密钥 |\n| `NOTTE_API_BASE_URL` | 否 | `https://api.notte.cc` | API 基础 URL |\n\n资料来源：[.env.example](https://github.com/nottelabs/notte/blob/main/.env.example)\n\n## 安装 SDK\n\n### 使用 pip 安装\n\n```bash\npip install notte-sdk\n```\n\n### 从源码安装\n\n```bash\ngit clone https://github.com/nottelabs/notte.git\ncd notte\npip install -e .\n```\n\n## 核心概念\n\n在深入实践之前，理解以下核心概念有助于更好地使用 Notte SDK：\n\n```mermaid\ngraph TD\n    A[Notte Session] --> B[观察页面]\n    A --> C[执行动作]\n    A --> D[抓取数据]\n    B --> E[获取交互元素]\n    C --> F[点击/输入/提交]\n    D --> G[结构化输出]\n    \n    style A fill:#e1f5fe\n    style B fill:#fff3e0\n    style C fill:#fff3e0\n    style D fill:#e8f5e9\n```\n\n| 概念 | 说明 |\n|------|------|\n| Session | 会话对象，管理与浏览器的连接状态 |\n| Observe | 观察操作，获取当前页面的交互元素 |\n| Execute | 执行操作，如点击、输入、表单填写等 |\n| Scrape | 抓取操作，从页面提取结构化数据 |\n\n资料来源：[docs/sdk_tutorial.md](https://github.com/nottelabs/notte/blob/main/docs/sdk_tutorial.md)\n\n## 基本使用流程\n\n### 1. 初始化客户端\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\n```\n\n### 2. 创建会话\n\n```python\nsession = client.sessions.create()\nprint(f\"会话ID: {session.id}\")\n```\n\n### 3. 导航到目标页面\n\n```python\nsession.execute(type=\"goto\", url=\"https://notte.cc\")\n```\n\n### 4. 观察页面元素\n\n```python\n# 快速感知模式\nobs = session.observe(perception_type=\"fast\")\n\n# 深度感知模式（使用 LLM 格式化）\nobs = session.observe(perception_type=\"deep\")\n```\n\n### 5. 执行动作\n\n```python\n# 点击元素\nsession.execute(type=\"click\", id=\"B1\")\n\n# 输入文本\nsession.execute(type=\"fill\", id=\"I1\", value=\"search term\")\n\n# 提交表单\nsession.execute(type=\"submit\", id=\"B2\")\n```\n\n资料来源：[docs/sdk_tutorial.md](https://github.com/nottelabs/notte/blob/main/docs/sdk_tutorial.md)\n\n## 常见任务示例\n\n### 网页抓取\n\nNotte 提供强大的网页抓取功能，支持结构化数据提取：\n\n```python\nfrom notte_sdk import NotteClient, NotteScrapeResponse\n\nclient = NotteClient()\n\n# 基础抓取\nresponse = client.scrape(\n    url=\"https://notte.cc\",\n    scrape_links=True,\n    only_main_content=True\n)\n\n# 带自定义指令的结构化抓取\nfrom pydantic import BaseModel\n\nclass Article(BaseModel):\n    title: str\n    content: str\n    date: str\n\nresponse = client.scrape(\n    url=\"https://example.com/blog\",\n    response_format=Article,\n    instructions=\"Extract only the title, date and content of the articles\"\n)\n```\n\n抓取参数说明：\n\n| 参数 | 类型 | 必填 | 说明 |\n|------|------|------|------|\n| `url` | string | 是 | 要抓取的网页 URL |\n| `scrape_links` | boolean | 否 | 是否抓取页面链接 |\n| `only_main_content` | boolean | 否 | 是否仅提取主要内容 |\n| `response_format` | BaseModel | 否 | Pydantic 模型用于结构化输出 |\n| `instructions` | string | 否 | 提取数据的自定义指令 |\n\n### 动作观察与过滤\n\n使用自然语言指令快速定位交互元素：\n\n```python\nsession.execute(type=\"goto\", url=\"https://console.notte.cc\")\n\n# 使用自然语言过滤动作空间\nactions = session.observe(instructions=\"Fill the email input\")\nprint(actions[0].model_dump())\n```\n\n### 使用 cURL 直接调用 API\n\n如果您偏好使用 HTTP 直接调用：\n\n```bash\ncurl -X POST 'https://api.notte.cc/scrape' \\\n  -H 'Authorization: Bearer <NOTTE-API-KEY>' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"url\": \"https://notte.cc\",\n    \"only_main_content\": false,\n  }'\n```\n\n## 错误处理\n\n### 常见错误及解决方案\n\n| 错误类型 | 可能原因 | 解决方案 |\n|----------|----------|----------|\n| `AuthenticationError` | API 密钥无效或过期 | 检查并更新 `NOTTE_API_KEY` |\n| `NetworkError` | 网络连接问题 | 检查网络连接和代理设置 |\n| `SessionExpiredError` | 会话超时 | 重新创建会话 |\n| `ActionExecutionError` | 动作执行失败 | 检查元素 ID 和页面状态 |\n\n### 重试机制\n\nNotte SDK 支持自动重试机制，您可以在执行动作时配置：\n\n```python\nsession.execute(\n    type=\"click\",\n    id=\"B1\",\n    raise_on_failure=True  # 失败时抛出异常\n)\n```\n\n## 下一步\n\n- 阅读完整的 [SDK 教程](sdk_tutorial.md) 深入了解高级功能\n- 查看 [API 参考文档](api_reference.md) 了解完整的 API 接口\n- 探索 [示例代码库](../examples/) 获取更多实践案例\n\n## 相关资源\n\n- 官方文档：[https://docs.notte.cc](https://docs.notte.cc)\n- API 密钥管理：[https://console.notte.cc](https://console.notte.cc)\n- 搜索演示：[https://search.notte.cc](https://search.notte.cc)\n\n---\n\n<a id='package-structure'></a>\n\n## 包结构分析\n\n### 相关页面\n\n相关主题：[核心模块实现](#core-modules), [项目介绍](#project-introduction)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-core/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-core/pyproject.toml)\n- [packages/notte-browser/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-browser/pyproject.toml)\n- [packages/notte-agent/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/pyproject.toml)\n- [packages/notte-sdk/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-sdk/pyproject.toml)\n- [packages/notte-llm/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/pyproject.toml)\n- [packages/notte-mcp/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-mcp/pyproject.toml)\n</details>\n\n# 包结构分析\n\n## 概述\n\nNotte 是一个面向互联网原生代理系统（Internet-native Agentic Systems）的软件套件，采用模块化架构设计。整个项目由多个独立的功能包组成，通过清晰的依赖关系组织，形成一套完整的浏览器自动化与LLM交互解决方案。\n\n项目根目录下包含 `packages/` 子目录，其中包含六个核心包：\n\n| 包名 | 版本 | 主要功能 |\n|------|------|----------|\n| notte-core | 0.1.0+ | 核心数据结构和错误处理 |\n| notte-browser | 0.1.0+ | 浏览器控制与页面交互 |\n| notte-agent | 0.1.0+ | Agent执行引擎 |\n| notte-sdk | 0.1.0+ | Python SDK客户端 |\n| notte-llm | 0.1.0+ | LLM提示词和响应处理 |\n| notte-mcp | 0.1.0+ | MCP协议服务器集成 |\n\n## 架构层次\n\n```mermaid\ngraph TD\n    subgraph \"notte-llm\"\n        LLM_Prompts[\"提示词模板\"]\n        LLM_Output[\"输出解析\"]\n    end\n    \n    subgraph \"notte-core\"\n        Core_Actions[\"动作定义\"]\n        Core_Observation[\"观察数据模型\"]\n        Core_Errors[\"错误处理\"]\n    end\n    \n    subgraph \"notte-browser\"\n        Browser_Control[\"浏览器控制\"]\n        Page_Scraping[\"页面抓取\"]\n    end\n    \n    subgraph \"notte-agent\"\n        Agent_Executor[\"Agent执行器\"]\n        Agent_Gufo[\"Gufo系统\"]\n    end\n    \n    subgraph \"notte-sdk\"\n        SDK_Client[\"客户端封装\"]\n        Session_Management[\"会话管理\"]\n    end\n    \n    subgraph \"notte-mcp\"\n        MCP_Server[\"MCP服务器\"]\n        MCP_Tools[\"工具定义\"]\n    end\n    \n    LLM_Prompts --> Core_Actions\n    Core_Actions --> Browser_Control\n    Agent_Executor --> Core_Actions\n    Agent_Executor --> LLM_Prompts\n    SDK_Client --> Session_Management\n    SDK_Client --> Agent_Executor\n    MCP_Server --> SDK_Client\n    MCP_Tools --> MCP_Server\n```\n\n## 各包详细分析\n\n### notte-core\n\n**功能定位**：基础层，提供整个项目的基础数据类型、动作定义、观察结果模型和错误处理机制。\n\n**源码结构**：\n\n```\nnotte-core/src/notte_core/\n├── actions/\n│   └── actions.py          # 动作类型定义（goto、click、fill等）\n├── observation/\n│   └── data models         # 页面观察数据结构\n├── errors/\n│   └── processing.py       # 错误类定义\n└── pruning.py              # 树剪枝算法\n```\n\n**核心模块**：\n\n| 模块 | 文件 | 说明 |\n|------|------|------|\n| actions | actions.py | 定义scrape、goto、click、fill等动作类型 |\n| errors | processing.py | NotteBaseError、InvalidInternalCheckError等 |\n| observation | 数据模型 | 页面元素的结构化表示 |\n\n**关键类型定义**（来源：[packages/notte-core/src/notte_core/actions/actions.py]()）：\n\n- `ScrapeAction`：页面数据抓取，支持指令过滤、选择器范围限定\n- `GotoAction`：页面导航\n- `ClickAction`：元素点击\n- `FillAction`：表单填充\n\n### notte-browser\n\n**功能定位**：浏览器控制层，基于Playwright实现浏览器自动化操作。\n\n**依赖关系**：\n\n```toml\n[project.dependencies]\nplaywright = \">=1.41.0\"\n```\n\n**核心功能**：\n\n| 功能 | 说明 |\n|------|------|\n| 页面导航 | 加载指定URL |\n| 元素交互 | 点击、填表、悬停等 |\n| 内容抓取 | 提取页面文本、图片、链接 |\n| 截图 | 页面可视化反馈 |\n\n### notte-agent\n\n**功能定位**：智能代理层，实现LLM驱动的自动化决策和执行。\n\n**源码结构**：\n\n```\nnotte-agent/src/notte_agent/\n├── gufo/\n│   └── system.md           # Gufo系统提示词\n└── 执行器                  # Agent核心逻辑\n```\n\n**核心能力**：\n\n| 能力 | 说明 |\n|------|------|\n| 动作规划 | 分析页面状态生成动作序列 |\n| 状态追踪 | 维护会话上下文 |\n| CAPTCHA处理 | 自动识别和处理验证码 |\n| 错误恢复 | 动作执行失败后的重试机制 |\n\n**Agent执行流程**（来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py]()）：\n\n```python\n# 会话创建\nwith client.Session() as session:\n    session.execute(type=\"goto\", url=\"https://example.com\")\n    obs = session.observe(perception_type='deep')\n    # Agent决策循环...\n```\n\n### notte-sdk\n\n**功能定位**：Python客户端SDK，封装所有API调用和会话管理。\n\n**核心组件**：\n\n| 组件 | 文件/类 | 说明 |\n|------|---------|------|\n| NotteClient | client.py | 主客户端类 |\n| Session | sessions.py | 会话上下文管理器 |\n| observe | sessions.py | 页面观察方法 |\n| execute | sessions.py | 动作执行方法 |\n\n**会话管理**（来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py]()）：\n\n```python\nclass Session:\n    \"\"\"会话上下文管理器\"\"\"\n    \n    def __init__(self, cookie_file=None):\n        self._cookie_file = cookie_file\n    \n    def __enter__(self):\n        self.start()\n        return self\n    \n    def __exit__(self, exc_type, exc_val, exc_tb):\n        self.stop()\n    \n    def observe(self, perception_type='fast', instructions=None):\n        \"\"\"观察页面可用动作\"\"\"\n        \n    def execute(self, type, **kwargs):\n        \"\"\"执行动作\"\"\"\n```\n\n**观察类型**：\n\n| 类型 | 说明 | 适用场景 |\n|------|------|----------|\n| `fast` | 快速感知 | 简单页面、高速查询 |\n| `deep` | 深度感知 | 复杂页面、需要LLM格式化 |\n\n### notte-llm\n\n**功能定位**：LLM交互层，处理提示词模板和响应解析。\n\n**源码结构**：\n\n```\nnotte-llm/src/notte_llm/prompts/\n├── action-listing/         # 动作列表生成\n├── data-extraction/        # 数据提取\n├── document-category/      # 文档分类\n├── extract-without-json-schema/  # 无schema提取\n└── debug-failing-action-exec/    # 调试失败动作\n```\n\n**提示词模板**：\n\n| 模板类型 | 用户文件 | 说明 |\n|----------|----------|------|\n| 动作列表 | user.md | 生成可执行动作序列 |\n| 数据提取 | user.md | 结构化数据抽取 |\n| 文档分类 | user.md | 页面分类（search-results、item、other） |\n| 失败调试 | user.md | 动作执行失败分析 |\n\n**文档分类类别**（来源：[packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md]()）：\n\n| 类别 | 说明 | 示例 |\n|------|------|------|\n| `search-results` | 搜索结果页面 | Google Flights搜索结果 |\n| `item` | 详情项页面 | 食谱详情页、商品页 |\n| `other` | 其他类型 | 首页、导航页 |\n\n### notte-mcp\n\n**功能定位**：Model Context Protocol服务器集成，提供标准化工具接口。\n\n**工具列表**（来源：[packages/notte-mcp/README.md]()）：\n\n| 工具名 | 功能 |\n|--------|------|\n| `notte_start_session` | 启动新的云浏览器会话 |\n| `notte_list_sessions` | 列出所有活动会话 |\n| `notte_stop_session` | 停止当前会话 |\n| `notte_observe` | 观察页面元素和可用动作 |\n| `notte_screenshot` | 页面截图 |\n| `notte_scrape` | 结构化数据提取 |\n| `notte_step` | 执行页面动作 |\n| `notte_operator` | 运行Notte Agent完成任务 |\n\n**使用方式**：\n\n```bash\npip install notte-mcp\nexport NOTTE_API_KEY=\"your-api-key\"\npython -m notte_mcp.server\n```\n\n## 依赖关系\n\n```mermaid\ngraph LR\n    SDK[\"notte-sdk\"] --> Agent[\"notte-agent\"]\n    SDK --> Browser[\"notte-browser\"]\n    Agent --> LLM[\"notte-llm\"]\n    Agent --> Core[\"notte-core\"]\n    Browser --> Core\n    MCP[\"notte-mcp\"] --> SDK\n```\n\n**依赖矩阵**：\n\n| 依赖方 \\ 被依赖方 | notte-core | notte-browser | notte-agent | notte-llm | notte-sdk |\n|------------------|------------|---------------|-------------|-----------|-----------|\n| notte-sdk | ✓ | - | ✓ | - | - |\n| notte-agent | ✓ | - | - | ✓ | - |\n| notte-browser | ✓ | - | - | - | - |\n| notte-mcp | - | - | - | - | ✓ |\n\n## 入口点设计\n\n### SDK入口\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\n```\n\n### MCP服务器入口\n\n```bash\npython -m notte_mcp.server\n```\n\n### CLI入口\n\n项目提供命令行接口进行快速操作：\n\n```bash\nnotte <command> [options]\n```\n\n## 错误处理体系\n\nNotte采用分层错误处理机制（来源：[packages/notte-core/src/notte_core/errors/processing.py]()）：\n\n| 错误类 | 说明 | 使用场景 |\n|--------|------|----------|\n| `NotteBaseError` | 基类异常 | 所有自定义异常的父类 |\n| `InvalidInternalCheckError` | 内部检查失败 | 代码假设验证失败 |\n| `InvalidA11yTreeType` | 无障碍树类型错误 | 未知a11y树类型 |\n| `InvalidPlaceholderError` | 占位符错误 | Vault凭据获取失败 |\n| `ScrapeFailedError` | 抓取失败 | 数据提取操作异常 |\n\n## 许可证\n\n整个项目采用 **Server Side Public License v1.0 (SSPL-1.0)** 许可证发布。\n\n## 引用信息\n\n如需在学术场合引用本项目，请使用以下BibTeX格式：\n\n```bibtex\n@software{notte2025,\n  author = {Pinto, Andrea and Giordano, Lucas and {nottelabs-team}},\n  title = {Notte: Software suite for internet-native agentic systems},\n  url = {https://github.com/nottelabs/notte},\n  year = {2025},\n  publisher = {GitHub},\n  license = {SSPL-1.0},\n  version = {1.4.4},\n}\n\n---\n\n<a id='core-modules'></a>\n\n## 核心模块实现\n\n### 相关页面\n\n相关主题：[包结构分析](#package-structure), [动作执行系统](#action-system)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-core/src/notte_core/actions/actions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/actions/actions.py)\n- [packages/notte-core/src/notte_core/browser/observation.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/browser/observation.py)\n- [packages/notte-core/src/notte_core/browser/snapshot.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/browser/snapshot.py)\n- [packages/notte-core/src/notte_core/browser/dom_tree.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/browser/dom_tree.py)\n- [packages/notte-core/src/notte_core/credentials/base.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/credentials/base.py)\n- [packages/notte-core/src/notte_core/ast.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/ast.py)\n</details>\n\n# 核心模块实现\n\n## 1. 模块概述\n\nNotte 项目的核心模块实现涵盖了浏览器自动化代理系统的关键组件，包括动作执行系统、页面观察机制、DOM 树处理、快照管理和凭证安全系统。这些模块共同构成了一个完整的网页自动化框架，使 AI 代理能够精确地与网页元素进行交互。\n\n核心模块的架构设计遵循分层职责原则，将浏览器操作、页面解析、状态管理和安全控制分离到不同的子模块中，每个模块专注于特定的功能域，通过标准化的接口进行通信和数据交换。\n\n## 2. 动作执行系统\n\n### 2.1 动作类型体系\n\n动作执行系统是 Notte 自动化框架的核心，负责定义和管理所有可执行的浏览器操作。系统采用类继承结构，通过基类 `BrowserAction` 定义通用接口，具体动作类实现各自的业务逻辑。\n\n| 动作类型 | 说明 | 参数 |\n|---------|------|------|\n| `GotoAction` | 导航到指定 URL | url: str |\n| `GotoNewTabAction` | 在新标签页中打开 URL | url: str |\n| `CloseTabAction` | 关闭当前标签页 | 无 |\n| `ClickAction` | 点击页面元素 | id: str |\n| `FormFillAction` | 填写表单字段 | 表单字段字典 |\n\n基类 `BrowserAction` 定义了动作执行的通用接口，包括执行消息生成、参数规范和示例数据提供。每个具体动作类都实现了这些抽象方法，确保动作执行的标准化和可预测性。\n\n### 2.2 动作执行流程\n\n动作执行采用统一的调用模式，通过 `execute()` 方法触发。执行流程首先验证动作参数的有效性，然后调用底层的 Playwright 或类似浏览器自动化引擎执行实际操作，最后返回执行结果。\n\n```mermaid\ngraph TD\n    A[创建动作实例] --> B[验证参数]\n    B --> C{参数有效?}\n    C -->|是| D[执行动作]\n    C -->|否| E[抛出验证错误]\n    D --> F{执行成功?}\n    F -->|是| G[返回 ExecutionResult]\n    F -->|否| H[记录错误信息]\n    G --> I[更新会话状态]\n    H --> I\n```\n\n### 2.3 动作参数定义\n\n每个动作类通过 `param` 属性提供参数规范，包括参数名称、数据类型和约束条件。这种设计使动作系统具备自描述能力，便于 LLM 代理理解和使用。\n\n```python\n@property\n@override\ndef param(self) -> ActionParameter | None:\n    return ActionParameter(name=\"url\", type=\"str\")\n```\n\n参数规范采用强类型定义，支持字符串、整数、布尔值和复杂对象类型。系统自动进行类型检查和转换，减少运行时错误的发生。\n\n## 3. 页面观察机制\n\n### 3.1 观察类型\n\n页面观察机制负责分析当前页面状态并生成可交互元素列表。系统支持多种观察深度，以适应不同场景的性能和精度需求。\n\n| 观察类型 | 说明 | 适用场景 |\n|---------|------|---------|\n| `fast` | 快速感知模式 | 简单页面感知、查询优化 |\n| `deep` | 深度感知模式 | 复杂页面分析、LLM 动作空间生成 |\n\n快速感知模式使用简化的页面解析逻辑，直接从浏览器的可访问性树中提取元素信息，适用于需要快速响应的场景。深度感知模式则调用 LLM 对页面进行更深入的分析，生成更结构化的交互空间表示。\n\n### 3.2 观察响应结构\n\n观察结果通过 `ObserveResponse` 类型封装，包含当前页面 URL、可交互元素列表和空间描述信息。这种结构化输出便于代理理解页面状态并规划后续动作。\n\n```mermaid\ngraph LR\n    A[页面 HTML] --> B[DOM 树解析]\n    B --> C[可访问性树生成]\n    C --> D{观察类型}\n    D -->|fast| E[快速元素提取]\n    D -->|deep| F[LLM 结构化分析]\n    E --> G[ObserveResponse]\n    F --> G\n```\n\n### 3.3 指令过滤机制\n\n观察系统支持通过自然语言指令过滤可交互元素。当提供 `instructions` 参数时，系统会解析指令语义，仅返回符合条件的目标元素，显著减少动作空间大小，提高代理决策效率。\n\n```python\nactions = session.observe(instructions=\"Fill the email input\")\nprint(actions[0].model_dump())\n```\n\n这种设计使开发者能够用自然语言描述交互意图，系统自动完成元素筛选和动作空间构建，降低了自动化脚本的编写难度。\n\n## 4. DOM 树处理\n\n### 4.1 树结构设计\n\nDOM 树模块负责将原始 HTML 文档解析为可编程访问的树形数据结构。树节点包含元素类型、属性、内容和层级关系，支持高效的遍历和查询操作。\n\n```mermaid\ngraph TD\n    A[HTML 文档] --> B[解析器]\n    B --> C[根节点]\n    C --> D[head 节点]\n    C --> E[body 节点]\n    E --> F[交互元素]\n    E --> G[文本节点]\n    D --> H[元数据节点]\n```\n\n每个树节点关联唯一的标识符，用于在观察响应中引用具体元素。节点同时记录可访问性属性，如角色、名称和状态，这些属性决定了元素的交互方式。\n\n### 4.2 可访问性树\n\nNotte 使用可访问性树（Accessibility Tree）作为页面元素的主要表示形式，相比原始 DOM 树提供了更丰富的语义信息。可访问性树去除了装饰性元素，保留功能性内容，使代理能够更准确地理解页面结构。\n\n| 属性 | 说明 |\n|------|------|\n| `role` | 元素语义角色（button, link, input 等） |\n| `name` | 元素的可见名称或标签 |\n| `state` | 元素当前状态（checked, disabled 等） |\n| `value` | 输入元素的当前值 |\n\n### 4.3 节点遍历与查询\n\nDOM 树模块提供多种遍历和查询方法，支持按标签名、类名、ID 或 XPath 表达式定位节点。查询结果可进一步用于动作生成或内容提取。\n\n## 5. 快照管理\n\n### 5.1 快照概念\n\n快照（Snapshot）是 Notte 系统记录页面状态的机制，每次页面变化后系统自动生成新的快照。快照包含完整的页面 DOM 结构、可访问性树和元数据，支持历史回溯和状态对比。\n\n快照管理器维护快照的历史记录，通过版本号或时间戳标识不同状态的快照。代理可以查询历史快照以了解页面变化过程，或在执行操作前保存当前状态以便回滚。\n\n### 5.2 快照数据结构\n\n```python\nclass Snapshot:\n    id: str\n    url: str\n    dom_tree: DOMTree\n    accessibility_tree: A11yTree\n    timestamp: datetime\n    metadata: dict\n```\n\n快照数据存储为只读对象，确保历史状态的完整性和一致性。系统支持快照的序列化和反序列化，便于分布式环境下的状态共享。\n\n### 5.3 快照与观察的关系\n\n观察操作基于当前快照执行，每次观察都会创建新的快照记录。观察结果中的元素标识符与快照中的节点一一对应，保证动作执行的精确性。\n\n```mermaid\ngraph LR\n    A[执行动作] --> B[页面更新]\n    B --> C[生成新快照]\n    C --> D[新快照 ID]\n    D --> E[观察结果引用新元素]\n```\n\n## 6. 凭证管理系统\n\n### 6.1 凭证架构\n\n凭证管理系统（Vault）负责安全存储和管理敏感信息，如登录凭据、API 密钥和认证令牌。系统采用分层架构，将凭证存储与业务逻辑分离，支持多种后端存储实现。\n\n```mermaid\ngraph TD\n    A[代理请求凭证] --> B[Vault 接口]\n    B --> C{凭证类型}\n    C -->|API 密钥| D[KeyVault]\n    C -->|用户名密码| E[CredentialVault]\n    C -->|OAuth 令牌| F[TokenVault]\n    D --> G[安全存储]\n    E --> G\n    F --> G\n```\n\n### 6.2 凭证基类设计\n\n```python\nclass NotteBaseError(Exception):\n    def __init__(\n        self,\n        agent_message: str,\n        user_message: str,\n        dev_message: str,\n    ) -> None:\n        self.agent_message = agent_message\n        self.user_message = user_message\n        self.dev_message = dev_message\n```\n\n凭证系统定义统一的异常类型，包含面向代理、用户和开发者的不同错误消息，便于问题的诊断和修复。当凭证操作失败时，系统根据上下文选择合适的错误消息返回。\n\n### 6.3 占位符机制\n\n代理通过占位符（Placeholder）引用凭证，系统在动作执行时自动替换占位符为实际凭证值。这种设计避免敏感信息硬编码在动作参数中，提高系统的安全性。\n\n| 占位符类型 | 说明 |\n|-----------|------|\n| `{vault:api_key:service}` | API 密钥占位符 |\n| `{vault:credential:site}` | 网站登录凭据占位符 |\n| `{vault:token:oauth}` | OAuth 令牌占位符 |\n\n## 7. AST 抽象语法树\n\nAST 模块提供网页内容的结构化表示能力，将无结构的 HTML/CSS/JavaScript 转换为可编程访问的语法树。该模块是高级自动化能力的基础，支持复杂页面结构的理解和操作。\n\n### 7.1 AST 与 DOM 的关系\n\nAST 与 DOM 树既有联系又有区别。DOM 树侧重于文档结构表示，AST 则更关注代码语义的表达。对于 JavaScript 代码，AST 能够解析变量声明、函数调用和控制流结构，为代码级别的自动化操作提供可能。\n\n| 特性 | DOM 树 | AST |\n|------|--------|-----|\n| 关注点 | 文档结构 | 代码语义 |\n| 适用范围 | HTML | HTML/CSS/JS |\n| 遍历方式 | 父子节点 | 语句/表达式 |\n| 用途 | 页面交互 | 代码分析 |\n\n### 7.2 节点类型系统\n\nAST 定义了丰富的节点类型，覆盖 JavaScript 语言的各种语法结构。常见节点类型包括：\n\n- **声明节点**：变量声明、函数声明、类声明\n- **表达式节点**：二元表达式、函数调用、成员访问\n- **控制流节点**：条件语句、循环语句、异常处理\n- **结构节点**：对象字面量、数组字面量\n\n节点类型系统支持 Visitor 模式遍历，代理可以实现自定义的节点处理器来执行特定的代码分析或转换任务。\n\n## 8. 错误处理机制\n\n### 8.1 错误分类体系\n\nNotte 定义了完善的错误分类体系，根据错误来源和性质分为不同类别：\n\n| 错误类型 | 说明 | 典型场景 |\n|---------|------|---------|\n| `InvalidInternalCheckError` | 内部检查失败 | 类型验证、假设检查 |\n| `InvalidA11yTreeType` | 无效的可访问性树类型 | 类型参数错误 |\n| `InvalidPlaceholderError` | 未处理的占位符 | 凭证引用错误 |\n| `ScrapeFailedError` | 数据抓取失败 | 页面解析异常 |\n\n### 8.2 错误消息设计\n\n每个错误类型包含面向不同角色的消息：\n\n- **开发消息（dev_message）**：详细的调试信息和修复建议\n- **代理消息（agent_message）**：代理可理解的错误描述和替代建议\n- **用户消息（user_message）**：面向终端用户的友好提示\n\n这种多层次的消息设计确保错误信息在开发、调试和生产环境中都能发挥作用。\n\n## 9. 模块间协作\n\n### 9.1 会话生命周期\n\n会话（Session）是 Notte 系统的核心概念，贯穿所有模块的协作过程。会话管理器的实现整合了动作执行、页面观察和快照管理功能：\n\n```python\nwith client.Session() as session:\n    session.execute(type=\"goto\", url=\"https://example.com\")\n    obs = session.observe()\n    markdown = session.scrape()\n```\n\n会话提供上下文管理器支持，自动处理资源清理和状态同步。当会话结束时，系统自动保存 Cookie 状态并释放浏览器资源。\n\n### 9.2 数据流总览\n\n```mermaid\ngraph TD\n    A[用户请求] --> B[会话管理器]\n    B --> C[动作系统]\n    C --> D[浏览器引擎]\n    D --> E[页面快照]\n    E --> F[DOM 树]\n    F --> G[可访问性树]\n    G --> H[观察服务]\n    H --> I[代理决策]\n    I --> C\n    E --> J[凭证系统]\n    J --> C\n```\n\n数据流展示了从用户请求到代理决策的完整链路。各模块通过标准化的数据结构和接口进行交互，保证系统的可扩展性和可维护性。\n\n### 9.3 状态同步机制\n\n会话维护当前的页面快照引用，当页面发生变化时自动更新。观察操作返回的是基于最新快照的元素列表，动作执行后触发新的快照生成，形成闭环的状态同步机制。\n\n## 10. 总结\n\n核心模块实现构成了 Notte 自动化框架的技术基础，通过动作系统、页面观察、DOM 处理、快照管理和凭证安全五大支柱，为 AI 代理提供完整的网页交互能力。这些模块相互协作，形成了一套从页面解析到动作执行的完整工作流，支持复杂场景下的自动化任务。\n\n---\n\n<a id='agent-implementation'></a>\n\n## Agent实现与生命周期\n\n### 相关页面\n\n相关主题：[结构化输出](#structured-output)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-agent/src/notte_agent/agent.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/agent.py)\n- [packages/notte-agent/src/notte_agent/agent_fallback.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/agent_fallback.py)\n- [packages/notte-agent/src/notte_agent/workflow.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/workflow.py)\n- [packages/notte-agent/src/notte_agent/common/conversation.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/common/conversation.py)\n- [packages/notte-agent/src/notte_agent/falco/agent.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/agent.py)\n- [packages/notte-agent/src/notte_agent/gufo/agent.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/gufo/agent.py)\n</details>\n\n# Agent实现与生命周期\n\n## 概述\n\nNotte Agent 是一个精确的浏览器自动化代理系统，通过结构化命令与网站进行交互。该系统能够分析网页元素和结构，规划动作序列，并以JSON格式响应动作执行结果和状态评估。Agent架构支持多种底层浏览器自动化引擎（包括Falco和Gufo），并通过统一的接口提供网页浏览、内容提取、表单填写等核心功能。\n\n资料来源：[packages/notte-agent/src/notte_agent/falco/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/system.md)\n\n## 架构设计\n\n### 整体架构\n\nNotte Agent采用分层架构设计，核心组件包括：\n\n| 组件 | 职责 | 源码位置 |\n|------|------|----------|\n| Agent基类 | 定义通用接口和生命周期管理 | `agent.py` |\n| Falco Agent | 基于Falco引擎的浏览器代理实现 | `falco/agent.py` |\n| Gufo Agent | 基于Gufo引擎的浏览器代理实现 | `gufo/agent.py` |\n| ActionRegistry | 动作注册与工具管理 | `falco/prompt.py` |\n| Workflow | 多步骤工作流编排 | `workflow.py` |\n| Conversation | 对话历史管理 | `common/conversation.py` |\n\n资料来源：[packages/notte-agent/src/notte_agent/falco/prompt.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/prompt.py)\n\n### 引擎抽象层\n\n系统通过抽象层支持多种浏览器自动化引擎：\n\n```mermaid\ngraph TD\n    A[Agent基类] --> B[Falco Agent]\n    A --> C[Gufo Agent]\n    B --> D[Falco引擎]\n    C --> E[Gufo引擎]\n    D --> F[Playwright/CDP]\n    E --> G[浏览器实例]\n```\n\nFalco和Gufo作为两种独立的Agent实现，共同继承自基础Agent接口，提供一致的外部行为但使用不同的底层浏览器控制机制。\n\n资料来源：[packages/notte-agent/src/notte_agent/agent.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/agent.py)\n\n## 元素标识系统\n\n### ID编码规范\n\nAgent使用标准化的元素标识系统，每个可交互元素的ID遵循特定编码规则：\n\n```mermaid\ngraph LR\n    A[ID格式] --> B[角色前缀]\n    A --> C[索引号]\n    A --> D[分隔符]\n    \n    B --> E[I: 输入字段]\n    B --> F[B: 按钮]\n    B --> G[L: 链接]\n    B --> H[F: 图片/图表]\n    B --> I[O: 选择选项]\n    B --> J[M: 杂项元素]\n```\n\n### 角色前缀对照表\n\n| 前缀 | 角色类型 | 示例元素 |\n|------|----------|----------|\n| `I` | Input | textbox, select, checkbox等输入控件 |\n| `B` | Button | 按钮元素 |\n| `L` | Link | 超链接 |\n| `F` | Figure | 图片和图表元素 |\n| `O` | Option | 下拉选择选项 |\n| `M` | Miscellaneous | 模态框、对话框等杂项元素 |\n\nID的完整格式为`<角色前缀><索引号>`，例如`B1`表示第一个按钮，`I2`表示第二个输入字段。\n\n资料来源：[packages/notte-agent/src/notte_agent/falco/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/system.md)\n\n## 动作系统\n\n### 动作类型\n\nAgent支持多种类型的浏览器自动化动作：\n\n| 动作类型 | 描述 | 适用场景 |\n|----------|------|----------|\n| ClickAction | 点击指定元素 | 按钮点击、链接导航 |\n| FormFillAction | 填写表单字段 | 用户登录、信息录入 |\n| CaptchaSolveAction | 解决验证码 | 自动化验证 |\n| ScrapeAction | 提取页面内容 | 数据采集 |\n| NavigationAction | 页面导航 | URL跳转、前进后退 |\n\n### 表单填写动作格式\n\n```json\n{\n  \"type\": \"form_fill\",\n  \"value\": {\n    \"address1\": \"<地址>\",\n    \"city\": \"<城市>\",\n    \"state\": \"<州/省份>\"\n  }\n}\n```\n\n### CAPTCHA处理规则\n\nAgent对验证码处理有严格的规范：\n\n- **禁止行为**：直接点击验证码元素（按钮、复选框、图片等），或对验证码元素执行\"click\"、\"type\"等动作\n- **正确处理**：检测到验证码（reCAPTCHA、hCaptcha、图像验证等）时，必须使用`CaptchaSolveAction`并指定正确的验证码类型\n- **支持类型**：包括\"我不是机器人\"复选框、图像选择网格、文本验证挑战等\n\n资料来源：[packages/notte-agent/src/notte_agent/falco/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/system.md)\n\n## Agent生命周期\n\n### 创建与启动\n\n使用NotteClient创建Agent实例：\n\n```python\nfrom notte_sdk import NotteClient\n\nnotte = NotteClient()\n\nwith notte.Session(open_viewer=True) as session:\n    agent = notte.Agent(session=session)\n    agent.start(\n        task=\"Summarize the content of the page\",\n        url=\"https://www.google.com\"\n    )\n```\n\n### 状态管理\n\nAgent具有完整的状态管理机制：\n\n| 状态 | 描述 | 获取方法 |\n|------|------|----------|\n| 运行中 | Agent正在执行任务 | `agent.status()` |\n| 已停止 | Agent已被手动停止 | `agent.stop()` |\n| 已完成 | 任务执行完毕 | 状态检查 |\n| 异常 | 执行过程中出错 | 错误处理 |\n\n### 列表与停止操作\n\n```python\n# 列出所有活跃的Agent\nagents = notte.agents.list()\n\n# 停止指定的Agent\nagent.stop()\n\n# 获取Agent状态\nstatus = agent.status()\n```\n\n资料来源：[packages/notte-sdk/README.md](https://github.com/nottelabs/notte/blob/main/packages/notte-sdk/README.md)\n\n## 工作流编排\n\n### Workflow组件\n\nWorkflow用于编排复杂的多步骤自动化任务，支持：\n\n- 步骤序列定义\n- 条件分支处理\n- 错误恢复机制\n- 结果状态传递\n\n```mermaid\ngraph TD\n    A[开始] --> B[步骤1: 页面导航]\n    B --> C[步骤2: 元素观察]\n    C --> D{条件判断}\n    D -->|成功| E[步骤3: 表单填写]\n    D -->|失败| F[备用方案]\n    E --> G[步骤4: 内容提取]\n    F --> G\n    G --> H[完成]\n```\n\n### Fallback机制\n\nAgent支持降级（Fallback）机制，当主要实现无法完成任务时自动切换到备用方案：\n\n```python\n# agent_fallback.py 提供了降级策略定义\n```\n\n资料来源：[packages/notte-agent/src/notte_agent/workflow.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/workflow.py)\n\n## 对话管理\n\n### Conversation组件\n\nConversation模块管理Agent与用户之间的交互历史：\n\n```python\nclass Conversation:\n    def __init__(self):\n        # 初始化对话历史记录\n        pass\n    \n    def add_message(self, role: str, content: str):\n        # 添加消息到历史\n        pass\n    \n    def get_history(self):\n        # 获取完整对话历史\n        pass\n```\n\n对话历史对于维护Agent状态上下文、支持多轮交互任务至关重要。\n\n资料来源：[packages/notte-agent/src/notte_agent/common/conversation.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/common/conversation.py)\n\n## 输入结构规范\n\n### 页面信息格式\n\nAgent接收的页面信息包含以下核心字段：\n\n| 字段 | 描述 | 必需 |\n|------|------|------|\n| Current URL | 当前页面地址 | 是 |\n| Available Tabs | 打开的浏览器标签页列表 | 是 |\n| Interactive Elements | 可交互元素列表 | 是 |\n\n### 元素列表格式\n\n```markdown\n# 主导航菜单\n* `B1`: 提交表单按钮\n* `I1`: 用户名输入框\n* `I2`: 密码输入框\n\n# 内容区域\n* `L1`: 文章链接\n* `F1`: 特色图片\n```\n\n## 响应格式规范\n\n### JSON响应结构\n\nAgent必须始终以有效的JSON格式响应：\n\n```json\n{\n  \"action\": {\n    \"type\": \"click\",\n    \"id\": \"B1\"\n  },\n  \"reasoning\": \"点击提交按钮以完成表单提交\",\n  \"state_assessment\": \"表单已填写完毕，可以提交\"\n}\n```\n\n### 动作执行结果\n\n每个动作执行后返回的结果包含：\n\n| 字段 | 类型 | 描述 |\n|------|------|------|\n| success | boolean | 动作是否成功执行 |\n| error | string | 错误信息（如有） |\n| page_state | object | 执行后页面状态 |\n| captured_data | object | 提取的数据（如适用） |\n\n## 最佳实践\n\n### 元素ID稳定性\n\n> **重要提示**：ID会在每个步骤发生变化，不要假设历史记录中的ID仍然存在或对应相同的元素。每次观察页面时都应重新获取当前的元素ID。\n\n### 动作序列规划\n\n1. 观察页面结构，获取可用元素\n2. 分析任务需求，规划动作序列\n3. 按顺序执行动作，每次观察页面变化\n4. 验证动作结果，必要时调整后续动作\n\n### 错误处理\n\nAgent内置了完善的错误处理机制：\n\n- **InvalidInternalCheckError**：内部检查失败\n- **InvalidA11yTreeType**：无障碍树类型错误\n- **InvalidPlaceholderError**：占位符处理错误\n- **ScrapeFailedError**：内容提取失败\n\n资料来源：[packages/notte-core/src/notte_core/errors/processing.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/errors/processing.py)\n\n---\n\n<a id='structured-output'></a>\n\n## 结构化输出\n\n### 相关页面\n\n相关主题：[Agent实现与生命周期](#agent-implementation)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-core/src/notte_core/actions/actions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/actions/actions.py)\n- [packages/notte-llm/src/notte_llm/engine.py](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/src/notte_llm/engine.py)\n- [packages/notte-llm/src/notte_llm/prompts/extract-without-json-schema/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/src/notte_llm/prompts/extract-without-json-schema/system.md)\n- [packages/notte-llm/src/notte_llm/prompts/data-extraction/user.md](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/src/notte_llm/prompts/data-extraction/user.md)\n- [packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md)\n- [README.md](https://github.com/nottelabs/notte/blob/main/README.md)\n</details>\n\n# 结构化输出\n\n## 概述\n\n结构化输出是 Notte 框架中用于将网页内容转换为机器可读格式的核心能力。该功能允许用户通过自然语言指令或 JSON Schema 定义，从非结构化的网页文档中提取结构化数据，并将其用于后续的 AI Agent 工作流中。\n\nNotte 的结构化输出系统包含以下几个核心组成部分：\n\n| 组件 | 职责 |\n|------|------|\n| ScrapeAction | 执行抓取的核心动作，支持多种输出格式配置 |\n| LLM 解析引擎 | 负责解析 LLM 返回的文本并提取结构化数据 |\n| Prompt 模板系统 | 提供文档分析和数据提取的指令模板 |\n| Schema 验证 | 支持 JSON Schema 和 Pydantic 模型验证 |\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py:1-100]()\n\n## 工作原理\n\n### 流程架构\n\n```mermaid\ngraph TD\n    A[用户发起请求] --> B[配置输出格式]\n    B --> C{输出类型}\n    C -->|JSON Schema| D[使用 extract-json-schema]\n    C -->|自然语言| E[使用 extract-without-json-schema]\n    C -->|分类| F[使用 document-category]\n    D --> G[调用 LLM]\n    E --> G\n    F --> G\n    G --> H[LLM 返回 Markdown/JSON]\n    H --> I[解析引擎提取数据]\n    I --> J{格式验证}\n    J -->|通过| K[返回结构化数据]\n    J -->|失败| L[抛出 LLMParsingError]\n```\n\n### 核心机制\n\nNotte 的结构化输出依赖于 LLM 解析引擎的标签解析能力。引擎通过识别特定的 XML 风格标签来提取内容：\n\n```python\n# packages/notte-llm/src/notte_llm/engine.py\nclass SomeParser:\n    def parse(self, text: str) -> str:\n        # 支持外层标签解析\n        if self.outer_tag:\n            pattern = f\"<{self.outer_tag}>(.*?)</{self.outer_tag}>\"\n            match = re.search(pattern, content, re.DOTALL)\n            \n        # 支持内层代码块解析\n        if self.inner_tag:\n            pattern = f\"```{self.inner_tag}(.*?)```\"\n            match = re.search(pattern, content, re.DOTALL)\n```\n\n引擎支持两层解析：\n1. **外层标签解析**：提取 `<document-analysis>` 等 XML 标签内的内容\n2. **内层代码块解析**：从 markdown 代码块中提取具体数据\n\n资料来源：[packages/notte-llm/src/notte_llm/engine.py:1-50]()\n\n## 输出格式配置\n\n### 使用 JSON Schema\n\n通过 `response_format` 参数指定 JSON Schema 定义输出结构：\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\nresponse = client.scrape(\n    url=\"https://example.com/blog\",\n    response_format={\n        \"type\": \"object\",\n        \"properties\": {\n            \"title\": {\"type\": \"string\"},\n            \"content\": {\"type\": \"string\"},\n            \"date\": {\"type\": \"string\"}\n        }\n    }\n)\n```\n\n### 使用 Pydantic 模型\n\n通过 Pydantic BaseModel 定义数据结构，实现类型安全的结构化输出：\n\n```python\nfrom pydantic import BaseModel\nfrom notte_sdk import NotteClient\n\nclass Article(BaseModel):\n    title: str\n    content: str\n    date: str\n\nclient = NotteClient()\nresponse = client.scrape(\n    url=\"https://example.com/blog\",\n    response_format=Article,\n    instructions=\"Extract only the title, date and content of the articles\"\n)\n```\n\n资料来源：[README.md:1-100]()\n\n## ScrapeAction 参数详解\n\n| 参数 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| `instructions` | str \\| None | None | 自然语言提取指令 |\n| `response_format` | dict \\| BaseModel | None | JSON Schema 或 Pydantic 模型 |\n| `only_main_content` | bool | True | 是否仅提取主体内容 |\n| `selector` | str \\| None | None | Playwright 选择器作用域 |\n| `only_images` | bool | False | 是否仅提取图片 |\n| `scrape_links` | bool | True | 是否提取链接 |\n| `scrape_images` | bool | False | 是否提取图片 URL |\n\n### 主要内容提取\n\n当 `only_main_content=True` 时，系统会自动排除导航栏、页脚等非核心内容：\n\n```python\nsession.execute(\n    type=\"scrape\",\n    only_main_content=True  # 排除导航栏和页脚\n)\n```\n\n### 选择器作用域\n\n使用 Playwright 选择器将提取范围限定在特定 DOM 元素内：\n\n```python\nsession.execute(\n    type=\"scrape\",\n    selector=\"#main-content\"  # 仅提取 main-content 内的内容\n)\n```\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py:1-100]()\n\n## Prompt 模板系统\n\n### 数据提取模板\n\n数据提取模板定义了从网页文档中提取结构化信息的指导原则：\n\n```\n# 数据提取输出规范\n\n## <document-analysis> 部分\n- 逻辑分解网页文档为有意义的章节\n- 描述每个部分的内容，聚焦文本元素\n- 为重复或结构化数据包含子章节\n\n## <data-extraction> 部分\n- 使用 Markdown 标题、表格、列表格式化数据\n- 重复数据使用 Markdown 表格展示\n- 所有原始字段必须包含在表格中\n```\n\n资料来源：[packages/notte-llm/src/notte_llm/prompts/data-extraction/user.md:1-50]()\n\n### 文档分类模板\n\nNotte 支持自动识别网页类型，可分类为：\n\n| 分类 | 说明 | 示例 |\n|------|------|------|\n| `search-results` | 搜索结果页面 | Google 航班搜索 |\n| `item` | 单项详情页面 | 商品详情页、菜谱页 |\n| `other` | 其他类型 | 首页、导航页 |\n\n```xml\n<document-category>\n[文档分类理由的详细分析，包括引用和论证...]\n<document-category-answer>search-results</document-category-answer>\n</document-category>\n```\n\n资料来源：[packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md:1-50]()\n\n## 使用示例\n\n### 示例：Nike 产品抓取\n\n完整的结构化输出工作流示例：\n\n```python\nfrom notte_sdk import NotteClient\nfrom pydantic import BaseModel\n\nclass Product(BaseModel):\n    name: str\n    price: str\n    sizes: list[str]\n    colors: list[str]\n\nclient = NotteClient()\nwith client.Session() as session:\n    session.execute(type=\"goto\", url=\"https://www.nike.com\")\n    \n    response = session.execute(\n        type=\"scrape\",\n        response_format=Product,\n        instructions=\"Extract product name, price, available sizes and colors\"\n    )\n```\n\n### 示例：分类与数据提取结合\n\n```mermaid\ngraph LR\n    A[访问网页] --> B[document-category]\n    B --> C{分类结果}\n    C -->|search-results| D[提取列表数据]\n    C -->|item| E[提取详情数据]\n    C -->|other| F[提取导航信息]\n    D --> G[返回结构化JSON]\n    E --> G\n    F --> G\n```\n\n## 错误处理\n\n### LLMParsingError\n\n当 LLM 返回格式不符合预期时，引擎会抛出解析错误：\n\n```python\n# packages/notte-llm/src/notte_llm/engine.py\nif self.fail_if_outer_tag:\n    raise LLMParsingError(\n        f\"No content found within <{self.outer_tag}> tags in the response: {text}\"\n    )\n\nif self.fail_if_inner_tag:\n    raise LLMParsingError(\n        f\"No content found within ```{self.inner_tag}``` blocks in the response: {text}\"\n    )\n```\n\n### 常见错误场景\n\n| 错误类型 | 原因 | 解决方案 |\n|----------|------|----------|\n| 缺少外层标签 | LLM 未按要求输出 XML 标签 | 检查 prompt 模板配置 |\n| 缺少内层代码块 | JSON 数据未包裹在代码块中 | 使用 `fail_if_inner_tag=True` |\n| Schema 验证失败 | 返回数据不符合定义的结构 | 检查 JSON Schema 定义 |\n\n## 最佳实践\n\n1. **优先使用 Pydantic 模型**：通过类型提示获得更好的 IDE 支持和验证\n2. **明确的提取指令**：使用自然语言清晰描述需要提取的字段\n3. **合理设置作用域**：使用 `selector` 减少无关内容的干扰\n4. **启用主要内容提取**：设置 `only_main_content=True` 排除噪音\n\n## 相关链接\n\n- [ScrapeAction API 文档](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/actions/actions.py)\n- [LLM 解析引擎](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/src/notte_llm/engine.py)\n- [Prompt 模板目录](https://github.com/nottelabs/notte/tree/main/packages/notte-llm/src/notte_llm/prompts)\n\n---\n\n<a id='session-management'></a>\n\n## 会话管理系统\n\n### 相关页面\n\n相关主题：[动作执行系统](#action-system), [凭证保险库](#vault-credentials)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-browser/src/notte_browser/session.py](https://github.com/nottelabs/notte/blob/main/packages/notte-browser/src/notte_browser/session.py)\n- [packages/notte-browser/src/notte_browser/controller.py](https://github.com/nottelabs/notte/blob/main/packages/notte-browser/src/notte_browser/controller.py)\n- [packages/notte-browser/src/notte_browser/playwright.py](https://github.com/nottelabs/notte/blob/main/packages/notte-browser/src/notte_browser/playwright.py)\n- [packages/notte-integrations/src/notte_integrations/sessions/cdp_session.py](https://github.com/nottelabs/notte/blob/main/packages/notte-integrations/src/notte_integrations/sessions/cdp_session.py)\n</details>\n\n# 会话管理系统\n\n## 概述\n\n会话管理系统（Session Management System）是 Notte 项目中负责管理浏览器会话的核心模块。该系统提供了创建、控制、监控和终止浏览器会话的完整生命周期管理功能。Notte 的会话管理基于 Playwright 浏览器自动化框架，支持 Chrome 等多种浏览器的自动化控制。\n\n会话管理系统的主要职责包括：\n\n- 创建和管理浏览器会话实例\n- 处理会话的启动和停止\n- 管理会话级别的 Cookie 和浏览器状态\n- 提供页面观察（Observe）和动作执行（Execute）能力\n- 支持 CDP（Chrome DevTools Protocol）集成\n- 提供隐匿性功能（Stealth），包括代理配置和 CAPTCHA 处理\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py]()\n\n## 核心架构\n\n### 系统组件关系\n\n```mermaid\ngraph TD\n    A[NotteClient] --> B[Session]\n    B --> C[BrowserController]\n    C --> D[PlaywrightBrowser]\n    C --> E[CDPSession]\n    B --> F[Cookie管理]\n    B --> G[Proxy配置]\n    B --> H[观察与执行]\n```\n\nNotte 会话管理系统采用分层架构设计：\n\n| 层级 | 组件 | 职责 |\n|------|------|------|\n| 客户端层 | `NotteClient` | SDK 入口，管理会话创建 |\n| 会话层 | `Session` | 会话生命周期管理 |\n| 控制器层 | `BrowserController` | 浏览器控制抽象 |\n| 浏览器层 | `PlaywrightBrowser` / `CDPSession` | 底层浏览器操作 |\n| 存储层 | Cookie/Proxy | 持久化配置 |\n\n资料来源：[packages/notte-browser/src/notte_browser/controller.py]()\n\n### 关键模块\n\n| 模块路径 | 功能描述 |\n|----------|----------|\n| `notte_browser/session.py` | 浏览器会话核心实现 |\n| `notte_browser/controller.py` | 浏览器控制器抽象层 |\n| `notte_browser/playwright.py` | Playwright 浏览器实现 |\n| `notte_integrations/sessions/cdp_session.py` | CDP 协议集成实现 |\n\n## 会话生命周期\n\n### 状态机模型\n\n```mermaid\nstateDiagram-v2\n    [*] --> Created: 初始化\n    Created --> Starting: session.start()\n    Starting --> Running: 浏览器就绪\n    Running --> Executing: 执行动作\n    Executing --> Running: 动作完成\n    Running --> Stopping: session.stop()\n    Stopping --> Stopped: 清理完成\n    Stopped --> [*]\n    \n    Running --> Error: 异常发生\n    Error --> Stopped: 错误处理\n```\n\n### 创建会话\n\n会话可以通过 `NotteClient` 的 `Session()` 方法创建，支持上下文管理器（with语句）自动管理生命周期。\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\nwith client.Session() as session:\n    session.execute(type=\"goto\", url=\"https://example.com\")\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:50-60]()\n\n### 会话配置参数\n\n| 参数名 | 类型 | 默认值 | 说明 |\n|--------|------|--------|------|\n| `browser_type` | str | \"chrome\" | 浏览器类型（chrome, firefox等） |\n| `open_viewer` | bool | False | 是否打开可视化查看器 |\n| `proxies` | bool | False | 是否启用内置代理 |\n| `solve_captchas` | bool | False | 是否自动解决CAPTCHA |\n| `timeout_minutes` | int | 5 | 会话超时时间（分钟） |\n| `_cookie_file` | str | None | Cookie持久化文件路径 |\n\n## 浏览器控制器\n\n### BrowserController 抽象\n\n`BrowserController` 是浏览器控制的核心抽象类，定义了浏览器操作的统一接口。\n\n资料来源：[packages/notte-browser/src/notte_browser/controller.py]()\n\n### PlaywrightBrowser 实现\n\n`PlaywrightBrowser` 是基于 Playwright 框架的浏览器实现，负责底层的浏览器启动、页面导航、元素交互等操作。\n\n```python\n# Playwright 浏览器核心功能\n- 启动浏览器实例\n- 创建新页面/标签页\n- 执行页面导航\n- 元素定位和交互\n- 截图和页面内容抓取\n```\n\n资料来源：[packages/notte-browser/src/notte_browser/playwright.py]()\n\n### CDP Session 实现\n\nCDP（Chrome DevTools Protocol）会话提供了与 Chrome 浏览器的深层集成能力，适用于高级自动化场景。\n\n```python\nfrom notte_integrations.sessions.cdp_session import CDPSession\n\n# CDP 会话功能\n- 实时网络监控\n- JavaScript 执行拦截\n- 性能分析\n- 控制台日志捕获\n```\n\n资料来源：[packages/notte-integrations/src/notte_integrations/sessions/cdp_session.py]()\n\n## 会话观察与动作执行\n\n### 观察机制（Observe）\n\n观察机制用于获取当前页面的可交互元素列表，生成动作空间（Action Space）。\n\n```python\n# 快速观察（简单页面感知）\nobs = session.observe(perception_type='fast')\n\n# 深度观察（LLM格式化）\nobs = session.observe(perception_type='deep')\n\n# 带指令的观察\nactions = session.observe(instructions=\"填写邮箱输入框\")\n```\n\n| 感知类型 | 特点 | 适用场景 |\n|----------|------|----------|\n| `fast` | 简单页面感知，执行快速 | 简单页面、低延迟需求 |\n| `deep` | LLM调用格式化 | 复杂页面、精确动作空间 |\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:100-120]()\n\n### 动作执行（Execute）\n\n执行机制支持多种浏览器操作类型：\n\n| 动作类型 | 说明 | 示例 |\n|----------|------|------|\n| `goto` | 导航到指定URL | `type=\"goto\", url=\"...\"` |\n| `goto_new_tab` | 在新标签页打开URL | `type=\"goto_new_tab\", url=\"...\"` |\n| `close_tab` | 关闭当前标签页 | `type=\"close_tab\"` |\n| `scrape` | 抓取页面内容 | `type=\"scrape\", instructions=\"...\"` |\n| `click` | 点击元素 | `type=\"click\", id=\"B1\"` |\n| `fill` | 填写表单 | `type=\"fill\", id=\"I1\", value=\"...\"` |\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py]()\n\n## Cookie 管理\n\n### 自动Cookie保存\n\n会话停止时自动保存Cookie到指定文件：\n\n```python\nwith client.Session(_cookie_file=\"cookies.json\") as session:\n    # 访问需要登录的网站\n    session.execute(type=\"goto\", url=\"https://example.com\")\n# 退出时会话自动保存Cookie\n```\n\n### Cookie持久化机制\n\n```mermaid\nsequenceDiagram\n    participant Session\n    participant Client\n    participant Browser\n    participant CookieFile\n    \n    Session->>Browser: 执行操作\n    Session->>Session: session.stop()\n    Session->>Browser: get_cookies()\n    Browser->>Session: cookies_data\n    Session->>CookieFile: create_or_append_cookies_to_file()\n    CookieFile->>CookieFile: 保存Cookie\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:40-48]()\n\n## 隐匿性功能（Stealth）\n\n### 代理配置\n\nNotte 支持内置代理配置，用于增强自动化任务的匿名性：\n\n```python\nwith client.Session(\n    proxies=True,  # 启用内置代理（默认美国节点）\n    browser_type=\"chrome\",\n    open_viewer=True\n) as session:\n    agent = client.Agent(session=session, max_steps=5)\n    response = agent.run(\n        task=\"执行任务\",\n        url=\"https://example.com\"\n    )\n```\n\n### 自定义代理\n\n```python\nfrom notte_sdk import NotteClient, ExternalProxy\n\nclient = NotteClient()\n\nproxy_settings = ExternalProxy(\n    server=\"http://your-proxy-server:port\",\n    username=\"your-username\",\n    password=\"your-password\"\n)\n\nwith client.Session(proxy=proxy_settings) as session:\n    pass\n```\n\n### CAPTCHA处理\n\nNotte 内置CAPTCHA自动解决功能：\n\n```python\nwith client.Session(\n    solve_captchas=True,\n    browser_type=\"chrome\"\n) as session:\n    # 系统会自动检测和处理CAPTCHA\n    session.execute(type=\"goto\", url=\"https://example.com/recaptcha\")\n```\n\n## API 参考\n\n### NotteClient.Session()\n\n创建新的浏览器会话。\n\n**签名：**\n```python\ndef Session(\n    self,\n    browser_type: str = \"chrome\",\n    open_viewer: bool = False,\n    proxies: bool = False,\n    solve_captchas: bool = False,\n    timeout_minutes: int = 5,\n    _cookie_file: str | None = None,\n) -> Session:\n```\n\n**返回值：** `Session` 实例\n\n### Session.execute()\n\n执行浏览器动作。\n\n**签名：**\n```python\ndef execute(\n    self,\n    type: Literal[\"goto\", \"goto_new_tab\", \"close_tab\", \"scrape\", ...],\n    **kwargs\n) -> ExecutionResult:\n```\n\n### Session.observe()\n\n观察当前页面，生成动作空间。\n\n**签名：**\n```python\ndef observe(\n    self,\n    perception_type: Literal[\"fast\", \"deep\"] = \"fast\",\n    instructions: str | None = None,\n    **kwargs\n) -> ObserveResponse | list[InteractionActionUnion]:\n```\n\n## 最佳实践\n\n### 1. 使用上下文管理器\n\n始终使用 `with` 语句管理会话，确保资源正确释放：\n\n```python\n# 推荐写法\nwith client.Session() as session:\n    session.execute(type=\"goto\", url=\"https://example.com\")\n\n# 不推荐：需要手动调用stop()\nsession = client.Session()\ntry:\n    session.start()\n    session.execute(type=\"goto\", url=\"https://example.com\")\nfinally:\n    session.stop()\n```\n\n### 2. Cookie复用\n\n对于需要登录的网站，使用Cookie持久化避免重复登录：\n\n```python\n# 首次登录并保存Cookie\nwith client.Session(_cookie_file=\"session.json\") as session:\n    session.execute(type=\"goto\", url=\"https://example.com/login\")\n    # 执行登录操作...\n\n# 后续请求复用Cookie\nwith client.Session(_cookie_file=\"session.json\") as session:\n    session.execute(type=\"goto\", url=\"https://example.com/protected\")\n```\n\n### 3. 合理选择感知类型\n\n| 场景 | 推荐感知类型 |\n|------|-------------|\n| 简单表单填写 | `fast` |\n| 复杂页面导航 | `deep` |\n| 批量操作 | `fast` |\n| 精确元素定位 | `deep` |\n\n## 错误处理\n\n### 常见错误\n\n| 错误类型 | 原因 | 解决方案 |\n|----------|------|----------|\n| `ValueError` | 会话未启动 | 确保在 `with` 块内执行操作 |\n| `RuntimeError` | 会话关闭失败 | 检查浏览器进程状态 |\n| 浏览器启动失败 | Playwright未安装 | 运行 `playwright install` |\n\n### 错误恢复\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\n\ntry:\n    with client.Session() as session:\n        session.execute(type=\"goto\", url=\"https://example.com\")\nexcept Exception as e:\n    # 错误日志记录\n    print(f\"会话执行错误: {e}\")\n    # 重新创建会话\n```\n\n## 相关文档\n\n- [Agent 系统](../agent/agent-system.md)\n- [动作系统](../actions/actions.md)\n- [观察系统](../observation/observation.md)\n- [MCP 集成](../integrations/mcp-integration.md)\n\n---\n\n<a id='action-system'></a>\n\n## 动作执行系统\n\n### 相关页面\n\n相关主题：[会话管理系统](#session-management), [核心模块实现](#core-modules)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-core/src/notte_core/actions/actions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/actions/actions.py)\n- [packages/notte-core/src/notte_core/errors/processing.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/errors/processing.py)\n- [packages/notte-agent/src/notte_agent/falco/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/system.md)\n- [packages/notte-agent/src/notte_agent/falco/prompt.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/prompt.py)\n- [packages/notte-sdk/src/notte_sdk/endpoints/sessions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-sdk/src/notte_sdk/endpoints/sessions.py)\n</details>\n\n# 动作执行系统\n\n## 概述\n\n动作执行系统是 Notte 项目中负责与网页进行交互的核心模块。该系统定义了 Agent 可以执行的所有浏览器操作类型，包括页面导航、表单填充、元素点击、数据提取等。动作执行系统通过结构化的动作定义和统一的执行接口，使 AI Agent 能够以编程方式控制浏览器行为。\n\n系统架构遵循模块化设计原则，核心动作定义位于 `notte_core` 包中，而具体执行逻辑则在 `notte_browser` 和 `notte_agent` 包中实现。SDK 层提供了面向用户的简洁 API，隐藏了底层复杂性。\n\n## 动作类型体系\n\nNotte 的动作系统采用类型字面量（Literal Types）定义所有支持的浏览器操作。每一类动作都有明确的类型标识符、参数定义和执行消息。\n\n### 基础动作类型\n\n| 动作类型 | 描述 | 参数 |\n|---------|------|------|\n| `goto` | 导航到指定 URL | `url: str` |\n| `goto_new_tab` | 在新标签页中打开 URL | `url: str` |\n| `close_tab` | 关闭当前标签页 | 无 |\n| `click` | 点击元素 | `id: str` |\n| `hover` | 悬停在元素上 | `id: str` |\n| `scrape` | 从页面提取数据 | `instructions: str` |\n| `form_fill` | 填写表单 | `value: dict` |\n| `select_option` | 选择下拉选项 | `id: str`, `option: str` |\n| `captcha_solve` | 解决验证码 | `captcha_type: str` |\n| `reload` | 刷新页面 | 无 |\n\n### 导航动作\n\n#### GotoAction\n\n导航到指定 URL 是最基础的浏览器操作。`GotoAction` 接收一个 URL 参数，并将当前页面导航至该地址。\n\n```python\nclass GotoAction(BrowserAction):\n    type: Literal[\"goto\"] = \"goto\"\n    description: str = \"Navigate to a URL\"\n    url: str\n\n    def execution_message(self) -> str:\n        return f\"Navigated to '{self.url}'\"\n```\n\n**示例：**\n```python\nsession.execute(type=\"goto\", url=\"https://www.example.com\")\n```\n\n#### GotoNewTabAction\n\n在新的浏览器标签页中打开 URL。此动作不影响当前页面的状态。\n\n**示例：**\n```python\nsession.execute(type=\"goto_new_tab\", url=\"https://www.example.com\")\n```\n\n#### CloseTabAction\n\n关闭当前活跃的浏览器标签页。如果关闭的是最后一个标签页，浏览器会话将保持但显示空白页面。\n\n### 交互动作\n\n#### ClickAction\n\n点击页面上的可交互元素，如按钮、链接等。元素通过系统分配的 ID 标识。\n\n#### HoverAction\n\n将鼠标悬停在指定元素上，通常用于触发下拉菜单或显示隐藏内容。\n\n#### SelectOptionAction\n\n从 `<select>` 下拉列表中选择选项。需要指定目标元素 ID 和要选择的选项值。\n\n### 表单处理\n\n#### FormFillAction\n\n表单填写是网页交互中最常见的操作之一。`FormFillAction` 支持批量填写多个字段，支持多种输入类型。\n\n```python\n# 示例：填写地址表单\nform_values = {\n    \"address1\": \"123 Main St\",\n    \"city\": \"San Francisco\",\n    \"state\": \"CA\"\n}\nsession.execute(type=\"form_fill\", value=form_values)\n```\n\n系统会自动识别目标元素并进行相应的输入操作，支持文本框、文本域、下拉选择等多种表单控件。\n\n### 数据提取\n\n#### ScrapeAction\n\n从当前页面提取结构化数据。通过自然语言指令指定要提取的内容。\n\n```python\nobs = session.observe()\nscrape_result = session.execute(\n    type=\"scrape\",\n    instructions=\"提取所有搜索结果的标题和链接\"\n)\n```\n\n### 验证码处理\n\n#### CaptchaSolveAction\n\n处理页面上的验证码挑战。系统支持多种验证码类型，包括 reCAPTCHA、hCaptcha、图像验证等。\n\n**关键规则：**\n- 绝对不要直接点击验证码相关元素\n- 必须使用 `captcha_solve` 专用动作\n- 检测到验证码时应立即使用此动作\n\n```python\n# 解决 reCAPTCHA\nsession.execute(type=\"captcha_solve\", captcha_type=\"recaptcha\")\n```\n\n## 动作执行流程\n\n```mermaid\ngraph TD\n    A[用户/Agent 调用 execute] --> B[Session 接收动作请求]\n    B --> C{验证动作类型}\n    C -->|有效| D[构建动作对象]\n    C -->|无效| E[抛出 ValidationError]\n    D --> F[发送到 notte_browser 执行]\n    F --> G{执行结果}\n    G -->|成功| H[返回 ExecutionResult]\n    G -->|失败| I{错误类型}\n    I -->|可重试| J[执行重试逻辑]\n    I -->|不可重试| K[抛出异常]\n    J --> F\n```\n\n## 执行结果处理\n\n### ExecutionResult\n\n每次动作执行都会返回 `ExecutionResult` 对象，包含执行状态和相关信息：\n\n| 字段 | 类型 | 描述 |\n|------|------|------|\n| `success` | `bool` | 执行是否成功 |\n| `message` | `str` | 执行结果消息 |\n| `session_id` | `str` | 会话标识符 |\n| `url` | `str` | 执行后的页面 URL |\n| `error` | `str \\| None` | 错误信息（如果失败） |\n\n### 错误处理\n\n系统在 `notte_core/errors/processing.py` 中定义了丰富的错误类型：\n\n| 错误类型 | 触发条件 |\n|---------|---------|\n| `InvalidPlaceholderError` | 占位符无法解析 |\n| `ScrapeFailedError` | 数据提取失败 |\n| `InvalidA11yTreeType` | 无障碍树类型无效 |\n| `InvalidA11yChildrenError` | 元素子节点数量异常 |\n\n## 动作选择机制\n\n在 Agent 决策过程中，动作选择器（Action Selector）负责从页面的可交互元素中生成候选动作列表。\n\n```mermaid\ngraph LR\n    A[页面 DOM/Accessibility Tree] --> B[Perception 模块]\n    B --> C[生成交互元素列表]\n    C --> D[动作选择器 Pipe]\n    D --> E[过滤/排序候选动作]\n    E --> F[返回 ActionSpace]\n```\n\n### 元素标识符规范\n\n系统使用统一的前缀标识不同类型的可交互元素：\n\n| 前缀 | 元素类型 | 示例 |\n|------|---------|------|\n| `I` | 输入字段 | `I1`, `I2` |\n| `B` | 按钮 | `B1`, `B2` |\n| `L` | 链接 | `L1`, `L2` |\n| `F` | 图片/图形 | `F1` |\n| `O` | 下拉选项 | `O1` |\n| `M` | 杂项元素 | `M1` |\n\n## SDK 使用示例\n\n### 基本执行流程\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\nwith client.Session() as session:\n    # 导航\n    session.execute(type=\"goto\", url=\"https://console.notte.cc\")\n    \n    # 观察页面\n    obs = session.observe()\n    print(obs.space.description)\n    \n    # 执行交互\n    session.execute(type=\"click\", id=\"B1\")\n```\n\n### 带指令的观察\n\n使用 `instructions` 参数可以快速定位特定意图的交互元素：\n\n```python\nactions = session.observe(instructions=\"Fill the email input\")\nprint(actions[0].model_dump())\n```\n\n### 感知类型\n\n| 类型 | 描述 | 适用场景 |\n|------|------|---------|\n| `fast` | 快速页面感知，不调用 LLM | 高频交互、简单页面 |\n| `deep` | 深度感知，使用 LLM 格式化 | 复杂页面、需要结构化理解 |\n\n```python\n# 快速感知\nobs = session.observe(perception_type='fast')\n\n# 深度感知\nobs = session.observe(perception_type='deep')\n```\n\n## 动作定义源码结构\n\n核心动作类继承自 `BrowserAction` 基类，每个动作实现以下关键方法：\n\n```python\nclass BrowserAction(BaseModel):\n    type: str\n    description: str\n    \n    def execution_message(self) -> str:\n        \"\"\"返回动作执行后的状态消息\"\"\"\n        ...\n    \n    @staticmethod\n    def example() -> Self:\n        \"\"\"返回动作的示例实例\"\"\"\n        ...\n    \n    @property\n    def param(self) -> ActionParameter | None:\n        \"\"\"返回动作参数定义\"\"\"\n        ...\n```\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py:1-100]()\n\n## 最佳实践\n\n1. **使用上下文管理器**：始终使用 `with` 语句管理 Session，确保资源正确释放\n2. **选择合适的感知类型**：简单操作使用 `fast`，复杂页面使用 `deep`\n3. **验证元素存在性**：页面元素 ID 可能在不同步骤间变化，不要依赖历史 ID\n4. **处理验证码**：发现验证码时立即使用专用处理动作\n5. **检查执行结果**：始终检查 `ExecutionResult.success` 字段\n\n```python\n# 推荐做法\nwith client.Session() as session:\n    result = session.execute(type=\"goto\", url=\"https://example.com\")\n    if not result.success:\n        print(f\"Navigation failed: {result.error}\")\n```\n\n## 相关模块\n\n| 模块 | 职责 |\n|------|------|\n| `notte_core.actions` | 定义所有动作类型和基类 |\n| `notte_browser` | 实际执行浏览器操作 |\n| `notte_agent` | Agent 决策和动作选择 |\n| `notte_sdk` | 面向用户的执行接口 |\n\n---\n\n<a id='vault-credentials'></a>\n\n## 凭证保险库\n\n### 相关页面\n\n相关主题：[文件存储系统](#file-storage)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-core/src/notte_core/credentials/base.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/credentials/base.py)\n- [packages/notte-core/src/notte_core/credentials/types.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/credentials/types.py)\n- [packages/notte-browser/src/notte_browser/vault.py](https://github.com/nottelabs/notte/blob/main/packages/notte-browser/src/notte_browser/vault.py)\n- [examples/auth-vault-agent/agent.py](https://github.com/nottelabs/notte/blob/main/examples/auth-vault-agent/agent.py)\n</details>\n\n# 凭证保险库\n\n凭证保险库（Credentials Vault） 是 Notte 框架中用于安全管理用户凭证（credentials）和占位符（placeholder）的核心组件。它为 Agent 提供了一种安全的方式来存储、检索和使用敏感信息（如密码、API 密钥、验证码等），同时避免了这些敏感信息在日志或交互历史中暴露。\n\n## 功能概述\n\n凭证保险库的主要职责包括：\n\n| 功能 | 描述 |\n|------|------|\n| 凭证存储 | 安全存储用户的认证凭据 |\n| 占位符解析 | 将代码中的占位符替换为实际凭证值 |\n| 动态注入 | 在表单填写时自动注入凭证 |\n| 生命周期管理 | 管理凭证的有效期和刷新 |\n\n凭证保险库与 Agent 系统紧密集成，当 Agent 执行需要认证的任务时（如登录网站），系统会从保险库中获取相应凭证，而不是让 Agent 直接处理敏感数据。资料来源：[packages/notte-core/src/notte_core/errors/processing.py:31-38]()\n\n## 核心架构\n\n### 组件关系图\n\n```mermaid\ngraph TD\n    A[Agent] --> B[Vault]\n    B --> C[Credentials Store]\n    B --> D[Placeholder Resolver]\n    C --> E[BaseCredential]\n    D --> F[InvalidPlaceholderError]\n    G[Session] --> B\n    H[Action Execution] --> B\n```\n\n### 凭证类型体系\n\nNotte 框架定义了多种凭证类型，通过 `credentials/types.py` 中的类型系统进行管理：\n\n- **BaseCredential**：所有凭证类型的基类\n- **CredentialsPlaceholder**：用于在代码中引用保险库中的凭证\n- **AgentCredentials**：专门用于 Agent 认证场景的凭证\n\n资料来源：[packages/notte-core/src/notte_core/credentials/types.py]()\n\n## 使用方式\n\n### 基本使用流程\n\n```mermaid\ngraph LR\n    A[创建 Vault] --> B[添加凭证]\n    B --> C[Agent 执行任务]\n    C --> D[解析占位符]\n    D --> E[注入凭证]\n```\n\n### 在 Agent 中使用保险库\n\n以下示例展示了如何在 Agent 中集成凭证保险库：\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\n\n# 创建保险库并添加凭证\nwith client.Vault() as vault:\n    vault.add_credential(name=\"github_token\", value=\"ghp_xxxxx\")\n    vault.add_credential(name=\"email\", value=\"user@example.com\")\n    \n    with client.Session() as session:\n        agent = client.Agent(session=session, vault=vault, max_steps=10)\n        response = agent.run(\n            task=\"登录 GitHub 并访问我的仓库列表\"\n        )\n```\n\n资料来源：[examples/auth-vault-agent/agent.py]()\n\n### 占位符机制\n\n在任务描述中使用占位符引用保险库中的凭证：\n\n```python\n# 占位符格式\nvault.add_credential(name=\"github_password\", value=\"mypassword\")\n\n# 在任务中使用\ntask = \"使用凭证 {github_password} 登录 GitHub\"\n```\n\n当 Agent 执行时，系统会自动将 `{placeholder_name}` 格式的占位符替换为保险库中对应的实际值。\n\n## API 参考\n\n### Vault 类\n\n| 方法 | 参数 | 返回值 | 描述 |\n|------|------|--------|------|\n| `add_credential` | `name: str, value: str` | `None` | 添加新凭证 |\n| `get_credential` | `name: str` | `str` | 获取指定名称的凭证 |\n| `remove_credential` | `name: str` | `bool` | 删除指定凭证 |\n| `list_credentials` | - | `list[str]` | 列出所有凭证名称 |\n\n### 占位符错误处理\n\n当占位符未被正确处理时，系统会抛出 `InvalidPlaceholderError`：\n\n| 错误字段 | 说明 |\n|----------|------|\n| `dev_message` | 指出占位符未被当前保险库处理 |\n| `agent_message` | 提示 Agent 尝试选择其他值 |\n| `user_message` | 用户友好的错误提示 |\n\n资料来源：[packages/notte-core/src/notte_core/errors/processing.py:31-38]()\n\n## 最佳实践\n\n### 安全建议\n\n1. **敏感信息隔离**：所有敏感凭证应存储在 Vault 中，避免硬编码\n2. **环境变量分离**：生产环境中使用环境变量配置凭证，而非代码仓库\n3. **最小权限原则**：仅为 Agent 提供完成任务所需的最少凭证\n\n### 性能优化\n\n| 策略 | 描述 |\n|------|------|\n| 延迟加载 | 仅在需要时加载凭证到内存 |\n| 缓存机制 | 缓存已解析的占位符结果 |\n| 会话复用 | 在同一会话中复用保险库实例 |\n\n## 与其他组件的集成\n\n### 与 Session 集成\n\n保险库可以与浏览器会话配合使用，实现自动登录：\n\n```python\nwith client.Vault() as vault:\n    vault.add_credential(name=\"username\", value=\"user@example.com\")\n    vault.add_credential(name=\"password\", value=\"secret123\")\n    \n    with client.Session() as session:\n        agent = client.Agent(session=session, vault=vault)\n        # Agent 会自动使用 vault 中的凭证进行登录\n```\n\n### 与 Agent Persona 集成\n\n保险库可与 Agent Persona 结合使用，提供完整的数字身份认证能力：\n\n```python\nwith client.Vault() as vault:\n    with client.Persona() as persona:\n        with client.Session() as session:\n            agent = client.Agent(\n                session=session,\n                persona=persona,\n                vault=vault,\n                max_steps=15\n            )\n```\n\n资料来源：[README.md](https://github.com/nottelabs/notte/blob/main/README.md)\n\n## 实现细节\n\n### 凭证存储层\n\n凭证保险库的存储实现位于 `packages/notte-browser/src/notte_browser/vault.py`，该模块负责：\n\n- 本地凭证的安全存储\n- 与浏览器上下文的集成\n- 跨会话的凭证持久化\n\n### 核心基类\n\n`packages/notte-core/src/notte_core/credentials/base.py` 定义了凭证管理的抽象接口，包括：\n\n- 凭证的创建和销毁\n- 占位符的注册和解析\n- 凭证的验证和刷新\n\n资料来源：[packages/notte-core/src/notte_core/credentials/base.py]()\n\n## 总结\n\n凭证保险库是 Notte 框架安全架构的重要组成部分，它通过以下方式保护敏感信息：\n\n- 集中管理所有凭证\n- 使用占位符避免敏感信息暴露\n- 与 Agent 系统无缝集成\n- 提供完善的错误处理机制\n\n通过正确使用凭证保险库，开发者可以在保持安全性的同时，让 Agent 自动化执行需要认证的复杂任务。\n\n---\n\n<a id='file-storage'></a>\n\n## 文件存储系统\n\n### 相关页面\n\n相关主题：[凭证保险库](#vault-credentials)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-sdk/src/notte_sdk/endpoints/files.py](https://github.com/nottelabs/notte/blob/main/packages/notte-sdk/src/notte_sdk/endpoints/files.py)\n- [packages/notte-core/src/notte_core/storage.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/storage.py)\n- [docs/src/snippets/file-storage/quickstart.mdx](https://github.com/nottelabs/notte/blob/main/docs/src/snippets/file-storage/quickstart.mdx)\n</details>\n\n# 文件存储系统\n\n## 概述\n\nNotte 的文件存储系统是整个平台的核心模块之一，负责管理文件上传、下载、存储和检索功能。该系统与 Notte 的会话管理和浏览器交互功能紧密集成，为 AI Agent 提供持久化的文件存储能力。\n\n文件存储系统的主要职责包括：\n\n- 支持会话期间的文件上传与持久化\n- 提供文件元数据管理\n- 存储截图、图片等多媒体数据\n- 与 Vault 凭证管理系统集成\n\n## 核心架构\n\n### 数据模型\n\n文件存储系统的核心数据模型为 `FileData`，定义在 `packages/notte-core/src/notte_core/storage.py` 中：\n\n| 字段名 | 类型 | 说明 |\n|--------|------|------|\n| `id` | str | 文件唯一标识符 |\n| `name` | str | 文件名称 |\n| `mime_type` | str | 文件 MIME 类型 |\n| `size` | int | 文件大小（字节） |\n| `url` | str \\| None | 文件访问 URL |\n| `content` | bytes \\| None | 文件二进制内容 |\n\n### 存储层级\n\n```\n┌─────────────────────────────────────────────┐\n│              NotteClient                    │\n│  (packages/notte-sdk/src/notte_sdk)         │\n└─────────────────┬───────────────────────────┘\n                  │\n┌─────────────────▼───────────────────────────┐\n│         FilesEndpoint                       │\n│  (packages/notte-sdk/src/notte_sdk/         │\n│   endpoints/files.py)                       │\n└─────────────────┬───────────────────────────┘\n                  │\n┌─────────────────▼───────────────────────────┐\n│         StorageService                      │\n│  (packages/notte-core/src/notte_core/       │\n│   storage.py)                               │\n└─────────────────────────────────────────────┘\n```\n\n## API 接口\n\n### FilesEndpoint 类\n\n`FilesEndpoint` 是 SDK 层面的文件操作入口，提供以下核心方法：\n\n| 方法名 | 参数 | 返回类型 | 说明 |\n|--------|------|----------|------|\n| `upload` | file: FileData | FileData | 上传文件并返回包含 ID 的文件对象 |\n| `download` | file_id: str | bytes | 根据文件 ID 下载文件内容 |\n| `list` | - | list[FileData] | 列出所有已存储的文件 |\n| `delete` | file_id: str | None | 删除指定文件 |\n\n### 端点路由\n\n文件存储 API 的基础端点为：\n\n```\nPOST /api/files/upload\nGET  /api/files/{file_id}\nGET  /api/files/{file_id}/download\nDELETE /api/files/{file_id}\nGET  /api/files\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/files.py:1-100]()\n\n## 存储类型\n\nNotte 支持多种类型的文件存储：\n\n### 用户上传文件\n\n用户通过 SDK 上传的自定义文件，如文档、配置文件等。\n\n### 截图数据\n\n浏览器截图自动存储为文件，便于 Agent 回溯和调试：\n\n```python\nclass ScreenshotData(BaseModel):\n    id: str\n    timestamp: datetime\n    data: bytes\n    session_id: str\n```\n\n### 图片数据\n\n`ImageData` 类封装了从网页抓取的图片资源：\n\n```python\nclass ImageData(BaseModel):\n    url: str | None\n    alt_text: str | None\n    id: str\n    \n    def bytes(self) -> bytes:\n        \"\"\"获取图片字节数据\"\"\"\n```\n\n资料来源：[packages/notte-core/src/notte_core/data/space.py:50-70]()\n\n## 与会话系统集成\n\n文件存储与 Notte 的会话管理系统深度集成。在会话运行期间：\n\n1. **会话启动时**：可以指定 `cookies_file` 参数自动保存会话 cookie 到指定文件\n2. **会话运行中**：截图和图片自动关联到当前会话\n3. **会话结束时**：文件保持持久化，可供后续会话访问\n\n```python\n# 会话文件存储示例\nwith client.Session(cookies_file=\"./cookies.json\") as session:\n    session.execute(type=\"goto\", url=\"https://example.com\")\n    # 截图自动保存为文件\n    screenshot = session.screenshot()\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:80-95]()\n\n## 快速开始\n\n### 安装与配置\n\n确保已安装 notte-sdk：\n\n```bash\npip install notte-sdk\n```\n\n### 上传文件\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\nfiles = client.files\n\n# 上传本地文件\nwith open(\"document.pdf\", \"rb\") as f:\n    file_data = files.upload(\n        name=\"document.pdf\",\n        content=f.read(),\n        mime_type=\"application/pdf\"\n    )\n    print(f\"文件已上传，ID: {file_data.id}\")\n```\n\n### 下载文件\n\n```python\n# 通过文件 ID 下载\ncontent = files.download(file_id=\"abc123\")\nwith open(\"output.pdf\", \"wb\") as f:\n    f.write(content)\n```\n\n### 列出文件\n\n```python\n# 列出所有已存储的文件\nall_files = files.list()\nfor file in all_files:\n    print(f\"{file.id}: {file.name} ({file.size} bytes)\")\n```\n\n资料来源：[docs/src/snippets/file-storage/quickstart.mdx:1-50]()\n\n## 错误处理\n\n文件存储系统定义了以下专用错误类型：\n\n### StorageError\n\n基础存储错误类，所有存储相关异常都继承于此。\n\n### FileNotFoundError\n\n当请求的文件不存在时抛出：\n\n```python\nclass FileNotFoundError(NotteBaseError):\n    def __init__(self, file_id: str) -> None:\n        super().__init__(\n            dev_message=f\"File with id {file_id} not found in storage\",\n            agent_message=f\"Unable to access file\",\n            user_message=\"The requested file could not be found\"\n        )\n```\n\n### StorageQuotaExceededError\n\n存储配额超限时的异常。\n\n资料来源：[packages/notte-core/src/notte_core/storage.py:30-60]()\n\n## 最佳实践\n\n### 文件管理策略\n\n1. **定期清理**：定期调用 `delete` 方法清理不再需要的文件\n2. **批量操作**：使用 `list` 方法获取文件列表后进行批量筛选\n3. **命名规范**：为文件指定清晰的 `name` 便于识别\n\n### 性能优化\n\n- 大文件建议分块上传\n- 图片资源优先使用 `url` 引用而非直接存储 `content`\n- 敏感文件使用 Vault 加密存储\n\n## 相关模块\n\n| 模块 | 路径 | 说明 |\n|------|------|------|\n| `SessionsEndpoint` | `packages/notte-sdk/src/notte_sdk/endpoints/sessions.py` | 会话管理，包含文件相关的 cookie 存储 |\n| `StructuredData` | `packages/notte-core/src/notte_core/data/space.py` | 结构化数据存储 |\n| `ImageData` | `packages/notte-core/src/notte_core/data/space.py` | 图片数据管理 |\n| `Vault` | `packages/notte-core/src/notte_core/vault.py` | 敏感文件加密存储 |\n\n---\n\n---\n\n## Doramagic 踩坑日志\n\n项目：nottelabs/notte\n\n摘要：发现 14 个潜在踩坑项，其中 0 个为 high/blocking；最高优先级：安装坑 - 来源证据：v1.8.8。\n\n## 1. 安装坑 · 来源证据：v1.8.8\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：v1.8.8\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_5224b46e2312471c976888e8a2f8f4a6 | https://github.com/nottelabs/notte/releases/tag/v1.8.8 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 2. 配置坑 · 来源证据：v1.8.13\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.13\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_56505da48cd74758ab7a9a1d82092e18 | https://github.com/nottelabs/notte/releases/tag/v1.8.13 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 3. 配置坑 · 来源证据：v1.8.14\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.14\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_8f78a2591cea4f5aad8bfa0cb0ea15a0 | https://github.com/nottelabs/notte/releases/tag/v1.8.14 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 4. 配置坑 · 来源证据：v1.8.15\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.15\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_f611f1d0dd2440af8e84e9544ab1bdb6 | https://github.com/nottelabs/notte/releases/tag/v1.8.15 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 5. 配置坑 · 来源证据：v1.8.6\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.6\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_0ed3c86ff7a34e5896a4daeb75552d4d | https://github.com/nottelabs/notte/releases/tag/v1.8.6 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 6. 配置坑 · 来源证据：v1.8.9\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.9\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_6195971390e8494f88083c862aef7eb6 | https://github.com/nottelabs/notte/releases/tag/v1.8.9 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 7. 能力坑 · 能力判断依赖假设\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：README/documentation is current enough for a first validation pass.\n- 对用户的影响：假设不成立时，用户拿不到承诺的能力。\n- 建议检查：将假设转成下游验证清单。\n- 防护动作：假设必须转成验证项；没有验证结果前不能写成事实。\n- 证据：capability.assumptions | github_repo:900152988 | https://github.com/nottelabs/notte | README/documentation is current enough for a first validation pass.\n\n## 8. 运行坑 · 来源证据：v1.8.7\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个运行相关的待验证问题：v1.8.7\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_ab102ac99c2441118475601c34ab0ee9 | https://github.com/nottelabs/notte/releases/tag/v1.8.7 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 9. 维护坑 · 维护活跃度未知\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：未记录 last_activity_observed。\n- 对用户的影响：新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。\n- 建议检查：补 GitHub 最近 commit、release、issue/PR 响应信号。\n- 防护动作：维护活跃度未知时，推荐强度不能标为高信任。\n- 证据：evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | last_activity_observed missing\n\n## 10. 安全/权限坑 · 下游验证发现风险项\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：下游已经要求复核，不能在页面中弱化。\n- 建议检查：进入安全/权限治理复核队列。\n- 防护动作：下游风险存在时必须保持 review/recommendation 降级。\n- 证据：downstream_validation.risk_items | github_repo:900152988 | https://github.com/nottelabs/notte | no_demo; severity=medium\n\n## 11. 安全/权限坑 · 存在安全注意事项\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：No sandbox install has been executed yet; downstream must verify before user use.\n- 对用户的影响：用户安装前需要知道权限边界和敏感操作。\n- 建议检查：转成明确权限清单和安全审查提示。\n- 防护动作：安全注意事项必须面向用户前置展示。\n- 证据：risks.safety_notes | github_repo:900152988 | https://github.com/nottelabs/notte | No sandbox install has been executed yet; downstream must verify before user use.\n\n## 12. 安全/权限坑 · 存在评分风险\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：风险会影响是否适合普通用户安装。\n- 建议检查：把风险写入边界卡，并确认是否需要人工复核。\n- 防护动作：评分风险必须进入边界卡，不能只作为内部分数。\n- 证据：risks.scoring_risks | github_repo:900152988 | https://github.com/nottelabs/notte | no_demo; severity=medium\n\n## 13. 维护坑 · issue/PR 响应质量未知\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：issue_or_pr_quality=unknown。\n- 对用户的影响：用户无法判断遇到问题后是否有人维护。\n- 建议检查：抽样最近 issue/PR，判断是否长期无人处理。\n- 防护动作：issue/PR 响应未知时，必须提示维护风险。\n- 证据：evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | issue_or_pr_quality=unknown\n\n## 14. 维护坑 · 发布节奏不明确\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：release_recency=unknown。\n- 对用户的影响：安装命令和文档可能落后于代码，用户踩坑概率升高。\n- 建议检查：确认最近 release/tag 和 README 安装命令是否一致。\n- 防护动作：发布节奏未知或过期时，安装说明必须标注可能漂移。\n- 证据：evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | release_recency=unknown\n\n<!-- canonical_name: nottelabs/notte; human_manual_source: deepwiki_human_wiki -->\n",
      "markdown_key": "notte",
      "pages": "draft",
      "source_refs": [
        {
          "evidence_id": "github_repo:900152988",
          "kind": "repo",
          "supports_claim_ids": [
            "claim_identity",
            "claim_distribution",
            "claim_capability"
          ],
          "url": "https://github.com/nottelabs/notte"
        },
        {
          "evidence_id": "art_feecfff69eb846bb9af8379f8c0a1e5c",
          "kind": "docs",
          "supports_claim_ids": [
            "claim_identity",
            "claim_distribution",
            "claim_capability"
          ],
          "url": "https://github.com/nottelabs/notte#readme"
        }
      ],
      "summary": "DeepWiki/Human Wiki 完整输出，末尾追加 Discovery Agent 踩坑日志。",
      "title": "notte 说明书",
      "toc": [
        "https://github.com/nottelabs/notte 项目说明书",
        "目录",
        "项目介绍",
        "项目概述",
        "核心定位",
        "技术架构",
        "核心功能模块",
        "示例：导航动作",
        "Doramagic 踩坑日志"
      ]
    }
  },
  "quality_gate": {
    "blocking_gaps": [],
    "category_confidence": "medium",
    "compile_status": "ready_for_review",
    "five_assets_present": true,
    "install_sandbox_verified": true,
    "missing_evidence": [],
    "next_action": "publish to Doramagic.ai project surfaces",
    "prompt_preview_boundary_ok": true,
    "publish_status": "publishable",
    "quick_start_verified": true,
    "repo_clone_verified": true,
    "repo_commit": "eddc2c0cd9306d6bb7695352300aa42f5ea69760",
    "repo_inspection_error": null,
    "repo_inspection_files": [
      "pyproject.toml",
      "README.md",
      "uv.lock",
      "docs/sdk_tutorial.md",
      "docs/change_local_config.md",
      "docs/scraping_tutorial.md",
      "docs/CONTRIBUTING.md",
      "docs/run_ollama_local_models.md",
      "docs/setup.md",
      "docs/run_notte_with_external_browsers.md",
      "docs/src/trust-center.mdx",
      "docs/src/rate-limits.mdx",
      "docs/src/concepts.mdx",
      "docs/src/cookies.json",
      "docs/src/cli.mdx",
      "docs/src/.mcp.json",
      "docs/src/zin.mdx",
      "docs/src/pricing.mdx",
      "docs/src/index.mdx",
      "docs/src/README.md",
      "docs/src/docs.json",
      "docs/src/quickstart.mdx",
      "docs/src/changelog.mdx",
      "docs/sphinx/conf.py",
      "docs/src/sniptest/verify_all_mdx.py",
      "docs/src/sniptest/parser.py",
      "docs/src/sniptest/verify_snippets.py",
      "docs/src/sniptest/generate.py",
      "docs/src/api-reference/rate-limits.mdx",
      "docs/src/api-reference/errors.mdx",
      "docs/src/api-reference/authentication.mdx",
      "docs/src/concepts/scraping.mdx",
      "docs/src/concepts/file-storage.mdx",
      "docs/src/concepts/personas.mdx",
      "docs/src/concepts/bua.mdx",
      "docs/src/concepts/functions.mdx",
      "docs/src/concepts/agents.mdx",
      "docs/src/concepts/sessions.mdx",
      "docs/src/concepts/vaults.mdx",
      "docs/src/scripts/inline_quickstart_setup_prompt.py"
    ],
    "repo_inspection_verified": true,
    "review_reasons": [],
    "tag_count_ok": true,
    "unsupported_claims": []
  },
  "schema_version": "0.1",
  "user_assets": {
    "ai_context_pack": {
      "asset_id": "ai_context_pack",
      "filename": "AI_CONTEXT_PACK.md",
      "markdown": "# notte - Doramagic AI Context Pack\n\n> 定位：安装前体验与判断资产。它帮助宿主 AI 有一个好的开始，但不代表已经安装、执行或验证目标项目。\n\n## 充分原则\n\n- **充分原则，不是压缩原则**：AI Context Pack 应该充分到让宿主 AI 在开工前理解项目价值、能力边界、使用入口、风险和证据来源；它可以分层组织，但不以最短摘要为目标。\n- **压缩策略**：只压缩噪声和重复内容，不压缩会影响判断和开工质量的上下文。\n\n## 给宿主 AI 的使用方式\n\n你正在读取 Doramagic 为 notte 编译的 AI Context Pack。请把它当作开工前上下文：帮助用户理解适合谁、能做什么、如何开始、哪些必须安装后验证、风险在哪里。不要声称你已经安装、运行或执行了目标项目。\n\n## Claim 消费规则\n\n- **事实来源**：Repo Evidence + Claim/Evidence Graph；Human Wiki 只提供显著性、术语和叙事结构。\n- **事实最低状态**：`supported`\n- `supported`：可以作为项目事实使用，但回答中必须引用 claim_id 和证据路径。\n- `weak`：只能作为低置信度线索，必须要求用户继续核实。\n- `inferred`：只能用于风险提示或待确认问题，不能包装成项目事实。\n- `unverified`：不得作为事实使用，应明确说证据不足。\n- `contradicted`：必须展示冲突来源，不得替用户强行选择一个版本。\n\n## 它最适合谁\n\n- **正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**：README 或插件配置提到多个宿主 AI。 证据：`README.md` Claim：`clm_0002` supported 0.86\n\n## 它能做什么\n\n- **命令行启动或安装流程**（需要安装后验证）：项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 证据：`README.md`, `packages/notte-llm/README.md`, `packages/notte-mcp/README.md`, `packages/notte-sdk/README.md` 等 Claim：`clm_0001` supported 0.86\n\n## 怎么开始\n\n- `pip install notte` 证据：`README.md` Claim：`clm_0003` supported 0.86, `clm_0005` supported 0.86, `clm_0006` supported 0.86, `clm_0007` supported 0.86\n- `curl -X POST 'https://api.notte.cc/scrape' \\` 证据：`README.md` Claim：`clm_0004` supported 0.86\n- `pip install notte-llm` 证据：`packages/notte-llm/README.md` Claim：`clm_0005` supported 0.86\n- `pip install notte-mcp` 证据：`packages/notte-mcp/README.md` Claim：`clm_0006` supported 0.86\n- `pip install notte-sdk` 证据：`packages/notte-sdk/README.md` Claim：`clm_0007` supported 0.86\n- `curl -s https://raw.githubusercontent.com/nottelabs/notte/refs/heads/main/examples/quickstart_launcher.py -o examples/quickstart_launcher.py` 证据：`quickstart.sh` Claim：`clm_0008` unverified 0.25\n\n## 继续前判断卡\n\n- **当前建议**：需要管理员/安全审批\n- **为什么**：继续前可能涉及密钥、账号、外部服务或敏感上下文，建议先经过管理员或安全审批。\n\n### 30 秒判断\n\n- **现在怎么做**：需要管理员/安全审批\n- **最小安全下一步**：先跑 Prompt Preview；若涉及凭证或企业环境，先审批再试装\n- **先别相信**：角色质量和任务匹配不能直接相信。\n- **继续会触碰**：角色选择偏差、命令执行、本地环境或项目文件\n\n### 现在可以相信\n\n- **适合人群线索：正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**（supported）：有 supported claim 或项目证据支撑，但仍不等于真实安装效果。 证据：`README.md` Claim：`clm_0002` supported 0.86\n- **能力存在：命令行启动或安装流程**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`README.md`, `packages/notte-llm/README.md`, `packages/notte-mcp/README.md`, `packages/notte-sdk/README.md` 等 Claim：`clm_0001` supported 0.86\n- **存在 Quick Start / 安装命令线索**（supported）：可以相信项目文档出现过启动或安装入口；不要因此直接在主力环境运行。 证据：`README.md` Claim：`clm_0003` supported 0.86, `clm_0005` supported 0.86, `clm_0006` supported 0.86, `clm_0007` supported 0.86\n\n### 现在还不能相信\n\n- **角色质量和任务匹配不能直接相信。**（unverified）：角色库证明有很多角色，不证明每个角色都适合你的具体任务，也不证明角色能产生高质量结果。\n- **不能把角色文案当成真实执行能力。**（unverified）：安装前只能判断角色描述和任务画像是否匹配，不能证明它能在宿主 AI 里完成任务。\n- **真实输出质量不能在安装前相信。**（unverified）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。\n- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。\n- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。\n- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。\n- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。\n- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。\n\n### 继续会触碰什么\n\n- **角色选择偏差**：用户对任务应该由哪个专家角色处理的判断。 原因：选错角色会让 AI 从错误专业视角回答，浪费时间或误导决策。\n- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`, `packages/notte-llm/README.md`, `packages/notte-mcp/README.md`, `packages/notte-sdk/README.md` 等\n- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`README.md`, `packages/notte-llm/README.md`, `packages/notte-mcp/README.md`, `packages/notte-sdk/README.md` 等\n- **环境变量 / API Key**：项目入口文档明确出现 API key、token、secret 或账号凭证配置。 原因：如果真实安装需要凭证，应先使用测试凭证并经过权限/合规判断。 证据：`README.md`, `docs/scraping_tutorial.md`, `docs/sdk_tutorial.md`, `docs/src/scripts/generate_llms.py` 等\n- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。\n\n### 最小安全下一步\n\n- **先跑 Prompt Preview**：先用交互式试用验证任务画像和角色匹配，不要先导入整套角色库。（适用：任何项目都适用，尤其是输出质量未知时。）\n- **只在隔离目录或测试账号试装**：避免安装命令污染主力宿主 AI、真实项目或用户主目录。（适用：存在命令执行、插件配置或本地写入线索时。）\n- **不要使用真实生产凭证**：环境变量/API key 一旦进入宿主或工具链，可能产生账号和合规风险。（适用：出现 API、TOKEN、KEY、SECRET 等环境线索时。）\n- **安装后只验证一个最小任务**：先验证加载、兼容、输出质量和回滚，再决定是否深用。（适用：准备从试用进入真实工作流时。）\n\n### 退出方式\n\n- **保留安装前状态**：记录原始宿主配置和项目状态，后续才能判断是否可恢复。\n- **保留原始角色选择记录**：如果输出偏题，可以回到任务画像阶段重新选择角色，而不是继续沿着错误角色推进。\n- **记录安装命令和写入路径**：没有明确卸载说明时，至少要知道哪些目录或配置需要手动清理。\n- **准备撤销测试 API key 或 token**：测试凭证泄露或误用时，可以快速止损。\n- **如果没有回滚路径，不进入主力环境**：不可回滚是继续前阻断项，不应靠信任或运气继续。\n\n## 哪些只能预览\n\n- 解释项目适合谁和能做什么\n- 基于项目文档演示典型对话流程\n- 帮助用户判断是否值得安装或继续研究\n\n## 哪些必须安装后验证\n\n- 真实安装 Skill、插件或 CLI\n- 执行脚本、修改本地文件或访问外部服务\n- 验证真实输出质量、性能和兼容性\n\n## 边界与风险判断卡\n\n- **把安装前预览误认为真实运行**：用户可能高估项目已经完成的配置、权限和兼容性验证。 处理方式：明确区分 prompt_preview_can_do 与 runtime_required。 Claim：`clm_0009` inferred 0.45\n- **命令执行会修改本地环境**：安装命令可能写入用户主目录、宿主插件目录或项目配置。 处理方式：先在隔离环境或测试账号中运行。 证据：`README.md`, `packages/notte-llm/README.md`, `packages/notte-mcp/README.md`, `packages/notte-sdk/README.md` 等 Claim：`clm_0010` supported 0.86\n- **待确认**：真实安装后是否与用户当前宿主 AI 版本兼容？。原因：兼容性只能通过实际宿主环境验证。\n- **待确认**：项目输出质量是否满足用户具体任务？。原因：安装前预览只能展示流程和边界，不能替代真实评测。\n- **待确认**：安装命令是否需要网络、权限或全局写入？。原因：这影响企业环境和个人环境的安装风险。\n\n## 开工前工作上下文\n\n### 加载顺序\n\n- 先读取 how_to_use.host_ai_instruction，建立安装前判断资产的边界。\n- 读取 claim_graph_summary，确认事实来自 Claim/Evidence Graph，而不是 Human Wiki 叙事。\n- 再读取 intended_users、capabilities 和 quick_start_candidates，判断用户是否匹配。\n- 需要执行具体任务时，优先查 role_skill_index，再查 evidence_index。\n- 遇到真实安装、文件修改、网络访问、性能或兼容性问题时，转入 risk_card 和 boundaries.runtime_required。\n\n### 任务路由\n\n- **命令行启动或安装流程**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`README.md`, `packages/notte-llm/README.md`, `packages/notte-mcp/README.md`, `packages/notte-sdk/README.md` 等 Claim：`clm_0001` supported 0.86\n\n### 上下文规模\n\n- 文件总数：1751\n- 重要文件覆盖：40/1751\n- 证据索引条目：76\n- 角色 / Skill 条目：56\n\n### 证据不足时的处理\n\n- **missing_evidence**：说明证据不足，要求用户提供目标文件、README 段落或安装后验证记录；不要补全事实。\n- **out_of_scope_request**：说明该任务超出当前 AI Context Pack 证据范围，并建议用户先查看 Human Manual 或真实安装后验证。\n- **runtime_request**：给出安装前检查清单和命令来源，但不要替用户执行命令或声称已执行。\n- **source_conflict**：同时展示冲突来源，标记为待核实，不要强行选择一个版本。\n\n## Prompt Recipes\n\n### 适配判断\n\n- 目标：判断这个项目是否适合用户当前任务。\n- 预期输出：适配结论、关键理由、证据引用、安装前可预览内容、必须安装后验证内容、下一步建议。\n\n```text\n请基于 notte 的 AI Context Pack，先问我 3 个必要问题，然后判断它是否适合我的任务。回答必须包含：适合谁、能做什么、不能做什么、是否值得安装、证据来自哪里。所有项目事实必须引用 evidence_refs、source_paths 或 claim_id。\n```\n\n### 安装前体验\n\n- 目标：让用户在安装前感受核心工作流，同时避免把预览包装成真实能力或营销承诺。\n- 预期输出：一段带边界标签的体验剧本、安装后验证清单和谨慎建议；不含真实运行承诺或强营销表述。\n\n```text\n请把 notte 当作安装前体验资产，而不是已安装工具或真实运行环境。\n\n请严格输出四段：\n1. 先问我 3 个必要问题。\n2. 给出一段“体验剧本”：用 [安装前可预览]、[必须安装后验证]、[证据不足] 三种标签展示它可能如何引导工作流。\n3. 给出安装后验证清单：列出哪些能力只有真实安装、真实宿主加载、真实项目运行后才能确认。\n4. 给出谨慎建议：只能说“值得继续研究/试装”“先补充信息后再判断”或“不建议继续”，不得替项目背书。\n\n硬性边界：\n- 不要声称已经安装、运行、执行测试、修改文件或产生真实结果。\n- 不要写“自动适配”“确保通过”“完美适配”“强烈建议安装”等承诺性表达。\n- 如果描述安装后的工作方式，必须使用“如果安装成功且宿主正确加载 Skill，它可能会……”这种条件句。\n- 体验剧本只能写成“示例台词/假设流程”：使用“可能会询问/可能会建议/可能会展示”，不要写“已写入、已生成、已通过、正在运行、正在生成”。\n- Prompt Preview 不负责给安装命令；如用户准备试装，只能提示先阅读 Quick Start 和 Risk Card，并在隔离环境验证。\n- 所有项目事实必须来自 supported claim、evidence_refs 或 source_paths；inferred/unverified 只能作风险或待确认项。\n\n```\n\n### 角色 / Skill 选择\n\n- 目标：从项目里的角色或 Skill 中挑选最匹配的资产。\n- 预期输出：候选角色或 Skill 列表，每项包含适用场景、证据路径、风险边界和是否需要安装后验证。\n\n```text\n请读取 role_skill_index，根据我的目标任务推荐 3-5 个最相关的角色或 Skill。每个推荐都要说明适用场景、可能输出、风险边界和 evidence_refs。\n```\n\n### 风险预检\n\n- 目标：安装或引入前识别环境、权限、规则冲突和质量风险。\n- 预期输出：环境、权限、依赖、许可、宿主冲突、质量风险和未知项的检查清单。\n\n```text\n请基于 risk_card、boundaries 和 quick_start_candidates，给我一份安装前风险预检清单。不要替我执行命令，只说明我应该检查什么、为什么检查、失败会有什么影响。\n```\n\n### 宿主 AI 开工指令\n\n- 目标：把项目上下文转成一次对话开始前的宿主 AI 指令。\n- 预期输出：一段边界明确、证据引用明确、适合复制给宿主 AI 的开工前指令。\n\n```text\n请基于 notte 的 AI Context Pack，生成一段我可以粘贴给宿主 AI 的开工前指令。这段指令必须遵守 not_runtime=true，不能声称项目已经安装、运行或产生真实结果。\n```\n\n\n## 角色 / Skill 索引\n\n- 共索引 56 个角色 / Skill / 项目文档条目。\n\n- **Mintlify documentation**（project_doc）：Working relationship - You can push back on ideas-this can lead to better documentation. Cite sources and explain your reasoning when you do so - ALWAYS ask for clarification rather than making assumptions - NEVER lie, guess, or make up anything 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/src/.claude/CLAUDE.md`\n- **Mintlify Starter Kit**（project_doc）：Click on Use this template to copy the Mintlify starter kit. The starter kit contains examples including 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/src/README.md`\n- **How to Contribute**（project_doc）：You can contribute to Notte by submitting a PR or by reporting an issue. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/CONTRIBUTING.md`\n- **Rapidly build reliable web automation agents**（project_doc）：Rapidly build reliable web automation agents 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`README.md`\n- **Running benchmarks**（project_doc）：Running benchmarks should be as easy as running this command: 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`benchmarks/README.md`\n- **How to run the examples**（project_doc）：The setup is the same for all the examples. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/README.md`\n- **Auth Vault Agent**（project_doc）：This example shows how to use the Auth Vault Agent to authenticate to a website, in this case, the GitHub website, securely using a secure Notte Vault to store and access the credentials. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/auth-vault-agent/README.md`\n- **Email Notifier Agent**（project_doc）：This examples shows how you can recieve emails containing the agent's task output once the agent is done running. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/email-notifier-agent/README.md`\n- **Github Auto Issues Trending Repos**（project_doc）：This example shows how you can use the Github API to automatically create issues for the latest trending repositories. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/github-auto-issues-trending-repos/README.md`\n- **Order on ubereats agent**（project_doc）：This example shows an agent using a vault to log in on ubereats, and order a burger menu. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/order-on-ubereats/README.md`\n- **Scrape logo**（project_doc）：Simple example on how to scrape the logo of a website 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/scrape-logo/README.md`\n- **Scrape Nike products**（project_doc）：This example shows how you can scrape a website using Notte. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/scrape-nike-products/README.md`\n- **Star our repo agent**（project_doc）：This example shows a simple agent using an auth vault to load github credentials including 2fa code , sign in, and star our github repo. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/star-our-repo/README.md`\n- **Readme**（project_doc）： 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-agent/README.md`\n- **How to build an LLM agent with Notte**（project_doc）：How to build an LLM agent with Notte 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-agent/src/notte_agent/README.md`\n- **Notte Browser**（project_doc）：The browser component of the Notte agentic ecosystem, designed to provide a seamless interface between LLM agents and web browsing capabilities. This package serves as the foundational layer that enables AI agents to interact with web content in a structured and efficient manner. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-browser/README.md`\n- **Readme**（project_doc）： 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-core/README.md`\n- **Readme**（project_doc）： 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-eval/README.md`\n- **Readme**（project_doc）： 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-integrations/README.md`\n- **Basic example code**（project_doc）：python from notte agent.main import Agent from notte integrations.credentials.hashicorp.vault import HashiCorpVault import os from dotenv import load dotenv 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-integrations/src/notte_integrations/credentials/README.md`\n- **notte-llm**（project_doc）：LLM integration for Notte, providing LiteLLM-based services for language model interactions. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/README.md`\n- **Notte MCP Server**（project_doc）：⚡️ we outperform other web agents in speed, costs and reliability 👉🏼 read more on open-operator-evals 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-mcp/README.md`\n- **Notte SDK**（project_doc）：The Notte SDK is a powerful Python library that provides a seamless interface for interacting with web automation and AI-powered agents. It enables developers to create, manage, and monitor web automation sessions and AI agents with ease. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-sdk/README.md`\n- **How to change the local notte config**（project_doc）：How to change the local notte config 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/change_local_config.md`\n- **How to run Notte with external browsers ?**（project_doc）：How to run Notte with external browsers ? 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/run_notte_with_external_browsers.md`\n- **How to use local LLMs Ollama to power Notte**（project_doc）：How to use local LLMs Ollama to power Notte 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/run_ollama_local_models.md`\n- **Web Scraping with Notte**（project_doc）：Notte provides powerful tools for web scraping that can extract both raw content and structured data from web pages. This tutorial will guide you through the different ways you can use Notte for web scraping. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/scraping_tutorial.md`\n- **Notte SDK Tutorial**（project_doc）：python from notte sdk.client import NotteClient import os notte = NotteClient api key=os.getenv \"NOTTE API KEY\" 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/sdk_tutorial.md`\n- **Local Setup of Notte**（project_doc）：To install notte locally, run the following commands: 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/setup.md`\n- **sniptest**（project_doc）：Tool for generating tested code snippets for Mintlify docs. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/src/.claude/rules/code-snippets.md`\n- **Icon Mapping**（project_doc）：Use consistent icons across all documentation. This mapping ensures visual consistency. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/src/.claude/rules/icons.md`\n- **Naming Conventions**（project_doc）：When instantiating the NotteClient , always name the variable client , not notte . 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/src/.claude/rules/naming-conventions.md`\n- **Mintlify technical writing rule**（project_doc）：Standards for writing Mintlify technical documentation including component usage, writing style, and best practices. Apply when working with MDX files, documentation content, or Mintlify components. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/src/.cursor/rules/mintlify-technical-writing/RULE.md`\n- **Copyright**（project_doc）：This software is licensed under the Server Side Public License v1. See LICENSE file for full license text. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`COPYRIGHT.md`\n- **RESPONSE FORMAT:**（project_doc）：You are a precise browser automation agent that interacts with websites through structured commands. Your role is to: 1. Analyze the provided webpage elements and structure 2. Plan a sequence of actions to accomplish the given task 3. Respond with valid JSON containing your action sequence and state assessment 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-agent/src/notte_agent/falco/system.md`\n- **Some Menu or Group of elements**（project_doc）：You are a precise browser automation agent that interacts with websites through structured commands. Your role is to: 1. Analyze the provided webpage elements and structure 2. Plan a sequence of actions to accomplish the given task 3. Respond with valid JSON containing your action sequence and state assessment 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-agent/src/notte_agent/gufo/system.md`\n- **Rules for creating the table:**（project_doc）：You are an expert in analyzing web documents to create comprehensive documentation of user interactions based on previously identified actions. Your goal is to extend the list of actions to cover all possible user interactions, without duplicating any actions. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/action-listing-incr/user.md`\n- **Section Name**（project_doc）：You are an expert in web accessibility tasked with analyzing a web document and identifying all possible actions on its terminal nodes. Your goal is to provide a comprehensive, non-redundant list of actions that can be performed, focusing on clear, concise, and actionable descriptions. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/action-listing/anthropic/user.md`\n- **Rules for creating the table:**（project_doc）：You are an expert in analyzing web documents to create comprehensive documentation of user interactions. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/action-listing/optim/user.md`\n- **category-section-title**（project_doc）：Create a flat list of each actions you find in this webpage accessibility tree. For each action, describe it a short natural language description, keep it's identifier, and group them in different categories that make sense. The objective is that someone could read your list and immediately get what actions are possibly executable on that webpage. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/action-listing/simple/user.md`\n- **System**（project_doc）：You are an expert at selecting actions to take based on user instructions. Your role is to: 1. Analyze the provided webpage elements and structure. You will be given a list of interactive elements and their descriptions could be links, buttons, menus, input fields, etc. 2. Find elements that can be used to solve an action in the page based on a specific instruction i.e user intent targeted action . If there are mult… 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/action-selection/system.md`\n- **User**（project_doc）：Your turn, give me the most relevant actions to take 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/action-selection/user.md`\n- **Critical Rules:**（project_doc）：You are an expert web content analyzer tasked with extracting and organizing information from web documents. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/data-extraction/all_data/user.md`\n- **Critical Rules:**（project_doc）：You are an expert web content analyzer tasked with extracting and organizing information from web documents. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/data-extraction/only_main_content/user.md`\n- **Critical Format Rules:**（project_doc）：You are an expert in analyzing web documents to create comprehensive textual documentation of these documents. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/data-extraction/two_sections/user.md`\n- **Critical Format Rules:**（project_doc）：You are an expert in analyzing web documents to create comprehensive textual documentation of these documents. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/data-extraction/user.md`\n- **User**（project_doc）：You are an expert in the playwright python library. You are given a html code of an element that failed to be interacted with and some information about the action that was executed. along with the error message encountered. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/debug-failing-action-exec/user.md`\n- **User**（project_doc）：Based on a textual description of a webpage, I want to classifiy the page in one of the following categories: - “manage-cookies”: manage cookies page, i.e accept/reject cookies, usually in a modal / dialog that ask for user action - “auth”: sign-in, sign-up pages also valid if there is a modal that asks you to sign up to continue using the website - \"homepage\": the homepage of the website - \"search-results\": multipl… 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md`\n- **User**（project_doc）：You are an expert web content analyst tasked with classifying webpages into specific categories based on their content and functionality. Your goal is to accurately categorize each webpage using the information provided. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/document-category/optim/user.md`\n- **System**（project_doc）：You are extracting content on behalf of a user. If a user asks you to extract a 'list' of information, or 'all' information, YOU MUST EXTRACT ALL OF THE INFORMATION THAT THE USER REQUESTS. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/extract-json-schema/multi-entity/system.md`\n- **User**（project_doc）：Your turn, provide me the transformed content: 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/extract-json-schema/multi-entity/user.md`\n- **System**（project_doc）：You are extracting content on behalf of a user. If a user asks you to extract a 'list' of information, or 'all' information, YOU MUST EXTRACT ALL OF THE INFORMATION THAT THE USER REQUESTS. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/extract-without-json-schema/system.md`\n- **User**（project_doc）：Your turn, provide me the transformed content: 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/extract-without-json-schema/user.md`\n- **System**（project_doc）：You are a schema generator for a web scraping system. Generate a JSON schema based on the user's prompt. Consider: 1. The type of data being requested 2. Required fields vs optional fields 3. Appropriate data types for each field 4. Nested objects and arrays where appropriate 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/generate-json-schema/system.md`\n- **User**（project_doc）：Generate a JSON schema for extracting the following information: {{prompt}} 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`packages/notte-llm/src/notte_llm/prompts/generate-json-schema/user.md`\n- **Scraped Data**（project_doc）：Skip to main content skip-to-content 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`tests/pipe/scraping/scraped_data.md`\n\n## 证据索引\n\n- 共索引 76 条证据。\n\n- **Mintlify documentation**（documentation）：Working relationship - You can push back on ideas-this can lead to better documentation. Cite sources and explain your reasoning when you do so - ALWAYS ask for clarification rather than making assumptions - NEVER lie, guess, or make up anything 证据：`docs/src/.claude/CLAUDE.md`\n- **Mintlify Starter Kit**（documentation）：Click on Use this template to copy the Mintlify starter kit. The starter kit contains examples including 证据：`docs/src/README.md`\n- **How to Contribute**（documentation）：You can contribute to Notte by submitting a PR or by reporting an issue. 证据：`docs/CONTRIBUTING.md`\n- **Rapidly build reliable web automation agents**（documentation）：Rapidly build reliable web automation agents 证据：`README.md`\n- **Running benchmarks**（documentation）：Running benchmarks should be as easy as running this command: 证据：`benchmarks/README.md`\n- **How to run the examples**（documentation）：The setup is the same for all the examples. 证据：`examples/README.md`\n- **Auth Vault Agent**（documentation）：This example shows how to use the Auth Vault Agent to authenticate to a website, in this case, the GitHub website, securely using a secure Notte Vault to store and access the credentials. 证据：`examples/auth-vault-agent/README.md`\n- **Email Notifier Agent**（documentation）：This examples shows how you can recieve emails containing the agent's task output once the agent is done running. 证据：`examples/email-notifier-agent/README.md`\n- **Github Auto Issues Trending Repos**（documentation）：This example shows how you can use the Github API to automatically create issues for the latest trending repositories. 证据：`examples/github-auto-issues-trending-repos/README.md`\n- **Order on ubereats agent**（documentation）：This example shows an agent using a vault to log in on ubereats, and order a burger menu. 证据：`examples/order-on-ubereats/README.md`\n- **Scrape logo**（documentation）：Simple example on how to scrape the logo of a website 证据：`examples/scrape-logo/README.md`\n- **Scrape Nike products**（documentation）：This example shows how you can scrape a website using Notte. 证据：`examples/scrape-nike-products/README.md`\n- **Star our repo agent**（documentation）：This example shows a simple agent using an auth vault to load github credentials including 2fa code , sign in, and star our github repo. 证据：`examples/star-our-repo/README.md`\n- **How to build an LLM agent with Notte**（documentation）：How to build an LLM agent with Notte 证据：`packages/notte-agent/src/notte_agent/README.md`\n- **Notte Browser**（documentation）：The browser component of the Notte agentic ecosystem, designed to provide a seamless interface between LLM agents and web browsing capabilities. This package serves as the foundational layer that enables AI agents to interact with web content in a structured and efficient manner. 证据：`packages/notte-browser/README.md`\n- **Basic example code**（documentation）：python from notte agent.main import Agent from notte integrations.credentials.hashicorp.vault import HashiCorpVault import os from dotenv import load dotenv 证据：`packages/notte-integrations/src/notte_integrations/credentials/README.md`\n- **notte-llm**（documentation）：LLM integration for Notte, providing LiteLLM-based services for language model interactions. 证据：`packages/notte-llm/README.md`\n- **Notte MCP Server**（documentation）：⚡️ we outperform other web agents in speed, costs and reliability 👉🏼 read more on open-operator-evals 证据：`packages/notte-mcp/README.md`\n- **Notte SDK**（documentation）：The Notte SDK is a powerful Python library that provides a seamless interface for interacting with web automation and AI-powered agents. It enables developers to create, manage, and monitor web automation sessions and AI agents with ease. 证据：`packages/notte-sdk/README.md`\n- **License**（source_file）：Server Side Public License VERSION 1, OCTOBER 16, 2018 证据：`LICENSE`\n- **How to change the local notte config**（documentation）：How to change the local notte config 证据：`docs/change_local_config.md`\n- **How to run Notte with external browsers ?**（documentation）：How to run Notte with external browsers ? 证据：`docs/run_notte_with_external_browsers.md`\n- **How to use local LLMs Ollama to power Notte**（documentation）：How to use local LLMs Ollama to power Notte 证据：`docs/run_ollama_local_models.md`\n- **Web Scraping with Notte**（documentation）：Notte provides powerful tools for web scraping that can extract both raw content and structured data from web pages. This tutorial will guide you through the different ways you can use Notte for web scraping. 证据：`docs/scraping_tutorial.md`\n- **Notte SDK Tutorial**（documentation）：python from notte sdk.client import NotteClient import os notte = NotteClient api key=os.getenv \"NOTTE API KEY\" 证据：`docs/sdk_tutorial.md`\n- **Local Setup of Notte**（documentation）：To install notte locally, run the following commands: 证据：`docs/setup.md`\n- **sniptest**（documentation）：Tool for generating tested code snippets for Mintlify docs. 证据：`docs/src/.claude/rules/code-snippets.md`\n- **Icon Mapping**（documentation）：Use consistent icons across all documentation. This mapping ensures visual consistency. 证据：`docs/src/.claude/rules/icons.md`\n- **Naming Conventions**（documentation）：When instantiating the NotteClient , always name the variable client , not notte . 证据：`docs/src/.claude/rules/naming-conventions.md`\n- **Mintlify technical writing rule**（documentation）：You are an AI writing assistant specialized in creating exceptional technical documentation using Mintlify components and following industry-leading technical writing practices. 证据：`docs/src/.cursor/rules/mintlify-technical-writing/RULE.md`\n- **Copyright**（documentation）：This software is licensed under the Server Side Public License v1. See LICENSE file for full license text. 证据：`COPYRIGHT.md`\n- **RESPONSE FORMAT:**（documentation）：You are a precise browser automation agent that interacts with websites through structured commands. Your role is to: 1. Analyze the provided webpage elements and structure 2. Plan a sequence of actions to accomplish the given task 3. Respond with valid JSON containing your action sequence and state assessment 证据：`packages/notte-agent/src/notte_agent/falco/system.md`\n- **Some Menu or Group of elements**（documentation）：You are a precise browser automation agent that interacts with websites through structured commands. Your role is to: 1. Analyze the provided webpage elements and structure 2. Plan a sequence of actions to accomplish the given task 3. Respond with valid JSON containing your action sequence and state assessment 证据：`packages/notte-agent/src/notte_agent/gufo/system.md`\n- **Rules for creating the table:**（documentation）：You are an expert in analyzing web documents to create comprehensive documentation of user interactions based on previously identified actions. Your goal is to extend the list of actions to cover all possible user interactions, without duplicating any actions. 证据：`packages/notte-llm/src/notte_llm/prompts/action-listing-incr/user.md`\n- **Section Name**（documentation）：You are an expert in web accessibility tasked with analyzing a web document and identifying all possible actions on its terminal nodes. Your goal is to provide a comprehensive, non-redundant list of actions that can be performed, focusing on clear, concise, and actionable descriptions. 证据：`packages/notte-llm/src/notte_llm/prompts/action-listing/anthropic/user.md`\n- **Rules for creating the table:**（documentation）：You are an expert in analyzing web documents to create comprehensive documentation of user interactions. 证据：`packages/notte-llm/src/notte_llm/prompts/action-listing/optim/user.md`\n- **category-section-title**（documentation）：Create a flat list of each actions you find in this webpage accessibility tree. For each action, describe it a short natural language description, keep it's identifier, and group them in different categories that make sense. The objective is that someone could read your list and immediately get what actions are possibly executable on that webpage. 证据：`packages/notte-llm/src/notte_llm/prompts/action-listing/simple/user.md`\n- **System**（documentation）：You are an expert at selecting actions to take based on user instructions. Your role is to: 1. Analyze the provided webpage elements and structure. You will be given a list of interactive elements and their descriptions could be links, buttons, menus, input fields, etc. 2. Find elements that can be used to solve an action in the page based on a specific instruction i.e user intent targeted action . If there are multiple elements that may be match the description for future actions, return all of them ranked by relevance. 3. You should not return more than 3 actions. And as a matter of fact, there is usually only one action that stands out as the most relevant. 4. If no actions match the ins… 证据：`packages/notte-llm/src/notte_llm/prompts/action-selection/system.md`\n- **User**（documentation）：Your turn, give me the most relevant actions to take 证据：`packages/notte-llm/src/notte_llm/prompts/action-selection/user.md`\n- **Critical Rules:**（documentation）：You are an expert web content analyzer tasked with extracting and organizing information from web documents. 证据：`packages/notte-llm/src/notte_llm/prompts/data-extraction/all_data/user.md`\n- **Critical Rules:**（documentation）：You are an expert web content analyzer tasked with extracting and organizing information from web documents. 证据：`packages/notte-llm/src/notte_llm/prompts/data-extraction/only_main_content/user.md`\n- **Critical Format Rules:**（documentation）：You are an expert in analyzing web documents to create comprehensive textual documentation of these documents. 证据：`packages/notte-llm/src/notte_llm/prompts/data-extraction/two_sections/user.md`\n- **Critical Format Rules:**（documentation）：You are an expert in analyzing web documents to create comprehensive textual documentation of these documents. 证据：`packages/notte-llm/src/notte_llm/prompts/data-extraction/user.md`\n- **User**（documentation）：You are an expert in the playwright python library. You are given a html code of an element that failed to be interacted with and some information about the action that was executed. along with the error message encountered. 证据：`packages/notte-llm/src/notte_llm/prompts/debug-failing-action-exec/user.md`\n- **User**（documentation）：Based on a textual description of a webpage, I want to classifiy the page in one of the following categories: - “manage-cookies”: manage cookies page, i.e accept/reject cookies, usually in a modal / dialog that ask for user action - “auth”: sign-in, sign-up pages also valid if there is a modal that asks you to sign up to continue using the website - \"homepage\": the homepage of the website - \"search-results\": multiple item displayed which are a results of a previous search query - “data-feed”: data display in a grid/sequence such as blog posts, news articles, social media feeds instagram, linked-in, etc. - \"item\": information page about one particular item, usually displayed after clicking o… 证据：`packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md`\n- **User**（documentation）：You are an expert web content analyst tasked with classifying webpages into specific categories based on their content and functionality. Your goal is to accurately categorize each webpage using the information provided. 证据：`packages/notte-llm/src/notte_llm/prompts/document-category/optim/user.md`\n- **System**（documentation）：You are extracting content on behalf of a user. If a user asks you to extract a 'list' of information, or 'all' information, YOU MUST EXTRACT ALL OF THE INFORMATION THAT THE USER REQUESTS. 证据：`packages/notte-llm/src/notte_llm/prompts/extract-json-schema/multi-entity/system.md`\n- **User**（documentation）：Your turn, provide me the transformed content: 证据：`packages/notte-llm/src/notte_llm/prompts/extract-json-schema/multi-entity/user.md`\n- **System**（documentation）：You are extracting content on behalf of a user. If a user asks you to extract a 'list' of information, or 'all' information, YOU MUST EXTRACT ALL OF THE INFORMATION THAT THE USER REQUESTS. 证据：`packages/notte-llm/src/notte_llm/prompts/extract-without-json-schema/system.md`\n- **User**（documentation）：Your turn, provide me the transformed content: 证据：`packages/notte-llm/src/notte_llm/prompts/extract-without-json-schema/user.md`\n- **System**（documentation）：You are a schema generator for a web scraping system. Generate a JSON schema based on the user's prompt. Consider: 1. The type of data being requested 2. Required fields vs optional fields 3. Appropriate data types for each field 4. Nested objects and arrays where appropriate 证据：`packages/notte-llm/src/notte_llm/prompts/generate-json-schema/system.md`\n- **User**（documentation）：Generate a JSON schema for extracting the following information: {{prompt}} 证据：`packages/notte-llm/src/notte_llm/prompts/generate-json-schema/user.md`\n- **Scraped Data**（documentation）：Skip to main content skip-to-content 证据：`tests/pipe/scraping/scraped_data.md`\n- **Settings**（structured_config）：{ \"permissions\": { \"allow\": \"mcp mintlify-docs SearchMintlify\" } } 证据：`docs/src/.claude/settings.json`\n- **.Mcp**（structured_config）：{ \"mcpServers\": { \"mintlify-docs\": { \"type\": \"http\", \"url\": \"https://www.mintlify.com/docs/mcp\" }, \"notte-docs\": { \"type\": \"http\", \"url\": \"https://docs.notte.cc/mcp\" } } } 证据：`docs/src/.mcp.json`\n- **Cookies**（structured_config）：{\"name\": \"SOCS\", \"value\": \"CAAaBgiAhKXIBg\", \"domain\": \".google.com\", \"path\": \"/\", \"httpOnly\": false, \"expirationDate\": 1796403996.238032, \"hostOnly\": null, \"sameSite\": \"Lax\", \"secure\": true, \"session\": null, \"storeId\": null, \"expires\": 1796403996.238032}, {\"name\": \" Secure-ENID\", \"value\": \"29.SE=muJmYMaBQSMdpk J1-S8wHCTFlU0DtxLHCB-OBGZKWToGAIHvO9Ak6FHD7nPbc0EE-XCySa7Rg1--fTAufMZRJ2cnjH7rKWeq4bV1mJCVu2JtGTqmTdLgKF1Jphrc bYA20IIbuv32Ji7jZGC7 fxyAf4bB8o2on4PNUUckqX6xtGC2EGHKQomtY99joJkRIy32aTqij\", \"domain\": \".google.com\", \"path\": \"/\", \"httpOnly\": true, \"expirationDate\": 1796462694.370169, \"hostOnly\": null, \"sameSite\": \"Lax\", \"secure\": true, \"session\": null, \"storeId\": null, \"expires\": 17964626… 证据：`docs/src/cookies.json`\n- **Docs**（structured_config）：{ \"$schema\": \"https://mintlify.com/docs.json\", \"theme\": \"palm\", \"name\": \"Notte\", \"colors\": { \"primary\": \" 00b85c\", \"light\": \" 00e673\", \"dark\": \" 00e673\" }, \"logo\": { \"dark\": \"/logo/logo-dark.png\", \"light\": \"/logo/logo-white.png\" }, \"favicon\": \"/favicon.ico\", \"banner\": { \"content\": \"Get started: use the Notte CLI skill https://github.com/nottelabs/notte-skills/ to generate your first SDK script Setup guide /quickstart \", \"dismissible\": false }, \"seo.indexing\": \"all\", \"navigation\": { \"languages\": { \"language\": \"en\", \"tabs\": { \"tab\": \"Documentation\", \"groups\": { \"group\": \"Getting Started\", \"pages\": \"index\", \"quickstart\", \"concepts\" }, { \"group\": \"Sessions\", \"icon\": \"tv\", \"pages\": \"concepts/ses… 证据：`docs/src/docs.json`\n- **Claude Desktop Config.Example**（structured_config）：{ \"notte-mcp\": { \"command\": \"npx\", \"args\": \"mcp-remote\", \"http://localhost:8001/sse\" , \"env\": { \"NOTTE API KEY\": \" \" } } } 证据：`packages/notte-mcp/claude_desktop_config.example.json`\n- **Reference Fail Completion Messages**（structured_config）：{ \"role\": \"system\", \"content\": \"You are a precise browser automation agent that interacts with websites through structured commands.\\nYour role is to:\\n1. Analyze the provided webpage elements and structure\\n2. Plan a sequence of actions to accomplish the given task\\n3. Respond with valid JSON containing your action sequence and state assessment\\n\\n\\nINPUT STRUCTURE:\\n1. Current URL: The webpage you're currently on\\n2. Available Tabs: List of open browser tabs\\n3. Interactive Elements: List in the format:\\n id : element text \\n - id : identifier for interaction. ids can be decomposed into : where is the index of the element in the list of elements with the same role and are:\\n - I for input… 证据：`tests/agent/reference_fail_completion_messages.json`\n- **Reference Messages**（structured_config）：{ \"role\": \"system\", \"content\": \"You are a precise browser automation agent that interacts with websites through structured commands.\\nYour role is to:\\n1. Analyze the provided webpage elements and structure\\n2. Plan a sequence of actions to accomplish the given task\\n3. Respond with valid JSON containing your action sequence and state assessment\\n\\n\\nINPUT STRUCTURE:\\n1. Current URL: The webpage you're currently on\\n2. Available Tabs: List of open browser tabs\\n3. Interactive Elements: List in the format:\\n id : element text \\n - id : identifier for interaction. ids can be decomposed into : where is the index of the element in the list of elements with the same role and are:\\n - I for input… 证据：`tests/agent/reference_messages.json`\n- 其余 16 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。\n\n## 宿主 AI 必须遵守的规则\n\n- **把本资产当作开工前上下文，而不是运行环境。**：AI Context Pack 只包含证据化项目理解，不包含目标项目的可执行状态。 证据：`docs/src/.claude/CLAUDE.md`, `docs/src/README.md`, `docs/CONTRIBUTING.md`\n- **回答用户时区分可预览内容与必须安装后才能验证的内容。**：安装前体验的消费者价值来自降低误装和误判，而不是伪装成真实运行。 证据：`docs/src/.claude/CLAUDE.md`, `docs/src/README.md`, `docs/CONTRIBUTING.md`\n\n## 用户开工前应该回答的问题\n\n- 你准备在哪个宿主 AI 或本地环境中使用它？\n- 你只是想先体验工作流，还是准备真实安装？\n- 你最在意的是安装成本、输出质量、还是和现有规则的冲突？\n\n## 验收标准\n\n- 所有能力声明都能回指到 evidence_refs 中的文件路径。\n- AI_CONTEXT_PACK.md 没有把预览包装成真实运行。\n- 用户能在 3 分钟内看懂适合谁、能做什么、如何开始和风险边界。\n\n---\n\n## Doramagic Context Augmentation\n\n下面内容用于强化 Repomix/AI Context Pack 主体。Human Manual 只提供阅读骨架；踩坑日志会被转成宿主 AI 必须遵守的工作约束。\n\n## Human Manual 骨架\n\n使用规则：这里只是项目阅读路线和显著性信号，不是事实权威。具体事实仍必须回到 repo evidence / Claim Graph。\n\n宿主 AI 硬性规则：\n- 不得把页标题、章节顺序、摘要或 importance 当作项目事实证据。\n- 解释 Human Manual 骨架时，必须明确说它只是阅读路线/显著性信号。\n- 能力、安装、兼容性、运行状态和风险判断必须引用 repo evidence、source path 或 Claim Graph。\n\n- **项目介绍**：importance `high`\n  - source_paths: README.md, pyproject.toml\n- **快速入门指南**：importance `high`\n  - source_paths: docs/setup.md, docs/sdk_tutorial.md, .env.example\n- **包结构分析**：importance `high`\n  - source_paths: packages/notte-core/pyproject.toml, packages/notte-browser/pyproject.toml, packages/notte-agent/pyproject.toml, packages/notte-sdk/pyproject.toml, packages/notte-llm/pyproject.toml\n- **核心模块实现**：importance `high`\n  - source_paths: packages/notte-core/src/notte_core/actions/actions.py, packages/notte-core/src/notte_core/browser/observation.py, packages/notte-core/src/notte_core/browser/snapshot.py, packages/notte-core/src/notte_core/browser/dom_tree.py, packages/notte-core/src/notte_core/credentials/base.py\n- **Agent实现与生命周期**：importance `high`\n  - source_paths: packages/notte-agent/src/notte_agent/agent.py, packages/notte-agent/src/notte_agent/agent_fallback.py, packages/notte-agent/src/notte_agent/workflow.py, packages/notte-agent/src/notte_agent/common/conversation.py, packages/notte-agent/src/notte_agent/falco/agent.py\n- **结构化输出**：importance `high`\n  - source_paths: packages/notte-core/src/notte_core/browser/perception.py, packages/notte-browser/src/notte_browser/scraping/schema.py, packages/notte-llm/src/notte_llm/prompts/extract-json-schema, examples/scrape-nike-products/agent.py\n- **会话管理系统**：importance `high`\n  - source_paths: packages/notte-browser/src/notte_browser/session.py, packages/notte-browser/src/notte_browser/controller.py, packages/notte-browser/src/notte_browser/playwright.py, packages/notte-integrations/src/notte_integrations/sessions/cdp_session.py\n- **动作执行系统**：importance `high`\n  - source_paths: packages/notte-core/src/notte_core/actions/actions.py, packages/notte-core/src/notte_core/actions/typedicts.py, packages/notte-browser/src/notte_browser/action_selection/pipe.py, packages/notte-browser/src/notte_browser/dom/locate.py, packages/notte-browser/src/notte_browser/form_filling.py\n\n## Repo Inspection Evidence / 源码检查证据\n\n- repo_clone_verified: true\n- repo_inspection_verified: true\n- repo_commit: `eddc2c0cd9306d6bb7695352300aa42f5ea69760`\n- inspected_files: `pyproject.toml`, `README.md`, `uv.lock`, `docs/sdk_tutorial.md`, `docs/change_local_config.md`, `docs/scraping_tutorial.md`, `docs/CONTRIBUTING.md`, `docs/run_ollama_local_models.md`, `docs/setup.md`, `docs/run_notte_with_external_browsers.md`, `docs/src/trust-center.mdx`, `docs/src/rate-limits.mdx`, `docs/src/concepts.mdx`, `docs/src/cookies.json`, `docs/src/cli.mdx`, `docs/src/.mcp.json`, `docs/src/zin.mdx`, `docs/src/pricing.mdx`, `docs/src/index.mdx`, `docs/src/README.md`\n\n宿主 AI 硬性规则：\n- 没有 repo_clone_verified=true 时，不得声称已经读过源码。\n- 没有 repo_inspection_verified=true 时，不得把 README/docs/package 文件判断写成事实。\n- 没有 quick_start_verified=true 时，不得声称 Quick Start 已跑通。\n\n## Doramagic Pitfall Constraints / 踩坑约束\n\n这些规则来自 Doramagic 发现、验证或编译过程中的项目专属坑点。宿主 AI 必须把它们当作工作约束，而不是普通说明文字。\n\n### Constraint 1: 来源证据：v1.8.8\n\n- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：v1.8.8\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_5224b46e2312471c976888e8a2f8f4a6 | https://github.com/nottelabs/notte/releases/tag/v1.8.8 | 来源类型 github_release 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 2: 来源证据：v1.8.13\n\n- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.13\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_56505da48cd74758ab7a9a1d82092e18 | https://github.com/nottelabs/notte/releases/tag/v1.8.13 | 来源类型 github_release 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 3: 来源证据：v1.8.14\n\n- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.14\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_8f78a2591cea4f5aad8bfa0cb0ea15a0 | https://github.com/nottelabs/notte/releases/tag/v1.8.14 | 来源类型 github_release 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 4: 来源证据：v1.8.15\n\n- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.15\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_f611f1d0dd2440af8e84e9544ab1bdb6 | https://github.com/nottelabs/notte/releases/tag/v1.8.15 | 来源类型 github_release 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 5: 来源证据：v1.8.6\n\n- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.6\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_0ed3c86ff7a34e5896a4daeb75552d4d | https://github.com/nottelabs/notte/releases/tag/v1.8.6 | 来源类型 github_release 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 6: 来源证据：v1.8.9\n\n- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.9\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_6195971390e8494f88083c862aef7eb6 | https://github.com/nottelabs/notte/releases/tag/v1.8.9 | 来源类型 github_release 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 7: 能力判断依赖假设\n\n- Trigger: README/documentation is current enough for a first validation pass.\n- Host AI rule: 将假设转成下游验证清单。\n- Why it matters: 假设不成立时，用户拿不到承诺的能力。\n- Evidence: capability.assumptions | github_repo:900152988 | https://github.com/nottelabs/notte | README/documentation is current enough for a first validation pass.\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 8: 来源证据：v1.8.7\n\n- Trigger: GitHub 社区证据显示该项目存在一个运行相关的待验证问题：v1.8.7\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_ab102ac99c2441118475601c34ab0ee9 | https://github.com/nottelabs/notte/releases/tag/v1.8.7 | 来源类型 github_release 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 9: 维护活跃度未知\n\n- Trigger: 未记录 last_activity_observed。\n- Host AI rule: 补 GitHub 最近 commit、release、issue/PR 响应信号。\n- Why it matters: 新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。\n- Evidence: evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | last_activity_observed missing\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 10: 下游验证发现风险项\n\n- Trigger: no_demo\n- Host AI rule: 进入安全/权限治理复核队列。\n- Why it matters: 下游已经要求复核，不能在页面中弱化。\n- Evidence: downstream_validation.risk_items | github_repo:900152988 | https://github.com/nottelabs/notte | no_demo; severity=medium\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n",
      "summary": "给宿主 AI 的上下文和工作边界。",
      "title": "AI Context Pack / 带给我的 AI"
    },
    "boundary_risk_card": {
      "asset_id": "boundary_risk_card",
      "filename": "BOUNDARY_RISK_CARD.md",
      "markdown": "# Boundary & Risk Card / 安装前决策卡\n\n项目：nottelabs/notte\n\n## Doramagic 试用结论\n\n当前结论：可以进入发布前推荐检查；首次使用仍应从最小权限、临时目录和可回滚配置开始。\n\n## 用户现在可以做\n\n- 可以先阅读 Human Manual，理解项目目的和主要工作流。\n- 可以复制 Prompt Preview 做安装前体验；这只验证交互感，不代表真实运行。\n- 可以把官方 Quick Start 命令放到隔离环境中验证，不要直接进主力环境。\n\n## 现在不要做\n\n- 不要把 Prompt Preview 当成项目实际运行结果。\n- 不要把 metadata-only validation 当成沙箱安装验证。\n- 不要把未验证能力写成“已支持、已跑通、可放心安装”。\n- 不要在首次试用时交出生产数据、私人文件、真实密钥或主力配置目录。\n\n## 安装前检查\n\n- 宿主 AI 是否匹配：chatgpt\n- 官方安装入口状态：已发现官方入口\n- 是否在临时目录、临时宿主或容器中验证：必须是\n- 是否能回滚配置改动：必须能\n- 是否需要 API Key、网络访问、读写文件或修改宿主配置：未确认前按高风险处理\n- 是否记录了安装命令、实际输出和失败日志：必须记录\n\n## 当前阻塞项\n\n- 无阻塞项。\n\n## 项目专属踩坑\n\n- 来源证据：v1.8.8（medium）：可能增加新用户试用和生产接入成本。 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 来源证据：v1.8.13（medium）：可能增加新用户试用和生产接入成本。 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 来源证据：v1.8.14（medium）：可能增加新用户试用和生产接入成本。 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 来源证据：v1.8.15（medium）：可能增加新用户试用和生产接入成本。 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 来源证据：v1.8.6（medium）：可能增加新用户试用和生产接入成本。 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n\n## 风险与权限提示\n\n- no_demo: medium\n\n## 证据缺口\n\n- 暂未发现结构化证据缺口。\n",
      "summary": "安装、权限、验证和推荐前风险。",
      "title": "Boundary & Risk Card / 边界与风险卡"
    },
    "human_manual": {
      "asset_id": "human_manual",
      "filename": "HUMAN_MANUAL.md",
      "markdown": "# https://github.com/nottelabs/notte 项目说明书\n\n生成时间：2026-05-14 04:53:36 UTC\n\n## 目录\n\n- [项目介绍](#project-introduction)\n- [快速入门指南](#quickstart-guide)\n- [包结构分析](#package-structure)\n- [核心模块实现](#core-modules)\n- [Agent实现与生命周期](#agent-implementation)\n- [结构化输出](#structured-output)\n- [会话管理系统](#session-management)\n- [动作执行系统](#action-system)\n- [凭证保险库](#vault-credentials)\n- [文件存储系统](#file-storage)\n\n<a id='project-introduction'></a>\n\n## 项目介绍\n\n### 相关页面\n\n相关主题：[快速入门指南](#quickstart-guide), [包结构分析](#package-structure)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [README.md](https://github.com/nottelabs/notte/blob/main/README.md)\n- [packages/notte-core/src/notte_core/actions/actions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/actions/actions.py)\n- [packages/notte-core/src/notte_core/errors/processing.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/errors/processing.py)\n- [packages/notte-sdk/src/notte_sdk/endpoints/sessions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-sdk/src/notte_sdk/endpoints/sessions.py)\n- [packages/notte-agent/src/notte_agent/gufo/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/gufo/system.md)\n</details>\n\n# 项目介绍\n\n## 项目概述\n\nNotte 是一款面向互联网原生代理系统（Internet-native Agentic Systems）的软件套件，旨在为大型语言模型（LLM）代理提供强大的浏览器自动化和网页交互能力。Notte 将互联网转化为一个结构化、可导航的空间，使每个网站都成为智能代理可以精确解读和操作的地图。\n\n资料来源：[README.md:1]()\n\n## 核心定位\n\nNotte 的核心价值主张在于创建一个可编程的抽象层，覆盖在真实网页之上。通过该技术栈，AI 代理能够：\n\n- 精确解读网页内容结构\n- 执行复杂的浏览器交互操作\n- 实现端到端的自动化工作流\n\n资料来源：[README.md:1]()\n\n## 技术架构\n\n### 包结构\n\nNotte 采用多包架构设计，包含以下核心组件：\n\n| 包名 | 描述 |\n|------|------|\n| `notte-core` | 核心功能模块，包含动作定义、错误处理等基础组件 |\n| `notte-llm` | LLM 集成模块，提供提示词模板和文档分析能力 |\n| `notte-sdk` | Python SDK 模块，提供会话管理和 API 交互接口 |\n| `notte-agent` | 代理执行模块，处理代理决策和浏览器控制逻辑 |\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py:1]()\n资料来源：[packages/notte-core/src/notte_core/errors/processing.py:1]()\n\n### 架构分层图\n\n```mermaid\ngraph TD\n    A[用户/外部系统] --> B[notte-sdk]\n    B --> C[notte-agent]\n    C --> D[notte-llm]\n    D --> E[notte-core]\n    E --> F[浏览器/Playwright]\n    F --> G[网页 DOM]\n```\n\n## 核心功能模块\n\n### 浏览器动作系统\n\nNotte 定义了一套完整的浏览器动作类型，支持多种交互场景：\n\n| 动作类型 | 功能描述 |\n|----------|----------|\n| `goto` | 导航至指定 URL |\n| `goto_new_tab` | 在新标签页中打开 URL |\n| `close_tab` | 关闭当前标签页 |\n\n```python\n# 示例：导航动作\nclass GotoAction(BrowserAction):\n    type: Literal[\"goto\"] = \"goto\"\n    url: str\n    description: str = \"Goto to a URL\"\n```\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py:1-20]()\n\n### 会话管理\n\nNotte SDK 提供了灵活的会话管理能力，支持快速感知和深度感知两种模式：\n\n```python\n# 快速感知模式（默认）\nobs = session.observe(perception_type='fast')\n\n# 深度感知模式（使用 LLM）\nobs = session.observe(perception_type='deep')\n\n# 带指令的感知（自然语言过滤）\nactions = session.observe(instructions=\"Fill the email input\")\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:1-30]()\n\n### 文档分类与提取\n\nNotte LLM 模块提供了文档分析能力，支持对网页内容进行结构化处理：\n\n| 文档类别 | 说明 |\n|----------|------|\n| `search-results` | 搜索结果页面 |\n| `item` | 详情/物品页面 |\n| `other` | 其他类型页面 |\n\n资料来源：[packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md:1]()\n\n### 代理决策系统\n\nNotte Agent 模块实现了基于 LLM 的代理决策引擎，支持：\n\n- **元素识别**：通过 ID 系统标识可交互元素（`I`=输入、`B`=按钮、`L`=链接、`F`=图形、`O`=选项、`M`=杂项）\n- **动作序列**：支持表单填写、导航提取等常见操作序列\n- **验证码处理**：内置 CAPTCHA 检测和解决机制\n\n```mermaid\ngraph LR\n    A[网页状态] --> B[元素识别]\n    B --> C[动作规划]\n    C --> D[执行验证]\n    D -->|成功| E[下一状态]\n    D -->|失败| F[错误处理]\n```\n\n资料来源：[packages/notte-agent/src/notte_agent/gufo/system.md:1-40]()\n\n## 错误处理机制\n\nNotte 建立了完善的错误处理体系，涵盖内部检查和运行时异常：\n\n| 错误类型 | 触发条件 |\n|----------|----------|\n| `InvalidA11yTreeType` | 无效的辅助功能树类型 |\n| `InvalidA11yChildrenError` | 子元素数量不满足假设条件 |\n| `InvalidPlaceholderError` | 占位符未被 vault 处理 |\n| `ScrapeFailedError` | 结构化数据提取失败 |\n\n资料来源：[packages/notte-core/src/notte_core/errors/processing.py:1-40]()\n\n## 使用方式\n\n### 安装\n\nNotte 通过 Python 包管理器分发，可通过标准方式安装。\n\n### 基本工作流\n\n```mermaid\ngraph TD\n    A[创建会话] --> B[执行动作]\n    B --> C[观察状态]\n    C --> D{任务完成?}\n    D -->|否| B\n    D -->|是| E[返回结果]\n```\n\n```python\n# 完整示例\nobs = session.observe(perception_type='deep')\nprint(obs.space.description)\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:20-25]()\n\n## 项目信息\n\n| 属性 | 值 |\n|------|------|\n| 版本 | 1.4.4 |\n| 许可证 | SSPL-1.0 |\n| 版权 | © 2025 Notte Labs, Inc. |\n| 作者 | Pinto, Andrea, Giordano, Lucas, nottelabs-team |\n\n资料来源：[README.md:1-15]()\n\n## 引用格式\n\n如需在学术场合引用 Notte，请使用以下 BibTeX 格式：\n\n```bibtex\n@software{notte2025,\n  author = {Pinto, Andrea and Giordano, Lucas and {nottelabs-team}},\n  title = {Notte: Software suite for internet-native agentic systems},\n  url = {https://github.com/nottelabs/notte},\n  year = {2025},\n  publisher = {GitHub},\n  license = {SSPL-1.0},\n  version = {1.4.4},\n}\n```\n\n资料来源：[README.md:5-14]()\n\n---\n\n<a id='quickstart-guide'></a>\n\n## 快速入门指南\n\n### 相关页面\n\n相关主题：[项目介绍](#project-introduction)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [docs/setup.md](https://github.com/nottelabs/notte/blob/main/docs/setup.md)\n- [docs/sdk_tutorial.md](https://github.com/nottelabs/notte/blob/main/docs/sdk_tutorial.md)\n- [.env.example](https://github.com/nottelabs/notte/blob/main/.env.example)\n</details>\n\n# 快速入门指南\n\nNotte 是一个面向互联网原生代理系统的软件套件，旨在为 LLM 智能体提供可靠的网页浏览和交互能力。本指南将帮助您快速上手 Notte SDK，从环境配置到实现第一个网页交互任务。\n\n## 环境要求\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n| 组件 | 最低版本 | 说明 |\n|------|----------|------|\n| Python | 3.10+ | 推荐使用 Python 3.10 或更高版本 |\n| pip | 21.0+ | Python 包管理器 |\n| API 密钥 | Notte 账户 | 从 [notte.cc](https://notte.cc) 获取 |\n\n## 环境配置\n\n### 获取 API 密钥\n\n1. 访问 [notte.cc](https://notte.cc) 并注册账户\n2. 在仪表板中生成您的 API 密钥\n3. 将密钥安全存储，避免泄露\n\n### 配置环境变量\n\n创建 `.env` 文件，参考 `.env.example` 中的配置模板：\n\n```bash\n# Notte API 配置\nNOTTE_API_KEY=your_api_key_here\nNOTTE_API_BASE_URL=https://api.notte.cc  # 可选，默认为官方 API 地址\n```\n\n环境变量说明：\n\n| 变量名 | 必填 | 默认值 | 说明 |\n|--------|------|--------|------|\n| `NOTTE_API_KEY` | 是 | - | 您的 Notte API 密钥 |\n| `NOTTE_API_BASE_URL` | 否 | `https://api.notte.cc` | API 基础 URL |\n\n资料来源：[.env.example](https://github.com/nottelabs/notte/blob/main/.env.example)\n\n## 安装 SDK\n\n### 使用 pip 安装\n\n```bash\npip install notte-sdk\n```\n\n### 从源码安装\n\n```bash\ngit clone https://github.com/nottelabs/notte.git\ncd notte\npip install -e .\n```\n\n## 核心概念\n\n在深入实践之前，理解以下核心概念有助于更好地使用 Notte SDK：\n\n```mermaid\ngraph TD\n    A[Notte Session] --> B[观察页面]\n    A --> C[执行动作]\n    A --> D[抓取数据]\n    B --> E[获取交互元素]\n    C --> F[点击/输入/提交]\n    D --> G[结构化输出]\n    \n    style A fill:#e1f5fe\n    style B fill:#fff3e0\n    style C fill:#fff3e0\n    style D fill:#e8f5e9\n```\n\n| 概念 | 说明 |\n|------|------|\n| Session | 会话对象，管理与浏览器的连接状态 |\n| Observe | 观察操作，获取当前页面的交互元素 |\n| Execute | 执行操作，如点击、输入、表单填写等 |\n| Scrape | 抓取操作，从页面提取结构化数据 |\n\n资料来源：[docs/sdk_tutorial.md](https://github.com/nottelabs/notte/blob/main/docs/sdk_tutorial.md)\n\n## 基本使用流程\n\n### 1. 初始化客户端\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\n```\n\n### 2. 创建会话\n\n```python\nsession = client.sessions.create()\nprint(f\"会话ID: {session.id}\")\n```\n\n### 3. 导航到目标页面\n\n```python\nsession.execute(type=\"goto\", url=\"https://notte.cc\")\n```\n\n### 4. 观察页面元素\n\n```python\n# 快速感知模式\nobs = session.observe(perception_type=\"fast\")\n\n# 深度感知模式（使用 LLM 格式化）\nobs = session.observe(perception_type=\"deep\")\n```\n\n### 5. 执行动作\n\n```python\n# 点击元素\nsession.execute(type=\"click\", id=\"B1\")\n\n# 输入文本\nsession.execute(type=\"fill\", id=\"I1\", value=\"search term\")\n\n# 提交表单\nsession.execute(type=\"submit\", id=\"B2\")\n```\n\n资料来源：[docs/sdk_tutorial.md](https://github.com/nottelabs/notte/blob/main/docs/sdk_tutorial.md)\n\n## 常见任务示例\n\n### 网页抓取\n\nNotte 提供强大的网页抓取功能，支持结构化数据提取：\n\n```python\nfrom notte_sdk import NotteClient, NotteScrapeResponse\n\nclient = NotteClient()\n\n# 基础抓取\nresponse = client.scrape(\n    url=\"https://notte.cc\",\n    scrape_links=True,\n    only_main_content=True\n)\n\n# 带自定义指令的结构化抓取\nfrom pydantic import BaseModel\n\nclass Article(BaseModel):\n    title: str\n    content: str\n    date: str\n\nresponse = client.scrape(\n    url=\"https://example.com/blog\",\n    response_format=Article,\n    instructions=\"Extract only the title, date and content of the articles\"\n)\n```\n\n抓取参数说明：\n\n| 参数 | 类型 | 必填 | 说明 |\n|------|------|------|------|\n| `url` | string | 是 | 要抓取的网页 URL |\n| `scrape_links` | boolean | 否 | 是否抓取页面链接 |\n| `only_main_content` | boolean | 否 | 是否仅提取主要内容 |\n| `response_format` | BaseModel | 否 | Pydantic 模型用于结构化输出 |\n| `instructions` | string | 否 | 提取数据的自定义指令 |\n\n### 动作观察与过滤\n\n使用自然语言指令快速定位交互元素：\n\n```python\nsession.execute(type=\"goto\", url=\"https://console.notte.cc\")\n\n# 使用自然语言过滤动作空间\nactions = session.observe(instructions=\"Fill the email input\")\nprint(actions[0].model_dump())\n```\n\n### 使用 cURL 直接调用 API\n\n如果您偏好使用 HTTP 直接调用：\n\n```bash\ncurl -X POST 'https://api.notte.cc/scrape' \\\n  -H 'Authorization: Bearer <NOTTE-API-KEY>' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"url\": \"https://notte.cc\",\n    \"only_main_content\": false,\n  }'\n```\n\n## 错误处理\n\n### 常见错误及解决方案\n\n| 错误类型 | 可能原因 | 解决方案 |\n|----------|----------|----------|\n| `AuthenticationError` | API 密钥无效或过期 | 检查并更新 `NOTTE_API_KEY` |\n| `NetworkError` | 网络连接问题 | 检查网络连接和代理设置 |\n| `SessionExpiredError` | 会话超时 | 重新创建会话 |\n| `ActionExecutionError` | 动作执行失败 | 检查元素 ID 和页面状态 |\n\n### 重试机制\n\nNotte SDK 支持自动重试机制，您可以在执行动作时配置：\n\n```python\nsession.execute(\n    type=\"click\",\n    id=\"B1\",\n    raise_on_failure=True  # 失败时抛出异常\n)\n```\n\n## 下一步\n\n- 阅读完整的 [SDK 教程](sdk_tutorial.md) 深入了解高级功能\n- 查看 [API 参考文档](api_reference.md) 了解完整的 API 接口\n- 探索 [示例代码库](../examples/) 获取更多实践案例\n\n## 相关资源\n\n- 官方文档：[https://docs.notte.cc](https://docs.notte.cc)\n- API 密钥管理：[https://console.notte.cc](https://console.notte.cc)\n- 搜索演示：[https://search.notte.cc](https://search.notte.cc)\n\n---\n\n<a id='package-structure'></a>\n\n## 包结构分析\n\n### 相关页面\n\n相关主题：[核心模块实现](#core-modules), [项目介绍](#project-introduction)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-core/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-core/pyproject.toml)\n- [packages/notte-browser/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-browser/pyproject.toml)\n- [packages/notte-agent/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/pyproject.toml)\n- [packages/notte-sdk/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-sdk/pyproject.toml)\n- [packages/notte-llm/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/pyproject.toml)\n- [packages/notte-mcp/pyproject.toml](https://github.com/nottelabs/notte/blob/main/packages/notte-mcp/pyproject.toml)\n</details>\n\n# 包结构分析\n\n## 概述\n\nNotte 是一个面向互联网原生代理系统（Internet-native Agentic Systems）的软件套件，采用模块化架构设计。整个项目由多个独立的功能包组成，通过清晰的依赖关系组织，形成一套完整的浏览器自动化与LLM交互解决方案。\n\n项目根目录下包含 `packages/` 子目录，其中包含六个核心包：\n\n| 包名 | 版本 | 主要功能 |\n|------|------|----------|\n| notte-core | 0.1.0+ | 核心数据结构和错误处理 |\n| notte-browser | 0.1.0+ | 浏览器控制与页面交互 |\n| notte-agent | 0.1.0+ | Agent执行引擎 |\n| notte-sdk | 0.1.0+ | Python SDK客户端 |\n| notte-llm | 0.1.0+ | LLM提示词和响应处理 |\n| notte-mcp | 0.1.0+ | MCP协议服务器集成 |\n\n## 架构层次\n\n```mermaid\ngraph TD\n    subgraph \"notte-llm\"\n        LLM_Prompts[\"提示词模板\"]\n        LLM_Output[\"输出解析\"]\n    end\n    \n    subgraph \"notte-core\"\n        Core_Actions[\"动作定义\"]\n        Core_Observation[\"观察数据模型\"]\n        Core_Errors[\"错误处理\"]\n    end\n    \n    subgraph \"notte-browser\"\n        Browser_Control[\"浏览器控制\"]\n        Page_Scraping[\"页面抓取\"]\n    end\n    \n    subgraph \"notte-agent\"\n        Agent_Executor[\"Agent执行器\"]\n        Agent_Gufo[\"Gufo系统\"]\n    end\n    \n    subgraph \"notte-sdk\"\n        SDK_Client[\"客户端封装\"]\n        Session_Management[\"会话管理\"]\n    end\n    \n    subgraph \"notte-mcp\"\n        MCP_Server[\"MCP服务器\"]\n        MCP_Tools[\"工具定义\"]\n    end\n    \n    LLM_Prompts --> Core_Actions\n    Core_Actions --> Browser_Control\n    Agent_Executor --> Core_Actions\n    Agent_Executor --> LLM_Prompts\n    SDK_Client --> Session_Management\n    SDK_Client --> Agent_Executor\n    MCP_Server --> SDK_Client\n    MCP_Tools --> MCP_Server\n```\n\n## 各包详细分析\n\n### notte-core\n\n**功能定位**：基础层，提供整个项目的基础数据类型、动作定义、观察结果模型和错误处理机制。\n\n**源码结构**：\n\n```\nnotte-core/src/notte_core/\n├── actions/\n│   └── actions.py          # 动作类型定义（goto、click、fill等）\n├── observation/\n│   └── data models         # 页面观察数据结构\n├── errors/\n│   └── processing.py       # 错误类定义\n└── pruning.py              # 树剪枝算法\n```\n\n**核心模块**：\n\n| 模块 | 文件 | 说明 |\n|------|------|------|\n| actions | actions.py | 定义scrape、goto、click、fill等动作类型 |\n| errors | processing.py | NotteBaseError、InvalidInternalCheckError等 |\n| observation | 数据模型 | 页面元素的结构化表示 |\n\n**关键类型定义**（来源：[packages/notte-core/src/notte_core/actions/actions.py]()）：\n\n- `ScrapeAction`：页面数据抓取，支持指令过滤、选择器范围限定\n- `GotoAction`：页面导航\n- `ClickAction`：元素点击\n- `FillAction`：表单填充\n\n### notte-browser\n\n**功能定位**：浏览器控制层，基于Playwright实现浏览器自动化操作。\n\n**依赖关系**：\n\n```toml\n[project.dependencies]\nplaywright = \">=1.41.0\"\n```\n\n**核心功能**：\n\n| 功能 | 说明 |\n|------|------|\n| 页面导航 | 加载指定URL |\n| 元素交互 | 点击、填表、悬停等 |\n| 内容抓取 | 提取页面文本、图片、链接 |\n| 截图 | 页面可视化反馈 |\n\n### notte-agent\n\n**功能定位**：智能代理层，实现LLM驱动的自动化决策和执行。\n\n**源码结构**：\n\n```\nnotte-agent/src/notte_agent/\n├── gufo/\n│   └── system.md           # Gufo系统提示词\n└── 执行器                  # Agent核心逻辑\n```\n\n**核心能力**：\n\n| 能力 | 说明 |\n|------|------|\n| 动作规划 | 分析页面状态生成动作序列 |\n| 状态追踪 | 维护会话上下文 |\n| CAPTCHA处理 | 自动识别和处理验证码 |\n| 错误恢复 | 动作执行失败后的重试机制 |\n\n**Agent执行流程**（来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py]()）：\n\n```python\n# 会话创建\nwith client.Session() as session:\n    session.execute(type=\"goto\", url=\"https://example.com\")\n    obs = session.observe(perception_type='deep')\n    # Agent决策循环...\n```\n\n### notte-sdk\n\n**功能定位**：Python客户端SDK，封装所有API调用和会话管理。\n\n**核心组件**：\n\n| 组件 | 文件/类 | 说明 |\n|------|---------|------|\n| NotteClient | client.py | 主客户端类 |\n| Session | sessions.py | 会话上下文管理器 |\n| observe | sessions.py | 页面观察方法 |\n| execute | sessions.py | 动作执行方法 |\n\n**会话管理**（来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py]()）：\n\n```python\nclass Session:\n    \"\"\"会话上下文管理器\"\"\"\n    \n    def __init__(self, cookie_file=None):\n        self._cookie_file = cookie_file\n    \n    def __enter__(self):\n        self.start()\n        return self\n    \n    def __exit__(self, exc_type, exc_val, exc_tb):\n        self.stop()\n    \n    def observe(self, perception_type='fast', instructions=None):\n        \"\"\"观察页面可用动作\"\"\"\n        \n    def execute(self, type, **kwargs):\n        \"\"\"执行动作\"\"\"\n```\n\n**观察类型**：\n\n| 类型 | 说明 | 适用场景 |\n|------|------|----------|\n| `fast` | 快速感知 | 简单页面、高速查询 |\n| `deep` | 深度感知 | 复杂页面、需要LLM格式化 |\n\n### notte-llm\n\n**功能定位**：LLM交互层，处理提示词模板和响应解析。\n\n**源码结构**：\n\n```\nnotte-llm/src/notte_llm/prompts/\n├── action-listing/         # 动作列表生成\n├── data-extraction/        # 数据提取\n├── document-category/      # 文档分类\n├── extract-without-json-schema/  # 无schema提取\n└── debug-failing-action-exec/    # 调试失败动作\n```\n\n**提示词模板**：\n\n| 模板类型 | 用户文件 | 说明 |\n|----------|----------|------|\n| 动作列表 | user.md | 生成可执行动作序列 |\n| 数据提取 | user.md | 结构化数据抽取 |\n| 文档分类 | user.md | 页面分类（search-results、item、other） |\n| 失败调试 | user.md | 动作执行失败分析 |\n\n**文档分类类别**（来源：[packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md]()）：\n\n| 类别 | 说明 | 示例 |\n|------|------|------|\n| `search-results` | 搜索结果页面 | Google Flights搜索结果 |\n| `item` | 详情项页面 | 食谱详情页、商品页 |\n| `other` | 其他类型 | 首页、导航页 |\n\n### notte-mcp\n\n**功能定位**：Model Context Protocol服务器集成，提供标准化工具接口。\n\n**工具列表**（来源：[packages/notte-mcp/README.md]()）：\n\n| 工具名 | 功能 |\n|--------|------|\n| `notte_start_session` | 启动新的云浏览器会话 |\n| `notte_list_sessions` | 列出所有活动会话 |\n| `notte_stop_session` | 停止当前会话 |\n| `notte_observe` | 观察页面元素和可用动作 |\n| `notte_screenshot` | 页面截图 |\n| `notte_scrape` | 结构化数据提取 |\n| `notte_step` | 执行页面动作 |\n| `notte_operator` | 运行Notte Agent完成任务 |\n\n**使用方式**：\n\n```bash\npip install notte-mcp\nexport NOTTE_API_KEY=\"your-api-key\"\npython -m notte_mcp.server\n```\n\n## 依赖关系\n\n```mermaid\ngraph LR\n    SDK[\"notte-sdk\"] --> Agent[\"notte-agent\"]\n    SDK --> Browser[\"notte-browser\"]\n    Agent --> LLM[\"notte-llm\"]\n    Agent --> Core[\"notte-core\"]\n    Browser --> Core\n    MCP[\"notte-mcp\"] --> SDK\n```\n\n**依赖矩阵**：\n\n| 依赖方 \\ 被依赖方 | notte-core | notte-browser | notte-agent | notte-llm | notte-sdk |\n|------------------|------------|---------------|-------------|-----------|-----------|\n| notte-sdk | ✓ | - | ✓ | - | - |\n| notte-agent | ✓ | - | - | ✓ | - |\n| notte-browser | ✓ | - | - | - | - |\n| notte-mcp | - | - | - | - | ✓ |\n\n## 入口点设计\n\n### SDK入口\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\n```\n\n### MCP服务器入口\n\n```bash\npython -m notte_mcp.server\n```\n\n### CLI入口\n\n项目提供命令行接口进行快速操作：\n\n```bash\nnotte <command> [options]\n```\n\n## 错误处理体系\n\nNotte采用分层错误处理机制（来源：[packages/notte-core/src/notte_core/errors/processing.py]()）：\n\n| 错误类 | 说明 | 使用场景 |\n|--------|------|----------|\n| `NotteBaseError` | 基类异常 | 所有自定义异常的父类 |\n| `InvalidInternalCheckError` | 内部检查失败 | 代码假设验证失败 |\n| `InvalidA11yTreeType` | 无障碍树类型错误 | 未知a11y树类型 |\n| `InvalidPlaceholderError` | 占位符错误 | Vault凭据获取失败 |\n| `ScrapeFailedError` | 抓取失败 | 数据提取操作异常 |\n\n## 许可证\n\n整个项目采用 **Server Side Public License v1.0 (SSPL-1.0)** 许可证发布。\n\n## 引用信息\n\n如需在学术场合引用本项目，请使用以下BibTeX格式：\n\n```bibtex\n@software{notte2025,\n  author = {Pinto, Andrea and Giordano, Lucas and {nottelabs-team}},\n  title = {Notte: Software suite for internet-native agentic systems},\n  url = {https://github.com/nottelabs/notte},\n  year = {2025},\n  publisher = {GitHub},\n  license = {SSPL-1.0},\n  version = {1.4.4},\n}\n\n---\n\n<a id='core-modules'></a>\n\n## 核心模块实现\n\n### 相关页面\n\n相关主题：[包结构分析](#package-structure), [动作执行系统](#action-system)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-core/src/notte_core/actions/actions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/actions/actions.py)\n- [packages/notte-core/src/notte_core/browser/observation.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/browser/observation.py)\n- [packages/notte-core/src/notte_core/browser/snapshot.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/browser/snapshot.py)\n- [packages/notte-core/src/notte_core/browser/dom_tree.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/browser/dom_tree.py)\n- [packages/notte-core/src/notte_core/credentials/base.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/credentials/base.py)\n- [packages/notte-core/src/notte_core/ast.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/ast.py)\n</details>\n\n# 核心模块实现\n\n## 1. 模块概述\n\nNotte 项目的核心模块实现涵盖了浏览器自动化代理系统的关键组件，包括动作执行系统、页面观察机制、DOM 树处理、快照管理和凭证安全系统。这些模块共同构成了一个完整的网页自动化框架，使 AI 代理能够精确地与网页元素进行交互。\n\n核心模块的架构设计遵循分层职责原则，将浏览器操作、页面解析、状态管理和安全控制分离到不同的子模块中，每个模块专注于特定的功能域，通过标准化的接口进行通信和数据交换。\n\n## 2. 动作执行系统\n\n### 2.1 动作类型体系\n\n动作执行系统是 Notte 自动化框架的核心，负责定义和管理所有可执行的浏览器操作。系统采用类继承结构，通过基类 `BrowserAction` 定义通用接口，具体动作类实现各自的业务逻辑。\n\n| 动作类型 | 说明 | 参数 |\n|---------|------|------|\n| `GotoAction` | 导航到指定 URL | url: str |\n| `GotoNewTabAction` | 在新标签页中打开 URL | url: str |\n| `CloseTabAction` | 关闭当前标签页 | 无 |\n| `ClickAction` | 点击页面元素 | id: str |\n| `FormFillAction` | 填写表单字段 | 表单字段字典 |\n\n基类 `BrowserAction` 定义了动作执行的通用接口，包括执行消息生成、参数规范和示例数据提供。每个具体动作类都实现了这些抽象方法，确保动作执行的标准化和可预测性。\n\n### 2.2 动作执行流程\n\n动作执行采用统一的调用模式，通过 `execute()` 方法触发。执行流程首先验证动作参数的有效性，然后调用底层的 Playwright 或类似浏览器自动化引擎执行实际操作，最后返回执行结果。\n\n```mermaid\ngraph TD\n    A[创建动作实例] --> B[验证参数]\n    B --> C{参数有效?}\n    C -->|是| D[执行动作]\n    C -->|否| E[抛出验证错误]\n    D --> F{执行成功?}\n    F -->|是| G[返回 ExecutionResult]\n    F -->|否| H[记录错误信息]\n    G --> I[更新会话状态]\n    H --> I\n```\n\n### 2.3 动作参数定义\n\n每个动作类通过 `param` 属性提供参数规范，包括参数名称、数据类型和约束条件。这种设计使动作系统具备自描述能力，便于 LLM 代理理解和使用。\n\n```python\n@property\n@override\ndef param(self) -> ActionParameter | None:\n    return ActionParameter(name=\"url\", type=\"str\")\n```\n\n参数规范采用强类型定义，支持字符串、整数、布尔值和复杂对象类型。系统自动进行类型检查和转换，减少运行时错误的发生。\n\n## 3. 页面观察机制\n\n### 3.1 观察类型\n\n页面观察机制负责分析当前页面状态并生成可交互元素列表。系统支持多种观察深度，以适应不同场景的性能和精度需求。\n\n| 观察类型 | 说明 | 适用场景 |\n|---------|------|---------|\n| `fast` | 快速感知模式 | 简单页面感知、查询优化 |\n| `deep` | 深度感知模式 | 复杂页面分析、LLM 动作空间生成 |\n\n快速感知模式使用简化的页面解析逻辑，直接从浏览器的可访问性树中提取元素信息，适用于需要快速响应的场景。深度感知模式则调用 LLM 对页面进行更深入的分析，生成更结构化的交互空间表示。\n\n### 3.2 观察响应结构\n\n观察结果通过 `ObserveResponse` 类型封装，包含当前页面 URL、可交互元素列表和空间描述信息。这种结构化输出便于代理理解页面状态并规划后续动作。\n\n```mermaid\ngraph LR\n    A[页面 HTML] --> B[DOM 树解析]\n    B --> C[可访问性树生成]\n    C --> D{观察类型}\n    D -->|fast| E[快速元素提取]\n    D -->|deep| F[LLM 结构化分析]\n    E --> G[ObserveResponse]\n    F --> G\n```\n\n### 3.3 指令过滤机制\n\n观察系统支持通过自然语言指令过滤可交互元素。当提供 `instructions` 参数时，系统会解析指令语义，仅返回符合条件的目标元素，显著减少动作空间大小，提高代理决策效率。\n\n```python\nactions = session.observe(instructions=\"Fill the email input\")\nprint(actions[0].model_dump())\n```\n\n这种设计使开发者能够用自然语言描述交互意图，系统自动完成元素筛选和动作空间构建，降低了自动化脚本的编写难度。\n\n## 4. DOM 树处理\n\n### 4.1 树结构设计\n\nDOM 树模块负责将原始 HTML 文档解析为可编程访问的树形数据结构。树节点包含元素类型、属性、内容和层级关系，支持高效的遍历和查询操作。\n\n```mermaid\ngraph TD\n    A[HTML 文档] --> B[解析器]\n    B --> C[根节点]\n    C --> D[head 节点]\n    C --> E[body 节点]\n    E --> F[交互元素]\n    E --> G[文本节点]\n    D --> H[元数据节点]\n```\n\n每个树节点关联唯一的标识符，用于在观察响应中引用具体元素。节点同时记录可访问性属性，如角色、名称和状态，这些属性决定了元素的交互方式。\n\n### 4.2 可访问性树\n\nNotte 使用可访问性树（Accessibility Tree）作为页面元素的主要表示形式，相比原始 DOM 树提供了更丰富的语义信息。可访问性树去除了装饰性元素，保留功能性内容，使代理能够更准确地理解页面结构。\n\n| 属性 | 说明 |\n|------|------|\n| `role` | 元素语义角色（button, link, input 等） |\n| `name` | 元素的可见名称或标签 |\n| `state` | 元素当前状态（checked, disabled 等） |\n| `value` | 输入元素的当前值 |\n\n### 4.3 节点遍历与查询\n\nDOM 树模块提供多种遍历和查询方法，支持按标签名、类名、ID 或 XPath 表达式定位节点。查询结果可进一步用于动作生成或内容提取。\n\n## 5. 快照管理\n\n### 5.1 快照概念\n\n快照（Snapshot）是 Notte 系统记录页面状态的机制，每次页面变化后系统自动生成新的快照。快照包含完整的页面 DOM 结构、可访问性树和元数据，支持历史回溯和状态对比。\n\n快照管理器维护快照的历史记录，通过版本号或时间戳标识不同状态的快照。代理可以查询历史快照以了解页面变化过程，或在执行操作前保存当前状态以便回滚。\n\n### 5.2 快照数据结构\n\n```python\nclass Snapshot:\n    id: str\n    url: str\n    dom_tree: DOMTree\n    accessibility_tree: A11yTree\n    timestamp: datetime\n    metadata: dict\n```\n\n快照数据存储为只读对象，确保历史状态的完整性和一致性。系统支持快照的序列化和反序列化，便于分布式环境下的状态共享。\n\n### 5.3 快照与观察的关系\n\n观察操作基于当前快照执行，每次观察都会创建新的快照记录。观察结果中的元素标识符与快照中的节点一一对应，保证动作执行的精确性。\n\n```mermaid\ngraph LR\n    A[执行动作] --> B[页面更新]\n    B --> C[生成新快照]\n    C --> D[新快照 ID]\n    D --> E[观察结果引用新元素]\n```\n\n## 6. 凭证管理系统\n\n### 6.1 凭证架构\n\n凭证管理系统（Vault）负责安全存储和管理敏感信息，如登录凭据、API 密钥和认证令牌。系统采用分层架构，将凭证存储与业务逻辑分离，支持多种后端存储实现。\n\n```mermaid\ngraph TD\n    A[代理请求凭证] --> B[Vault 接口]\n    B --> C{凭证类型}\n    C -->|API 密钥| D[KeyVault]\n    C -->|用户名密码| E[CredentialVault]\n    C -->|OAuth 令牌| F[TokenVault]\n    D --> G[安全存储]\n    E --> G\n    F --> G\n```\n\n### 6.2 凭证基类设计\n\n```python\nclass NotteBaseError(Exception):\n    def __init__(\n        self,\n        agent_message: str,\n        user_message: str,\n        dev_message: str,\n    ) -> None:\n        self.agent_message = agent_message\n        self.user_message = user_message\n        self.dev_message = dev_message\n```\n\n凭证系统定义统一的异常类型，包含面向代理、用户和开发者的不同错误消息，便于问题的诊断和修复。当凭证操作失败时，系统根据上下文选择合适的错误消息返回。\n\n### 6.3 占位符机制\n\n代理通过占位符（Placeholder）引用凭证，系统在动作执行时自动替换占位符为实际凭证值。这种设计避免敏感信息硬编码在动作参数中，提高系统的安全性。\n\n| 占位符类型 | 说明 |\n|-----------|------|\n| `{vault:api_key:service}` | API 密钥占位符 |\n| `{vault:credential:site}` | 网站登录凭据占位符 |\n| `{vault:token:oauth}` | OAuth 令牌占位符 |\n\n## 7. AST 抽象语法树\n\nAST 模块提供网页内容的结构化表示能力，将无结构的 HTML/CSS/JavaScript 转换为可编程访问的语法树。该模块是高级自动化能力的基础，支持复杂页面结构的理解和操作。\n\n### 7.1 AST 与 DOM 的关系\n\nAST 与 DOM 树既有联系又有区别。DOM 树侧重于文档结构表示，AST 则更关注代码语义的表达。对于 JavaScript 代码，AST 能够解析变量声明、函数调用和控制流结构，为代码级别的自动化操作提供可能。\n\n| 特性 | DOM 树 | AST |\n|------|--------|-----|\n| 关注点 | 文档结构 | 代码语义 |\n| 适用范围 | HTML | HTML/CSS/JS |\n| 遍历方式 | 父子节点 | 语句/表达式 |\n| 用途 | 页面交互 | 代码分析 |\n\n### 7.2 节点类型系统\n\nAST 定义了丰富的节点类型，覆盖 JavaScript 语言的各种语法结构。常见节点类型包括：\n\n- **声明节点**：变量声明、函数声明、类声明\n- **表达式节点**：二元表达式、函数调用、成员访问\n- **控制流节点**：条件语句、循环语句、异常处理\n- **结构节点**：对象字面量、数组字面量\n\n节点类型系统支持 Visitor 模式遍历，代理可以实现自定义的节点处理器来执行特定的代码分析或转换任务。\n\n## 8. 错误处理机制\n\n### 8.1 错误分类体系\n\nNotte 定义了完善的错误分类体系，根据错误来源和性质分为不同类别：\n\n| 错误类型 | 说明 | 典型场景 |\n|---------|------|---------|\n| `InvalidInternalCheckError` | 内部检查失败 | 类型验证、假设检查 |\n| `InvalidA11yTreeType` | 无效的可访问性树类型 | 类型参数错误 |\n| `InvalidPlaceholderError` | 未处理的占位符 | 凭证引用错误 |\n| `ScrapeFailedError` | 数据抓取失败 | 页面解析异常 |\n\n### 8.2 错误消息设计\n\n每个错误类型包含面向不同角色的消息：\n\n- **开发消息（dev_message）**：详细的调试信息和修复建议\n- **代理消息（agent_message）**：代理可理解的错误描述和替代建议\n- **用户消息（user_message）**：面向终端用户的友好提示\n\n这种多层次的消息设计确保错误信息在开发、调试和生产环境中都能发挥作用。\n\n## 9. 模块间协作\n\n### 9.1 会话生命周期\n\n会话（Session）是 Notte 系统的核心概念，贯穿所有模块的协作过程。会话管理器的实现整合了动作执行、页面观察和快照管理功能：\n\n```python\nwith client.Session() as session:\n    session.execute(type=\"goto\", url=\"https://example.com\")\n    obs = session.observe()\n    markdown = session.scrape()\n```\n\n会话提供上下文管理器支持，自动处理资源清理和状态同步。当会话结束时，系统自动保存 Cookie 状态并释放浏览器资源。\n\n### 9.2 数据流总览\n\n```mermaid\ngraph TD\n    A[用户请求] --> B[会话管理器]\n    B --> C[动作系统]\n    C --> D[浏览器引擎]\n    D --> E[页面快照]\n    E --> F[DOM 树]\n    F --> G[可访问性树]\n    G --> H[观察服务]\n    H --> I[代理决策]\n    I --> C\n    E --> J[凭证系统]\n    J --> C\n```\n\n数据流展示了从用户请求到代理决策的完整链路。各模块通过标准化的数据结构和接口进行交互，保证系统的可扩展性和可维护性。\n\n### 9.3 状态同步机制\n\n会话维护当前的页面快照引用，当页面发生变化时自动更新。观察操作返回的是基于最新快照的元素列表，动作执行后触发新的快照生成，形成闭环的状态同步机制。\n\n## 10. 总结\n\n核心模块实现构成了 Notte 自动化框架的技术基础，通过动作系统、页面观察、DOM 处理、快照管理和凭证安全五大支柱，为 AI 代理提供完整的网页交互能力。这些模块相互协作，形成了一套从页面解析到动作执行的完整工作流，支持复杂场景下的自动化任务。\n\n---\n\n<a id='agent-implementation'></a>\n\n## Agent实现与生命周期\n\n### 相关页面\n\n相关主题：[结构化输出](#structured-output)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-agent/src/notte_agent/agent.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/agent.py)\n- [packages/notte-agent/src/notte_agent/agent_fallback.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/agent_fallback.py)\n- [packages/notte-agent/src/notte_agent/workflow.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/workflow.py)\n- [packages/notte-agent/src/notte_agent/common/conversation.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/common/conversation.py)\n- [packages/notte-agent/src/notte_agent/falco/agent.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/agent.py)\n- [packages/notte-agent/src/notte_agent/gufo/agent.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/gufo/agent.py)\n</details>\n\n# Agent实现与生命周期\n\n## 概述\n\nNotte Agent 是一个精确的浏览器自动化代理系统，通过结构化命令与网站进行交互。该系统能够分析网页元素和结构，规划动作序列，并以JSON格式响应动作执行结果和状态评估。Agent架构支持多种底层浏览器自动化引擎（包括Falco和Gufo），并通过统一的接口提供网页浏览、内容提取、表单填写等核心功能。\n\n资料来源：[packages/notte-agent/src/notte_agent/falco/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/system.md)\n\n## 架构设计\n\n### 整体架构\n\nNotte Agent采用分层架构设计，核心组件包括：\n\n| 组件 | 职责 | 源码位置 |\n|------|------|----------|\n| Agent基类 | 定义通用接口和生命周期管理 | `agent.py` |\n| Falco Agent | 基于Falco引擎的浏览器代理实现 | `falco/agent.py` |\n| Gufo Agent | 基于Gufo引擎的浏览器代理实现 | `gufo/agent.py` |\n| ActionRegistry | 动作注册与工具管理 | `falco/prompt.py` |\n| Workflow | 多步骤工作流编排 | `workflow.py` |\n| Conversation | 对话历史管理 | `common/conversation.py` |\n\n资料来源：[packages/notte-agent/src/notte_agent/falco/prompt.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/prompt.py)\n\n### 引擎抽象层\n\n系统通过抽象层支持多种浏览器自动化引擎：\n\n```mermaid\ngraph TD\n    A[Agent基类] --> B[Falco Agent]\n    A --> C[Gufo Agent]\n    B --> D[Falco引擎]\n    C --> E[Gufo引擎]\n    D --> F[Playwright/CDP]\n    E --> G[浏览器实例]\n```\n\nFalco和Gufo作为两种独立的Agent实现，共同继承自基础Agent接口，提供一致的外部行为但使用不同的底层浏览器控制机制。\n\n资料来源：[packages/notte-agent/src/notte_agent/agent.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/agent.py)\n\n## 元素标识系统\n\n### ID编码规范\n\nAgent使用标准化的元素标识系统，每个可交互元素的ID遵循特定编码规则：\n\n```mermaid\ngraph LR\n    A[ID格式] --> B[角色前缀]\n    A --> C[索引号]\n    A --> D[分隔符]\n    \n    B --> E[I: 输入字段]\n    B --> F[B: 按钮]\n    B --> G[L: 链接]\n    B --> H[F: 图片/图表]\n    B --> I[O: 选择选项]\n    B --> J[M: 杂项元素]\n```\n\n### 角色前缀对照表\n\n| 前缀 | 角色类型 | 示例元素 |\n|------|----------|----------|\n| `I` | Input | textbox, select, checkbox等输入控件 |\n| `B` | Button | 按钮元素 |\n| `L` | Link | 超链接 |\n| `F` | Figure | 图片和图表元素 |\n| `O` | Option | 下拉选择选项 |\n| `M` | Miscellaneous | 模态框、对话框等杂项元素 |\n\nID的完整格式为`<角色前缀><索引号>`，例如`B1`表示第一个按钮，`I2`表示第二个输入字段。\n\n资料来源：[packages/notte-agent/src/notte_agent/falco/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/system.md)\n\n## 动作系统\n\n### 动作类型\n\nAgent支持多种类型的浏览器自动化动作：\n\n| 动作类型 | 描述 | 适用场景 |\n|----------|------|----------|\n| ClickAction | 点击指定元素 | 按钮点击、链接导航 |\n| FormFillAction | 填写表单字段 | 用户登录、信息录入 |\n| CaptchaSolveAction | 解决验证码 | 自动化验证 |\n| ScrapeAction | 提取页面内容 | 数据采集 |\n| NavigationAction | 页面导航 | URL跳转、前进后退 |\n\n### 表单填写动作格式\n\n```json\n{\n  \"type\": \"form_fill\",\n  \"value\": {\n    \"address1\": \"<地址>\",\n    \"city\": \"<城市>\",\n    \"state\": \"<州/省份>\"\n  }\n}\n```\n\n### CAPTCHA处理规则\n\nAgent对验证码处理有严格的规范：\n\n- **禁止行为**：直接点击验证码元素（按钮、复选框、图片等），或对验证码元素执行\"click\"、\"type\"等动作\n- **正确处理**：检测到验证码（reCAPTCHA、hCaptcha、图像验证等）时，必须使用`CaptchaSolveAction`并指定正确的验证码类型\n- **支持类型**：包括\"我不是机器人\"复选框、图像选择网格、文本验证挑战等\n\n资料来源：[packages/notte-agent/src/notte_agent/falco/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/system.md)\n\n## Agent生命周期\n\n### 创建与启动\n\n使用NotteClient创建Agent实例：\n\n```python\nfrom notte_sdk import NotteClient\n\nnotte = NotteClient()\n\nwith notte.Session(open_viewer=True) as session:\n    agent = notte.Agent(session=session)\n    agent.start(\n        task=\"Summarize the content of the page\",\n        url=\"https://www.google.com\"\n    )\n```\n\n### 状态管理\n\nAgent具有完整的状态管理机制：\n\n| 状态 | 描述 | 获取方法 |\n|------|------|----------|\n| 运行中 | Agent正在执行任务 | `agent.status()` |\n| 已停止 | Agent已被手动停止 | `agent.stop()` |\n| 已完成 | 任务执行完毕 | 状态检查 |\n| 异常 | 执行过程中出错 | 错误处理 |\n\n### 列表与停止操作\n\n```python\n# 列出所有活跃的Agent\nagents = notte.agents.list()\n\n# 停止指定的Agent\nagent.stop()\n\n# 获取Agent状态\nstatus = agent.status()\n```\n\n资料来源：[packages/notte-sdk/README.md](https://github.com/nottelabs/notte/blob/main/packages/notte-sdk/README.md)\n\n## 工作流编排\n\n### Workflow组件\n\nWorkflow用于编排复杂的多步骤自动化任务，支持：\n\n- 步骤序列定义\n- 条件分支处理\n- 错误恢复机制\n- 结果状态传递\n\n```mermaid\ngraph TD\n    A[开始] --> B[步骤1: 页面导航]\n    B --> C[步骤2: 元素观察]\n    C --> D{条件判断}\n    D -->|成功| E[步骤3: 表单填写]\n    D -->|失败| F[备用方案]\n    E --> G[步骤4: 内容提取]\n    F --> G\n    G --> H[完成]\n```\n\n### Fallback机制\n\nAgent支持降级（Fallback）机制，当主要实现无法完成任务时自动切换到备用方案：\n\n```python\n# agent_fallback.py 提供了降级策略定义\n```\n\n资料来源：[packages/notte-agent/src/notte_agent/workflow.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/workflow.py)\n\n## 对话管理\n\n### Conversation组件\n\nConversation模块管理Agent与用户之间的交互历史：\n\n```python\nclass Conversation:\n    def __init__(self):\n        # 初始化对话历史记录\n        pass\n    \n    def add_message(self, role: str, content: str):\n        # 添加消息到历史\n        pass\n    \n    def get_history(self):\n        # 获取完整对话历史\n        pass\n```\n\n对话历史对于维护Agent状态上下文、支持多轮交互任务至关重要。\n\n资料来源：[packages/notte-agent/src/notte_agent/common/conversation.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/common/conversation.py)\n\n## 输入结构规范\n\n### 页面信息格式\n\nAgent接收的页面信息包含以下核心字段：\n\n| 字段 | 描述 | 必需 |\n|------|------|------|\n| Current URL | 当前页面地址 | 是 |\n| Available Tabs | 打开的浏览器标签页列表 | 是 |\n| Interactive Elements | 可交互元素列表 | 是 |\n\n### 元素列表格式\n\n```markdown\n# 主导航菜单\n* `B1`: 提交表单按钮\n* `I1`: 用户名输入框\n* `I2`: 密码输入框\n\n# 内容区域\n* `L1`: 文章链接\n* `F1`: 特色图片\n```\n\n## 响应格式规范\n\n### JSON响应结构\n\nAgent必须始终以有效的JSON格式响应：\n\n```json\n{\n  \"action\": {\n    \"type\": \"click\",\n    \"id\": \"B1\"\n  },\n  \"reasoning\": \"点击提交按钮以完成表单提交\",\n  \"state_assessment\": \"表单已填写完毕，可以提交\"\n}\n```\n\n### 动作执行结果\n\n每个动作执行后返回的结果包含：\n\n| 字段 | 类型 | 描述 |\n|------|------|------|\n| success | boolean | 动作是否成功执行 |\n| error | string | 错误信息（如有） |\n| page_state | object | 执行后页面状态 |\n| captured_data | object | 提取的数据（如适用） |\n\n## 最佳实践\n\n### 元素ID稳定性\n\n> **重要提示**：ID会在每个步骤发生变化，不要假设历史记录中的ID仍然存在或对应相同的元素。每次观察页面时都应重新获取当前的元素ID。\n\n### 动作序列规划\n\n1. 观察页面结构，获取可用元素\n2. 分析任务需求，规划动作序列\n3. 按顺序执行动作，每次观察页面变化\n4. 验证动作结果，必要时调整后续动作\n\n### 错误处理\n\nAgent内置了完善的错误处理机制：\n\n- **InvalidInternalCheckError**：内部检查失败\n- **InvalidA11yTreeType**：无障碍树类型错误\n- **InvalidPlaceholderError**：占位符处理错误\n- **ScrapeFailedError**：内容提取失败\n\n资料来源：[packages/notte-core/src/notte_core/errors/processing.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/errors/processing.py)\n\n---\n\n<a id='structured-output'></a>\n\n## 结构化输出\n\n### 相关页面\n\n相关主题：[Agent实现与生命周期](#agent-implementation)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-core/src/notte_core/actions/actions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/actions/actions.py)\n- [packages/notte-llm/src/notte_llm/engine.py](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/src/notte_llm/engine.py)\n- [packages/notte-llm/src/notte_llm/prompts/extract-without-json-schema/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/src/notte_llm/prompts/extract-without-json-schema/system.md)\n- [packages/notte-llm/src/notte_llm/prompts/data-extraction/user.md](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/src/notte_llm/prompts/data-extraction/user.md)\n- [packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md)\n- [README.md](https://github.com/nottelabs/notte/blob/main/README.md)\n</details>\n\n# 结构化输出\n\n## 概述\n\n结构化输出是 Notte 框架中用于将网页内容转换为机器可读格式的核心能力。该功能允许用户通过自然语言指令或 JSON Schema 定义，从非结构化的网页文档中提取结构化数据，并将其用于后续的 AI Agent 工作流中。\n\nNotte 的结构化输出系统包含以下几个核心组成部分：\n\n| 组件 | 职责 |\n|------|------|\n| ScrapeAction | 执行抓取的核心动作，支持多种输出格式配置 |\n| LLM 解析引擎 | 负责解析 LLM 返回的文本并提取结构化数据 |\n| Prompt 模板系统 | 提供文档分析和数据提取的指令模板 |\n| Schema 验证 | 支持 JSON Schema 和 Pydantic 模型验证 |\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py:1-100]()\n\n## 工作原理\n\n### 流程架构\n\n```mermaid\ngraph TD\n    A[用户发起请求] --> B[配置输出格式]\n    B --> C{输出类型}\n    C -->|JSON Schema| D[使用 extract-json-schema]\n    C -->|自然语言| E[使用 extract-without-json-schema]\n    C -->|分类| F[使用 document-category]\n    D --> G[调用 LLM]\n    E --> G\n    F --> G\n    G --> H[LLM 返回 Markdown/JSON]\n    H --> I[解析引擎提取数据]\n    I --> J{格式验证}\n    J -->|通过| K[返回结构化数据]\n    J -->|失败| L[抛出 LLMParsingError]\n```\n\n### 核心机制\n\nNotte 的结构化输出依赖于 LLM 解析引擎的标签解析能力。引擎通过识别特定的 XML 风格标签来提取内容：\n\n```python\n# packages/notte-llm/src/notte_llm/engine.py\nclass SomeParser:\n    def parse(self, text: str) -> str:\n        # 支持外层标签解析\n        if self.outer_tag:\n            pattern = f\"<{self.outer_tag}>(.*?)</{self.outer_tag}>\"\n            match = re.search(pattern, content, re.DOTALL)\n            \n        # 支持内层代码块解析\n        if self.inner_tag:\n            pattern = f\"```{self.inner_tag}(.*?)```\"\n            match = re.search(pattern, content, re.DOTALL)\n```\n\n引擎支持两层解析：\n1. **外层标签解析**：提取 `<document-analysis>` 等 XML 标签内的内容\n2. **内层代码块解析**：从 markdown 代码块中提取具体数据\n\n资料来源：[packages/notte-llm/src/notte_llm/engine.py:1-50]()\n\n## 输出格式配置\n\n### 使用 JSON Schema\n\n通过 `response_format` 参数指定 JSON Schema 定义输出结构：\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\nresponse = client.scrape(\n    url=\"https://example.com/blog\",\n    response_format={\n        \"type\": \"object\",\n        \"properties\": {\n            \"title\": {\"type\": \"string\"},\n            \"content\": {\"type\": \"string\"},\n            \"date\": {\"type\": \"string\"}\n        }\n    }\n)\n```\n\n### 使用 Pydantic 模型\n\n通过 Pydantic BaseModel 定义数据结构，实现类型安全的结构化输出：\n\n```python\nfrom pydantic import BaseModel\nfrom notte_sdk import NotteClient\n\nclass Article(BaseModel):\n    title: str\n    content: str\n    date: str\n\nclient = NotteClient()\nresponse = client.scrape(\n    url=\"https://example.com/blog\",\n    response_format=Article,\n    instructions=\"Extract only the title, date and content of the articles\"\n)\n```\n\n资料来源：[README.md:1-100]()\n\n## ScrapeAction 参数详解\n\n| 参数 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| `instructions` | str \\| None | None | 自然语言提取指令 |\n| `response_format` | dict \\| BaseModel | None | JSON Schema 或 Pydantic 模型 |\n| `only_main_content` | bool | True | 是否仅提取主体内容 |\n| `selector` | str \\| None | None | Playwright 选择器作用域 |\n| `only_images` | bool | False | 是否仅提取图片 |\n| `scrape_links` | bool | True | 是否提取链接 |\n| `scrape_images` | bool | False | 是否提取图片 URL |\n\n### 主要内容提取\n\n当 `only_main_content=True` 时，系统会自动排除导航栏、页脚等非核心内容：\n\n```python\nsession.execute(\n    type=\"scrape\",\n    only_main_content=True  # 排除导航栏和页脚\n)\n```\n\n### 选择器作用域\n\n使用 Playwright 选择器将提取范围限定在特定 DOM 元素内：\n\n```python\nsession.execute(\n    type=\"scrape\",\n    selector=\"#main-content\"  # 仅提取 main-content 内的内容\n)\n```\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py:1-100]()\n\n## Prompt 模板系统\n\n### 数据提取模板\n\n数据提取模板定义了从网页文档中提取结构化信息的指导原则：\n\n```\n# 数据提取输出规范\n\n## <document-analysis> 部分\n- 逻辑分解网页文档为有意义的章节\n- 描述每个部分的内容，聚焦文本元素\n- 为重复或结构化数据包含子章节\n\n## <data-extraction> 部分\n- 使用 Markdown 标题、表格、列表格式化数据\n- 重复数据使用 Markdown 表格展示\n- 所有原始字段必须包含在表格中\n```\n\n资料来源：[packages/notte-llm/src/notte_llm/prompts/data-extraction/user.md:1-50]()\n\n### 文档分类模板\n\nNotte 支持自动识别网页类型，可分类为：\n\n| 分类 | 说明 | 示例 |\n|------|------|------|\n| `search-results` | 搜索结果页面 | Google 航班搜索 |\n| `item` | 单项详情页面 | 商品详情页、菜谱页 |\n| `other` | 其他类型 | 首页、导航页 |\n\n```xml\n<document-category>\n[文档分类理由的详细分析，包括引用和论证...]\n<document-category-answer>search-results</document-category-answer>\n</document-category>\n```\n\n资料来源：[packages/notte-llm/src/notte_llm/prompts/document-category/base/user.md:1-50]()\n\n## 使用示例\n\n### 示例：Nike 产品抓取\n\n完整的结构化输出工作流示例：\n\n```python\nfrom notte_sdk import NotteClient\nfrom pydantic import BaseModel\n\nclass Product(BaseModel):\n    name: str\n    price: str\n    sizes: list[str]\n    colors: list[str]\n\nclient = NotteClient()\nwith client.Session() as session:\n    session.execute(type=\"goto\", url=\"https://www.nike.com\")\n    \n    response = session.execute(\n        type=\"scrape\",\n        response_format=Product,\n        instructions=\"Extract product name, price, available sizes and colors\"\n    )\n```\n\n### 示例：分类与数据提取结合\n\n```mermaid\ngraph LR\n    A[访问网页] --> B[document-category]\n    B --> C{分类结果}\n    C -->|search-results| D[提取列表数据]\n    C -->|item| E[提取详情数据]\n    C -->|other| F[提取导航信息]\n    D --> G[返回结构化JSON]\n    E --> G\n    F --> G\n```\n\n## 错误处理\n\n### LLMParsingError\n\n当 LLM 返回格式不符合预期时，引擎会抛出解析错误：\n\n```python\n# packages/notte-llm/src/notte_llm/engine.py\nif self.fail_if_outer_tag:\n    raise LLMParsingError(\n        f\"No content found within <{self.outer_tag}> tags in the response: {text}\"\n    )\n\nif self.fail_if_inner_tag:\n    raise LLMParsingError(\n        f\"No content found within ```{self.inner_tag}``` blocks in the response: {text}\"\n    )\n```\n\n### 常见错误场景\n\n| 错误类型 | 原因 | 解决方案 |\n|----------|------|----------|\n| 缺少外层标签 | LLM 未按要求输出 XML 标签 | 检查 prompt 模板配置 |\n| 缺少内层代码块 | JSON 数据未包裹在代码块中 | 使用 `fail_if_inner_tag=True` |\n| Schema 验证失败 | 返回数据不符合定义的结构 | 检查 JSON Schema 定义 |\n\n## 最佳实践\n\n1. **优先使用 Pydantic 模型**：通过类型提示获得更好的 IDE 支持和验证\n2. **明确的提取指令**：使用自然语言清晰描述需要提取的字段\n3. **合理设置作用域**：使用 `selector` 减少无关内容的干扰\n4. **启用主要内容提取**：设置 `only_main_content=True` 排除噪音\n\n## 相关链接\n\n- [ScrapeAction API 文档](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/actions/actions.py)\n- [LLM 解析引擎](https://github.com/nottelabs/notte/blob/main/packages/notte-llm/src/notte_llm/engine.py)\n- [Prompt 模板目录](https://github.com/nottelabs/notte/tree/main/packages/notte-llm/src/notte_llm/prompts)\n\n---\n\n<a id='session-management'></a>\n\n## 会话管理系统\n\n### 相关页面\n\n相关主题：[动作执行系统](#action-system), [凭证保险库](#vault-credentials)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-browser/src/notte_browser/session.py](https://github.com/nottelabs/notte/blob/main/packages/notte-browser/src/notte_browser/session.py)\n- [packages/notte-browser/src/notte_browser/controller.py](https://github.com/nottelabs/notte/blob/main/packages/notte-browser/src/notte_browser/controller.py)\n- [packages/notte-browser/src/notte_browser/playwright.py](https://github.com/nottelabs/notte/blob/main/packages/notte-browser/src/notte_browser/playwright.py)\n- [packages/notte-integrations/src/notte_integrations/sessions/cdp_session.py](https://github.com/nottelabs/notte/blob/main/packages/notte-integrations/src/notte_integrations/sessions/cdp_session.py)\n</details>\n\n# 会话管理系统\n\n## 概述\n\n会话管理系统（Session Management System）是 Notte 项目中负责管理浏览器会话的核心模块。该系统提供了创建、控制、监控和终止浏览器会话的完整生命周期管理功能。Notte 的会话管理基于 Playwright 浏览器自动化框架，支持 Chrome 等多种浏览器的自动化控制。\n\n会话管理系统的主要职责包括：\n\n- 创建和管理浏览器会话实例\n- 处理会话的启动和停止\n- 管理会话级别的 Cookie 和浏览器状态\n- 提供页面观察（Observe）和动作执行（Execute）能力\n- 支持 CDP（Chrome DevTools Protocol）集成\n- 提供隐匿性功能（Stealth），包括代理配置和 CAPTCHA 处理\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py]()\n\n## 核心架构\n\n### 系统组件关系\n\n```mermaid\ngraph TD\n    A[NotteClient] --> B[Session]\n    B --> C[BrowserController]\n    C --> D[PlaywrightBrowser]\n    C --> E[CDPSession]\n    B --> F[Cookie管理]\n    B --> G[Proxy配置]\n    B --> H[观察与执行]\n```\n\nNotte 会话管理系统采用分层架构设计：\n\n| 层级 | 组件 | 职责 |\n|------|------|------|\n| 客户端层 | `NotteClient` | SDK 入口，管理会话创建 |\n| 会话层 | `Session` | 会话生命周期管理 |\n| 控制器层 | `BrowserController` | 浏览器控制抽象 |\n| 浏览器层 | `PlaywrightBrowser` / `CDPSession` | 底层浏览器操作 |\n| 存储层 | Cookie/Proxy | 持久化配置 |\n\n资料来源：[packages/notte-browser/src/notte_browser/controller.py]()\n\n### 关键模块\n\n| 模块路径 | 功能描述 |\n|----------|----------|\n| `notte_browser/session.py` | 浏览器会话核心实现 |\n| `notte_browser/controller.py` | 浏览器控制器抽象层 |\n| `notte_browser/playwright.py` | Playwright 浏览器实现 |\n| `notte_integrations/sessions/cdp_session.py` | CDP 协议集成实现 |\n\n## 会话生命周期\n\n### 状态机模型\n\n```mermaid\nstateDiagram-v2\n    [*] --> Created: 初始化\n    Created --> Starting: session.start()\n    Starting --> Running: 浏览器就绪\n    Running --> Executing: 执行动作\n    Executing --> Running: 动作完成\n    Running --> Stopping: session.stop()\n    Stopping --> Stopped: 清理完成\n    Stopped --> [*]\n    \n    Running --> Error: 异常发生\n    Error --> Stopped: 错误处理\n```\n\n### 创建会话\n\n会话可以通过 `NotteClient` 的 `Session()` 方法创建，支持上下文管理器（with语句）自动管理生命周期。\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\nwith client.Session() as session:\n    session.execute(type=\"goto\", url=\"https://example.com\")\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:50-60]()\n\n### 会话配置参数\n\n| 参数名 | 类型 | 默认值 | 说明 |\n|--------|------|--------|------|\n| `browser_type` | str | \"chrome\" | 浏览器类型（chrome, firefox等） |\n| `open_viewer` | bool | False | 是否打开可视化查看器 |\n| `proxies` | bool | False | 是否启用内置代理 |\n| `solve_captchas` | bool | False | 是否自动解决CAPTCHA |\n| `timeout_minutes` | int | 5 | 会话超时时间（分钟） |\n| `_cookie_file` | str | None | Cookie持久化文件路径 |\n\n## 浏览器控制器\n\n### BrowserController 抽象\n\n`BrowserController` 是浏览器控制的核心抽象类，定义了浏览器操作的统一接口。\n\n资料来源：[packages/notte-browser/src/notte_browser/controller.py]()\n\n### PlaywrightBrowser 实现\n\n`PlaywrightBrowser` 是基于 Playwright 框架的浏览器实现，负责底层的浏览器启动、页面导航、元素交互等操作。\n\n```python\n# Playwright 浏览器核心功能\n- 启动浏览器实例\n- 创建新页面/标签页\n- 执行页面导航\n- 元素定位和交互\n- 截图和页面内容抓取\n```\n\n资料来源：[packages/notte-browser/src/notte_browser/playwright.py]()\n\n### CDP Session 实现\n\nCDP（Chrome DevTools Protocol）会话提供了与 Chrome 浏览器的深层集成能力，适用于高级自动化场景。\n\n```python\nfrom notte_integrations.sessions.cdp_session import CDPSession\n\n# CDP 会话功能\n- 实时网络监控\n- JavaScript 执行拦截\n- 性能分析\n- 控制台日志捕获\n```\n\n资料来源：[packages/notte-integrations/src/notte_integrations/sessions/cdp_session.py]()\n\n## 会话观察与动作执行\n\n### 观察机制（Observe）\n\n观察机制用于获取当前页面的可交互元素列表，生成动作空间（Action Space）。\n\n```python\n# 快速观察（简单页面感知）\nobs = session.observe(perception_type='fast')\n\n# 深度观察（LLM格式化）\nobs = session.observe(perception_type='deep')\n\n# 带指令的观察\nactions = session.observe(instructions=\"填写邮箱输入框\")\n```\n\n| 感知类型 | 特点 | 适用场景 |\n|----------|------|----------|\n| `fast` | 简单页面感知，执行快速 | 简单页面、低延迟需求 |\n| `deep` | LLM调用格式化 | 复杂页面、精确动作空间 |\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:100-120]()\n\n### 动作执行（Execute）\n\n执行机制支持多种浏览器操作类型：\n\n| 动作类型 | 说明 | 示例 |\n|----------|------|------|\n| `goto` | 导航到指定URL | `type=\"goto\", url=\"...\"` |\n| `goto_new_tab` | 在新标签页打开URL | `type=\"goto_new_tab\", url=\"...\"` |\n| `close_tab` | 关闭当前标签页 | `type=\"close_tab\"` |\n| `scrape` | 抓取页面内容 | `type=\"scrape\", instructions=\"...\"` |\n| `click` | 点击元素 | `type=\"click\", id=\"B1\"` |\n| `fill` | 填写表单 | `type=\"fill\", id=\"I1\", value=\"...\"` |\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py]()\n\n## Cookie 管理\n\n### 自动Cookie保存\n\n会话停止时自动保存Cookie到指定文件：\n\n```python\nwith client.Session(_cookie_file=\"cookies.json\") as session:\n    # 访问需要登录的网站\n    session.execute(type=\"goto\", url=\"https://example.com\")\n# 退出时会话自动保存Cookie\n```\n\n### Cookie持久化机制\n\n```mermaid\nsequenceDiagram\n    participant Session\n    participant Client\n    participant Browser\n    participant CookieFile\n    \n    Session->>Browser: 执行操作\n    Session->>Session: session.stop()\n    Session->>Browser: get_cookies()\n    Browser->>Session: cookies_data\n    Session->>CookieFile: create_or_append_cookies_to_file()\n    CookieFile->>CookieFile: 保存Cookie\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:40-48]()\n\n## 隐匿性功能（Stealth）\n\n### 代理配置\n\nNotte 支持内置代理配置，用于增强自动化任务的匿名性：\n\n```python\nwith client.Session(\n    proxies=True,  # 启用内置代理（默认美国节点）\n    browser_type=\"chrome\",\n    open_viewer=True\n) as session:\n    agent = client.Agent(session=session, max_steps=5)\n    response = agent.run(\n        task=\"执行任务\",\n        url=\"https://example.com\"\n    )\n```\n\n### 自定义代理\n\n```python\nfrom notte_sdk import NotteClient, ExternalProxy\n\nclient = NotteClient()\n\nproxy_settings = ExternalProxy(\n    server=\"http://your-proxy-server:port\",\n    username=\"your-username\",\n    password=\"your-password\"\n)\n\nwith client.Session(proxy=proxy_settings) as session:\n    pass\n```\n\n### CAPTCHA处理\n\nNotte 内置CAPTCHA自动解决功能：\n\n```python\nwith client.Session(\n    solve_captchas=True,\n    browser_type=\"chrome\"\n) as session:\n    # 系统会自动检测和处理CAPTCHA\n    session.execute(type=\"goto\", url=\"https://example.com/recaptcha\")\n```\n\n## API 参考\n\n### NotteClient.Session()\n\n创建新的浏览器会话。\n\n**签名：**\n```python\ndef Session(\n    self,\n    browser_type: str = \"chrome\",\n    open_viewer: bool = False,\n    proxies: bool = False,\n    solve_captchas: bool = False,\n    timeout_minutes: int = 5,\n    _cookie_file: str | None = None,\n) -> Session:\n```\n\n**返回值：** `Session` 实例\n\n### Session.execute()\n\n执行浏览器动作。\n\n**签名：**\n```python\ndef execute(\n    self,\n    type: Literal[\"goto\", \"goto_new_tab\", \"close_tab\", \"scrape\", ...],\n    **kwargs\n) -> ExecutionResult:\n```\n\n### Session.observe()\n\n观察当前页面，生成动作空间。\n\n**签名：**\n```python\ndef observe(\n    self,\n    perception_type: Literal[\"fast\", \"deep\"] = \"fast\",\n    instructions: str | None = None,\n    **kwargs\n) -> ObserveResponse | list[InteractionActionUnion]:\n```\n\n## 最佳实践\n\n### 1. 使用上下文管理器\n\n始终使用 `with` 语句管理会话，确保资源正确释放：\n\n```python\n# 推荐写法\nwith client.Session() as session:\n    session.execute(type=\"goto\", url=\"https://example.com\")\n\n# 不推荐：需要手动调用stop()\nsession = client.Session()\ntry:\n    session.start()\n    session.execute(type=\"goto\", url=\"https://example.com\")\nfinally:\n    session.stop()\n```\n\n### 2. Cookie复用\n\n对于需要登录的网站，使用Cookie持久化避免重复登录：\n\n```python\n# 首次登录并保存Cookie\nwith client.Session(_cookie_file=\"session.json\") as session:\n    session.execute(type=\"goto\", url=\"https://example.com/login\")\n    # 执行登录操作...\n\n# 后续请求复用Cookie\nwith client.Session(_cookie_file=\"session.json\") as session:\n    session.execute(type=\"goto\", url=\"https://example.com/protected\")\n```\n\n### 3. 合理选择感知类型\n\n| 场景 | 推荐感知类型 |\n|------|-------------|\n| 简单表单填写 | `fast` |\n| 复杂页面导航 | `deep` |\n| 批量操作 | `fast` |\n| 精确元素定位 | `deep` |\n\n## 错误处理\n\n### 常见错误\n\n| 错误类型 | 原因 | 解决方案 |\n|----------|------|----------|\n| `ValueError` | 会话未启动 | 确保在 `with` 块内执行操作 |\n| `RuntimeError` | 会话关闭失败 | 检查浏览器进程状态 |\n| 浏览器启动失败 | Playwright未安装 | 运行 `playwright install` |\n\n### 错误恢复\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\n\ntry:\n    with client.Session() as session:\n        session.execute(type=\"goto\", url=\"https://example.com\")\nexcept Exception as e:\n    # 错误日志记录\n    print(f\"会话执行错误: {e}\")\n    # 重新创建会话\n```\n\n## 相关文档\n\n- [Agent 系统](../agent/agent-system.md)\n- [动作系统](../actions/actions.md)\n- [观察系统](../observation/observation.md)\n- [MCP 集成](../integrations/mcp-integration.md)\n\n---\n\n<a id='action-system'></a>\n\n## 动作执行系统\n\n### 相关页面\n\n相关主题：[会话管理系统](#session-management), [核心模块实现](#core-modules)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-core/src/notte_core/actions/actions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/actions/actions.py)\n- [packages/notte-core/src/notte_core/errors/processing.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/errors/processing.py)\n- [packages/notte-agent/src/notte_agent/falco/system.md](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/system.md)\n- [packages/notte-agent/src/notte_agent/falco/prompt.py](https://github.com/nottelabs/notte/blob/main/packages/notte-agent/src/notte_agent/falco/prompt.py)\n- [packages/notte-sdk/src/notte_sdk/endpoints/sessions.py](https://github.com/nottelabs/notte/blob/main/packages/notte-sdk/src/notte_sdk/endpoints/sessions.py)\n</details>\n\n# 动作执行系统\n\n## 概述\n\n动作执行系统是 Notte 项目中负责与网页进行交互的核心模块。该系统定义了 Agent 可以执行的所有浏览器操作类型，包括页面导航、表单填充、元素点击、数据提取等。动作执行系统通过结构化的动作定义和统一的执行接口，使 AI Agent 能够以编程方式控制浏览器行为。\n\n系统架构遵循模块化设计原则，核心动作定义位于 `notte_core` 包中，而具体执行逻辑则在 `notte_browser` 和 `notte_agent` 包中实现。SDK 层提供了面向用户的简洁 API，隐藏了底层复杂性。\n\n## 动作类型体系\n\nNotte 的动作系统采用类型字面量（Literal Types）定义所有支持的浏览器操作。每一类动作都有明确的类型标识符、参数定义和执行消息。\n\n### 基础动作类型\n\n| 动作类型 | 描述 | 参数 |\n|---------|------|------|\n| `goto` | 导航到指定 URL | `url: str` |\n| `goto_new_tab` | 在新标签页中打开 URL | `url: str` |\n| `close_tab` | 关闭当前标签页 | 无 |\n| `click` | 点击元素 | `id: str` |\n| `hover` | 悬停在元素上 | `id: str` |\n| `scrape` | 从页面提取数据 | `instructions: str` |\n| `form_fill` | 填写表单 | `value: dict` |\n| `select_option` | 选择下拉选项 | `id: str`, `option: str` |\n| `captcha_solve` | 解决验证码 | `captcha_type: str` |\n| `reload` | 刷新页面 | 无 |\n\n### 导航动作\n\n#### GotoAction\n\n导航到指定 URL 是最基础的浏览器操作。`GotoAction` 接收一个 URL 参数，并将当前页面导航至该地址。\n\n```python\nclass GotoAction(BrowserAction):\n    type: Literal[\"goto\"] = \"goto\"\n    description: str = \"Navigate to a URL\"\n    url: str\n\n    def execution_message(self) -> str:\n        return f\"Navigated to '{self.url}'\"\n```\n\n**示例：**\n```python\nsession.execute(type=\"goto\", url=\"https://www.example.com\")\n```\n\n#### GotoNewTabAction\n\n在新的浏览器标签页中打开 URL。此动作不影响当前页面的状态。\n\n**示例：**\n```python\nsession.execute(type=\"goto_new_tab\", url=\"https://www.example.com\")\n```\n\n#### CloseTabAction\n\n关闭当前活跃的浏览器标签页。如果关闭的是最后一个标签页，浏览器会话将保持但显示空白页面。\n\n### 交互动作\n\n#### ClickAction\n\n点击页面上的可交互元素，如按钮、链接等。元素通过系统分配的 ID 标识。\n\n#### HoverAction\n\n将鼠标悬停在指定元素上，通常用于触发下拉菜单或显示隐藏内容。\n\n#### SelectOptionAction\n\n从 `<select>` 下拉列表中选择选项。需要指定目标元素 ID 和要选择的选项值。\n\n### 表单处理\n\n#### FormFillAction\n\n表单填写是网页交互中最常见的操作之一。`FormFillAction` 支持批量填写多个字段，支持多种输入类型。\n\n```python\n# 示例：填写地址表单\nform_values = {\n    \"address1\": \"123 Main St\",\n    \"city\": \"San Francisco\",\n    \"state\": \"CA\"\n}\nsession.execute(type=\"form_fill\", value=form_values)\n```\n\n系统会自动识别目标元素并进行相应的输入操作，支持文本框、文本域、下拉选择等多种表单控件。\n\n### 数据提取\n\n#### ScrapeAction\n\n从当前页面提取结构化数据。通过自然语言指令指定要提取的内容。\n\n```python\nobs = session.observe()\nscrape_result = session.execute(\n    type=\"scrape\",\n    instructions=\"提取所有搜索结果的标题和链接\"\n)\n```\n\n### 验证码处理\n\n#### CaptchaSolveAction\n\n处理页面上的验证码挑战。系统支持多种验证码类型，包括 reCAPTCHA、hCaptcha、图像验证等。\n\n**关键规则：**\n- 绝对不要直接点击验证码相关元素\n- 必须使用 `captcha_solve` 专用动作\n- 检测到验证码时应立即使用此动作\n\n```python\n# 解决 reCAPTCHA\nsession.execute(type=\"captcha_solve\", captcha_type=\"recaptcha\")\n```\n\n## 动作执行流程\n\n```mermaid\ngraph TD\n    A[用户/Agent 调用 execute] --> B[Session 接收动作请求]\n    B --> C{验证动作类型}\n    C -->|有效| D[构建动作对象]\n    C -->|无效| E[抛出 ValidationError]\n    D --> F[发送到 notte_browser 执行]\n    F --> G{执行结果}\n    G -->|成功| H[返回 ExecutionResult]\n    G -->|失败| I{错误类型}\n    I -->|可重试| J[执行重试逻辑]\n    I -->|不可重试| K[抛出异常]\n    J --> F\n```\n\n## 执行结果处理\n\n### ExecutionResult\n\n每次动作执行都会返回 `ExecutionResult` 对象，包含执行状态和相关信息：\n\n| 字段 | 类型 | 描述 |\n|------|------|------|\n| `success` | `bool` | 执行是否成功 |\n| `message` | `str` | 执行结果消息 |\n| `session_id` | `str` | 会话标识符 |\n| `url` | `str` | 执行后的页面 URL |\n| `error` | `str \\| None` | 错误信息（如果失败） |\n\n### 错误处理\n\n系统在 `notte_core/errors/processing.py` 中定义了丰富的错误类型：\n\n| 错误类型 | 触发条件 |\n|---------|---------|\n| `InvalidPlaceholderError` | 占位符无法解析 |\n| `ScrapeFailedError` | 数据提取失败 |\n| `InvalidA11yTreeType` | 无障碍树类型无效 |\n| `InvalidA11yChildrenError` | 元素子节点数量异常 |\n\n## 动作选择机制\n\n在 Agent 决策过程中，动作选择器（Action Selector）负责从页面的可交互元素中生成候选动作列表。\n\n```mermaid\ngraph LR\n    A[页面 DOM/Accessibility Tree] --> B[Perception 模块]\n    B --> C[生成交互元素列表]\n    C --> D[动作选择器 Pipe]\n    D --> E[过滤/排序候选动作]\n    E --> F[返回 ActionSpace]\n```\n\n### 元素标识符规范\n\n系统使用统一的前缀标识不同类型的可交互元素：\n\n| 前缀 | 元素类型 | 示例 |\n|------|---------|------|\n| `I` | 输入字段 | `I1`, `I2` |\n| `B` | 按钮 | `B1`, `B2` |\n| `L` | 链接 | `L1`, `L2` |\n| `F` | 图片/图形 | `F1` |\n| `O` | 下拉选项 | `O1` |\n| `M` | 杂项元素 | `M1` |\n\n## SDK 使用示例\n\n### 基本执行流程\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\nwith client.Session() as session:\n    # 导航\n    session.execute(type=\"goto\", url=\"https://console.notte.cc\")\n    \n    # 观察页面\n    obs = session.observe()\n    print(obs.space.description)\n    \n    # 执行交互\n    session.execute(type=\"click\", id=\"B1\")\n```\n\n### 带指令的观察\n\n使用 `instructions` 参数可以快速定位特定意图的交互元素：\n\n```python\nactions = session.observe(instructions=\"Fill the email input\")\nprint(actions[0].model_dump())\n```\n\n### 感知类型\n\n| 类型 | 描述 | 适用场景 |\n|------|------|---------|\n| `fast` | 快速页面感知，不调用 LLM | 高频交互、简单页面 |\n| `deep` | 深度感知，使用 LLM 格式化 | 复杂页面、需要结构化理解 |\n\n```python\n# 快速感知\nobs = session.observe(perception_type='fast')\n\n# 深度感知\nobs = session.observe(perception_type='deep')\n```\n\n## 动作定义源码结构\n\n核心动作类继承自 `BrowserAction` 基类，每个动作实现以下关键方法：\n\n```python\nclass BrowserAction(BaseModel):\n    type: str\n    description: str\n    \n    def execution_message(self) -> str:\n        \"\"\"返回动作执行后的状态消息\"\"\"\n        ...\n    \n    @staticmethod\n    def example() -> Self:\n        \"\"\"返回动作的示例实例\"\"\"\n        ...\n    \n    @property\n    def param(self) -> ActionParameter | None:\n        \"\"\"返回动作参数定义\"\"\"\n        ...\n```\n\n资料来源：[packages/notte-core/src/notte_core/actions/actions.py:1-100]()\n\n## 最佳实践\n\n1. **使用上下文管理器**：始终使用 `with` 语句管理 Session，确保资源正确释放\n2. **选择合适的感知类型**：简单操作使用 `fast`，复杂页面使用 `deep`\n3. **验证元素存在性**：页面元素 ID 可能在不同步骤间变化，不要依赖历史 ID\n4. **处理验证码**：发现验证码时立即使用专用处理动作\n5. **检查执行结果**：始终检查 `ExecutionResult.success` 字段\n\n```python\n# 推荐做法\nwith client.Session() as session:\n    result = session.execute(type=\"goto\", url=\"https://example.com\")\n    if not result.success:\n        print(f\"Navigation failed: {result.error}\")\n```\n\n## 相关模块\n\n| 模块 | 职责 |\n|------|------|\n| `notte_core.actions` | 定义所有动作类型和基类 |\n| `notte_browser` | 实际执行浏览器操作 |\n| `notte_agent` | Agent 决策和动作选择 |\n| `notte_sdk` | 面向用户的执行接口 |\n\n---\n\n<a id='vault-credentials'></a>\n\n## 凭证保险库\n\n### 相关页面\n\n相关主题：[文件存储系统](#file-storage)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-core/src/notte_core/credentials/base.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/credentials/base.py)\n- [packages/notte-core/src/notte_core/credentials/types.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/credentials/types.py)\n- [packages/notte-browser/src/notte_browser/vault.py](https://github.com/nottelabs/notte/blob/main/packages/notte-browser/src/notte_browser/vault.py)\n- [examples/auth-vault-agent/agent.py](https://github.com/nottelabs/notte/blob/main/examples/auth-vault-agent/agent.py)\n</details>\n\n# 凭证保险库\n\n凭证保险库（Credentials Vault） 是 Notte 框架中用于安全管理用户凭证（credentials）和占位符（placeholder）的核心组件。它为 Agent 提供了一种安全的方式来存储、检索和使用敏感信息（如密码、API 密钥、验证码等），同时避免了这些敏感信息在日志或交互历史中暴露。\n\n## 功能概述\n\n凭证保险库的主要职责包括：\n\n| 功能 | 描述 |\n|------|------|\n| 凭证存储 | 安全存储用户的认证凭据 |\n| 占位符解析 | 将代码中的占位符替换为实际凭证值 |\n| 动态注入 | 在表单填写时自动注入凭证 |\n| 生命周期管理 | 管理凭证的有效期和刷新 |\n\n凭证保险库与 Agent 系统紧密集成，当 Agent 执行需要认证的任务时（如登录网站），系统会从保险库中获取相应凭证，而不是让 Agent 直接处理敏感数据。资料来源：[packages/notte-core/src/notte_core/errors/processing.py:31-38]()\n\n## 核心架构\n\n### 组件关系图\n\n```mermaid\ngraph TD\n    A[Agent] --> B[Vault]\n    B --> C[Credentials Store]\n    B --> D[Placeholder Resolver]\n    C --> E[BaseCredential]\n    D --> F[InvalidPlaceholderError]\n    G[Session] --> B\n    H[Action Execution] --> B\n```\n\n### 凭证类型体系\n\nNotte 框架定义了多种凭证类型，通过 `credentials/types.py` 中的类型系统进行管理：\n\n- **BaseCredential**：所有凭证类型的基类\n- **CredentialsPlaceholder**：用于在代码中引用保险库中的凭证\n- **AgentCredentials**：专门用于 Agent 认证场景的凭证\n\n资料来源：[packages/notte-core/src/notte_core/credentials/types.py]()\n\n## 使用方式\n\n### 基本使用流程\n\n```mermaid\ngraph LR\n    A[创建 Vault] --> B[添加凭证]\n    B --> C[Agent 执行任务]\n    C --> D[解析占位符]\n    D --> E[注入凭证]\n```\n\n### 在 Agent 中使用保险库\n\n以下示例展示了如何在 Agent 中集成凭证保险库：\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\n\n# 创建保险库并添加凭证\nwith client.Vault() as vault:\n    vault.add_credential(name=\"github_token\", value=\"ghp_xxxxx\")\n    vault.add_credential(name=\"email\", value=\"user@example.com\")\n    \n    with client.Session() as session:\n        agent = client.Agent(session=session, vault=vault, max_steps=10)\n        response = agent.run(\n            task=\"登录 GitHub 并访问我的仓库列表\"\n        )\n```\n\n资料来源：[examples/auth-vault-agent/agent.py]()\n\n### 占位符机制\n\n在任务描述中使用占位符引用保险库中的凭证：\n\n```python\n# 占位符格式\nvault.add_credential(name=\"github_password\", value=\"mypassword\")\n\n# 在任务中使用\ntask = \"使用凭证 {github_password} 登录 GitHub\"\n```\n\n当 Agent 执行时，系统会自动将 `{placeholder_name}` 格式的占位符替换为保险库中对应的实际值。\n\n## API 参考\n\n### Vault 类\n\n| 方法 | 参数 | 返回值 | 描述 |\n|------|------|--------|------|\n| `add_credential` | `name: str, value: str` | `None` | 添加新凭证 |\n| `get_credential` | `name: str` | `str` | 获取指定名称的凭证 |\n| `remove_credential` | `name: str` | `bool` | 删除指定凭证 |\n| `list_credentials` | - | `list[str]` | 列出所有凭证名称 |\n\n### 占位符错误处理\n\n当占位符未被正确处理时，系统会抛出 `InvalidPlaceholderError`：\n\n| 错误字段 | 说明 |\n|----------|------|\n| `dev_message` | 指出占位符未被当前保险库处理 |\n| `agent_message` | 提示 Agent 尝试选择其他值 |\n| `user_message` | 用户友好的错误提示 |\n\n资料来源：[packages/notte-core/src/notte_core/errors/processing.py:31-38]()\n\n## 最佳实践\n\n### 安全建议\n\n1. **敏感信息隔离**：所有敏感凭证应存储在 Vault 中，避免硬编码\n2. **环境变量分离**：生产环境中使用环境变量配置凭证，而非代码仓库\n3. **最小权限原则**：仅为 Agent 提供完成任务所需的最少凭证\n\n### 性能优化\n\n| 策略 | 描述 |\n|------|------|\n| 延迟加载 | 仅在需要时加载凭证到内存 |\n| 缓存机制 | 缓存已解析的占位符结果 |\n| 会话复用 | 在同一会话中复用保险库实例 |\n\n## 与其他组件的集成\n\n### 与 Session 集成\n\n保险库可以与浏览器会话配合使用，实现自动登录：\n\n```python\nwith client.Vault() as vault:\n    vault.add_credential(name=\"username\", value=\"user@example.com\")\n    vault.add_credential(name=\"password\", value=\"secret123\")\n    \n    with client.Session() as session:\n        agent = client.Agent(session=session, vault=vault)\n        # Agent 会自动使用 vault 中的凭证进行登录\n```\n\n### 与 Agent Persona 集成\n\n保险库可与 Agent Persona 结合使用，提供完整的数字身份认证能力：\n\n```python\nwith client.Vault() as vault:\n    with client.Persona() as persona:\n        with client.Session() as session:\n            agent = client.Agent(\n                session=session,\n                persona=persona,\n                vault=vault,\n                max_steps=15\n            )\n```\n\n资料来源：[README.md](https://github.com/nottelabs/notte/blob/main/README.md)\n\n## 实现细节\n\n### 凭证存储层\n\n凭证保险库的存储实现位于 `packages/notte-browser/src/notte_browser/vault.py`，该模块负责：\n\n- 本地凭证的安全存储\n- 与浏览器上下文的集成\n- 跨会话的凭证持久化\n\n### 核心基类\n\n`packages/notte-core/src/notte_core/credentials/base.py` 定义了凭证管理的抽象接口，包括：\n\n- 凭证的创建和销毁\n- 占位符的注册和解析\n- 凭证的验证和刷新\n\n资料来源：[packages/notte-core/src/notte_core/credentials/base.py]()\n\n## 总结\n\n凭证保险库是 Notte 框架安全架构的重要组成部分，它通过以下方式保护敏感信息：\n\n- 集中管理所有凭证\n- 使用占位符避免敏感信息暴露\n- 与 Agent 系统无缝集成\n- 提供完善的错误处理机制\n\n通过正确使用凭证保险库，开发者可以在保持安全性的同时，让 Agent 自动化执行需要认证的复杂任务。\n\n---\n\n<a id='file-storage'></a>\n\n## 文件存储系统\n\n### 相关页面\n\n相关主题：[凭证保险库](#vault-credentials)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [packages/notte-sdk/src/notte_sdk/endpoints/files.py](https://github.com/nottelabs/notte/blob/main/packages/notte-sdk/src/notte_sdk/endpoints/files.py)\n- [packages/notte-core/src/notte_core/storage.py](https://github.com/nottelabs/notte/blob/main/packages/notte-core/src/notte_core/storage.py)\n- [docs/src/snippets/file-storage/quickstart.mdx](https://github.com/nottelabs/notte/blob/main/docs/src/snippets/file-storage/quickstart.mdx)\n</details>\n\n# 文件存储系统\n\n## 概述\n\nNotte 的文件存储系统是整个平台的核心模块之一，负责管理文件上传、下载、存储和检索功能。该系统与 Notte 的会话管理和浏览器交互功能紧密集成，为 AI Agent 提供持久化的文件存储能力。\n\n文件存储系统的主要职责包括：\n\n- 支持会话期间的文件上传与持久化\n- 提供文件元数据管理\n- 存储截图、图片等多媒体数据\n- 与 Vault 凭证管理系统集成\n\n## 核心架构\n\n### 数据模型\n\n文件存储系统的核心数据模型为 `FileData`，定义在 `packages/notte-core/src/notte_core/storage.py` 中：\n\n| 字段名 | 类型 | 说明 |\n|--------|------|------|\n| `id` | str | 文件唯一标识符 |\n| `name` | str | 文件名称 |\n| `mime_type` | str | 文件 MIME 类型 |\n| `size` | int | 文件大小（字节） |\n| `url` | str \\| None | 文件访问 URL |\n| `content` | bytes \\| None | 文件二进制内容 |\n\n### 存储层级\n\n```\n┌─────────────────────────────────────────────┐\n│              NotteClient                    │\n│  (packages/notte-sdk/src/notte_sdk)         │\n└─────────────────┬───────────────────────────┘\n                  │\n┌─────────────────▼───────────────────────────┐\n│         FilesEndpoint                       │\n│  (packages/notte-sdk/src/notte_sdk/         │\n│   endpoints/files.py)                       │\n└─────────────────┬───────────────────────────┘\n                  │\n┌─────────────────▼───────────────────────────┐\n│         StorageService                      │\n│  (packages/notte-core/src/notte_core/       │\n│   storage.py)                               │\n└─────────────────────────────────────────────┘\n```\n\n## API 接口\n\n### FilesEndpoint 类\n\n`FilesEndpoint` 是 SDK 层面的文件操作入口，提供以下核心方法：\n\n| 方法名 | 参数 | 返回类型 | 说明 |\n|--------|------|----------|------|\n| `upload` | file: FileData | FileData | 上传文件并返回包含 ID 的文件对象 |\n| `download` | file_id: str | bytes | 根据文件 ID 下载文件内容 |\n| `list` | - | list[FileData] | 列出所有已存储的文件 |\n| `delete` | file_id: str | None | 删除指定文件 |\n\n### 端点路由\n\n文件存储 API 的基础端点为：\n\n```\nPOST /api/files/upload\nGET  /api/files/{file_id}\nGET  /api/files/{file_id}/download\nDELETE /api/files/{file_id}\nGET  /api/files\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/files.py:1-100]()\n\n## 存储类型\n\nNotte 支持多种类型的文件存储：\n\n### 用户上传文件\n\n用户通过 SDK 上传的自定义文件，如文档、配置文件等。\n\n### 截图数据\n\n浏览器截图自动存储为文件，便于 Agent 回溯和调试：\n\n```python\nclass ScreenshotData(BaseModel):\n    id: str\n    timestamp: datetime\n    data: bytes\n    session_id: str\n```\n\n### 图片数据\n\n`ImageData` 类封装了从网页抓取的图片资源：\n\n```python\nclass ImageData(BaseModel):\n    url: str | None\n    alt_text: str | None\n    id: str\n    \n    def bytes(self) -> bytes:\n        \"\"\"获取图片字节数据\"\"\"\n```\n\n资料来源：[packages/notte-core/src/notte_core/data/space.py:50-70]()\n\n## 与会话系统集成\n\n文件存储与 Notte 的会话管理系统深度集成。在会话运行期间：\n\n1. **会话启动时**：可以指定 `cookies_file` 参数自动保存会话 cookie 到指定文件\n2. **会话运行中**：截图和图片自动关联到当前会话\n3. **会话结束时**：文件保持持久化，可供后续会话访问\n\n```python\n# 会话文件存储示例\nwith client.Session(cookies_file=\"./cookies.json\") as session:\n    session.execute(type=\"goto\", url=\"https://example.com\")\n    # 截图自动保存为文件\n    screenshot = session.screenshot()\n```\n\n资料来源：[packages/notte-sdk/src/notte_sdk/endpoints/sessions.py:80-95]()\n\n## 快速开始\n\n### 安装与配置\n\n确保已安装 notte-sdk：\n\n```bash\npip install notte-sdk\n```\n\n### 上传文件\n\n```python\nfrom notte_sdk import NotteClient\n\nclient = NotteClient()\nfiles = client.files\n\n# 上传本地文件\nwith open(\"document.pdf\", \"rb\") as f:\n    file_data = files.upload(\n        name=\"document.pdf\",\n        content=f.read(),\n        mime_type=\"application/pdf\"\n    )\n    print(f\"文件已上传，ID: {file_data.id}\")\n```\n\n### 下载文件\n\n```python\n# 通过文件 ID 下载\ncontent = files.download(file_id=\"abc123\")\nwith open(\"output.pdf\", \"wb\") as f:\n    f.write(content)\n```\n\n### 列出文件\n\n```python\n# 列出所有已存储的文件\nall_files = files.list()\nfor file in all_files:\n    print(f\"{file.id}: {file.name} ({file.size} bytes)\")\n```\n\n资料来源：[docs/src/snippets/file-storage/quickstart.mdx:1-50]()\n\n## 错误处理\n\n文件存储系统定义了以下专用错误类型：\n\n### StorageError\n\n基础存储错误类，所有存储相关异常都继承于此。\n\n### FileNotFoundError\n\n当请求的文件不存在时抛出：\n\n```python\nclass FileNotFoundError(NotteBaseError):\n    def __init__(self, file_id: str) -> None:\n        super().__init__(\n            dev_message=f\"File with id {file_id} not found in storage\",\n            agent_message=f\"Unable to access file\",\n            user_message=\"The requested file could not be found\"\n        )\n```\n\n### StorageQuotaExceededError\n\n存储配额超限时的异常。\n\n资料来源：[packages/notte-core/src/notte_core/storage.py:30-60]()\n\n## 最佳实践\n\n### 文件管理策略\n\n1. **定期清理**：定期调用 `delete` 方法清理不再需要的文件\n2. **批量操作**：使用 `list` 方法获取文件列表后进行批量筛选\n3. **命名规范**：为文件指定清晰的 `name` 便于识别\n\n### 性能优化\n\n- 大文件建议分块上传\n- 图片资源优先使用 `url` 引用而非直接存储 `content`\n- 敏感文件使用 Vault 加密存储\n\n## 相关模块\n\n| 模块 | 路径 | 说明 |\n|------|------|------|\n| `SessionsEndpoint` | `packages/notte-sdk/src/notte_sdk/endpoints/sessions.py` | 会话管理，包含文件相关的 cookie 存储 |\n| `StructuredData` | `packages/notte-core/src/notte_core/data/space.py` | 结构化数据存储 |\n| `ImageData` | `packages/notte-core/src/notte_core/data/space.py` | 图片数据管理 |\n| `Vault` | `packages/notte-core/src/notte_core/vault.py` | 敏感文件加密存储 |\n\n---\n\n---\n\n## Doramagic 踩坑日志\n\n项目：nottelabs/notte\n\n摘要：发现 14 个潜在踩坑项，其中 0 个为 high/blocking；最高优先级：安装坑 - 来源证据：v1.8.8。\n\n## 1. 安装坑 · 来源证据：v1.8.8\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：v1.8.8\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_5224b46e2312471c976888e8a2f8f4a6 | https://github.com/nottelabs/notte/releases/tag/v1.8.8 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 2. 配置坑 · 来源证据：v1.8.13\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.13\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_56505da48cd74758ab7a9a1d82092e18 | https://github.com/nottelabs/notte/releases/tag/v1.8.13 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 3. 配置坑 · 来源证据：v1.8.14\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.14\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_8f78a2591cea4f5aad8bfa0cb0ea15a0 | https://github.com/nottelabs/notte/releases/tag/v1.8.14 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 4. 配置坑 · 来源证据：v1.8.15\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.15\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_f611f1d0dd2440af8e84e9544ab1bdb6 | https://github.com/nottelabs/notte/releases/tag/v1.8.15 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 5. 配置坑 · 来源证据：v1.8.6\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.6\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_0ed3c86ff7a34e5896a4daeb75552d4d | https://github.com/nottelabs/notte/releases/tag/v1.8.6 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 6. 配置坑 · 来源证据：v1.8.9\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.9\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_6195971390e8494f88083c862aef7eb6 | https://github.com/nottelabs/notte/releases/tag/v1.8.9 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 7. 能力坑 · 能力判断依赖假设\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：README/documentation is current enough for a first validation pass.\n- 对用户的影响：假设不成立时，用户拿不到承诺的能力。\n- 建议检查：将假设转成下游验证清单。\n- 防护动作：假设必须转成验证项；没有验证结果前不能写成事实。\n- 证据：capability.assumptions | github_repo:900152988 | https://github.com/nottelabs/notte | README/documentation is current enough for a first validation pass.\n\n## 8. 运行坑 · 来源证据：v1.8.7\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个运行相关的待验证问题：v1.8.7\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_ab102ac99c2441118475601c34ab0ee9 | https://github.com/nottelabs/notte/releases/tag/v1.8.7 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 9. 维护坑 · 维护活跃度未知\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：未记录 last_activity_observed。\n- 对用户的影响：新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。\n- 建议检查：补 GitHub 最近 commit、release、issue/PR 响应信号。\n- 防护动作：维护活跃度未知时，推荐强度不能标为高信任。\n- 证据：evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | last_activity_observed missing\n\n## 10. 安全/权限坑 · 下游验证发现风险项\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：下游已经要求复核，不能在页面中弱化。\n- 建议检查：进入安全/权限治理复核队列。\n- 防护动作：下游风险存在时必须保持 review/recommendation 降级。\n- 证据：downstream_validation.risk_items | github_repo:900152988 | https://github.com/nottelabs/notte | no_demo; severity=medium\n\n## 11. 安全/权限坑 · 存在安全注意事项\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：No sandbox install has been executed yet; downstream must verify before user use.\n- 对用户的影响：用户安装前需要知道权限边界和敏感操作。\n- 建议检查：转成明确权限清单和安全审查提示。\n- 防护动作：安全注意事项必须面向用户前置展示。\n- 证据：risks.safety_notes | github_repo:900152988 | https://github.com/nottelabs/notte | No sandbox install has been executed yet; downstream must verify before user use.\n\n## 12. 安全/权限坑 · 存在评分风险\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：风险会影响是否适合普通用户安装。\n- 建议检查：把风险写入边界卡，并确认是否需要人工复核。\n- 防护动作：评分风险必须进入边界卡，不能只作为内部分数。\n- 证据：risks.scoring_risks | github_repo:900152988 | https://github.com/nottelabs/notte | no_demo; severity=medium\n\n## 13. 维护坑 · issue/PR 响应质量未知\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：issue_or_pr_quality=unknown。\n- 对用户的影响：用户无法判断遇到问题后是否有人维护。\n- 建议检查：抽样最近 issue/PR，判断是否长期无人处理。\n- 防护动作：issue/PR 响应未知时，必须提示维护风险。\n- 证据：evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | issue_or_pr_quality=unknown\n\n## 14. 维护坑 · 发布节奏不明确\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：release_recency=unknown。\n- 对用户的影响：安装命令和文档可能落后于代码，用户踩坑概率升高。\n- 建议检查：确认最近 release/tag 和 README 安装命令是否一致。\n- 防护动作：发布节奏未知或过期时，安装说明必须标注可能漂移。\n- 证据：evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | release_recency=unknown\n\n<!-- canonical_name: nottelabs/notte; human_manual_source: deepwiki_human_wiki -->\n",
      "summary": "DeepWiki/Human Wiki 完整输出，末尾追加 Discovery Agent 踩坑日志。",
      "title": "Human Manual / 人类版说明书"
    },
    "pitfall_log": {
      "asset_id": "pitfall_log",
      "filename": "PITFALL_LOG.md",
      "markdown": "# Pitfall Log / 踩坑日志\n\n项目：nottelabs/notte\n\n摘要：发现 14 个潜在踩坑项，其中 0 个为 high/blocking；最高优先级：安装坑 - 来源证据：v1.8.8。\n\n## 1. 安装坑 · 来源证据：v1.8.8\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：v1.8.8\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_5224b46e2312471c976888e8a2f8f4a6 | https://github.com/nottelabs/notte/releases/tag/v1.8.8 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 2. 配置坑 · 来源证据：v1.8.13\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.13\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_56505da48cd74758ab7a9a1d82092e18 | https://github.com/nottelabs/notte/releases/tag/v1.8.13 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 3. 配置坑 · 来源证据：v1.8.14\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.14\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_8f78a2591cea4f5aad8bfa0cb0ea15a0 | https://github.com/nottelabs/notte/releases/tag/v1.8.14 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 4. 配置坑 · 来源证据：v1.8.15\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.15\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_f611f1d0dd2440af8e84e9544ab1bdb6 | https://github.com/nottelabs/notte/releases/tag/v1.8.15 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 5. 配置坑 · 来源证据：v1.8.6\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.6\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_0ed3c86ff7a34e5896a4daeb75552d4d | https://github.com/nottelabs/notte/releases/tag/v1.8.6 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 6. 配置坑 · 来源证据：v1.8.9\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：v1.8.9\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_6195971390e8494f88083c862aef7eb6 | https://github.com/nottelabs/notte/releases/tag/v1.8.9 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 7. 能力坑 · 能力判断依赖假设\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：README/documentation is current enough for a first validation pass.\n- 对用户的影响：假设不成立时，用户拿不到承诺的能力。\n- 建议检查：将假设转成下游验证清单。\n- 防护动作：假设必须转成验证项；没有验证结果前不能写成事实。\n- 证据：capability.assumptions | github_repo:900152988 | https://github.com/nottelabs/notte | README/documentation is current enough for a first validation pass.\n\n## 8. 运行坑 · 来源证据：v1.8.7\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个运行相关的待验证问题：v1.8.7\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_ab102ac99c2441118475601c34ab0ee9 | https://github.com/nottelabs/notte/releases/tag/v1.8.7 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 9. 维护坑 · 维护活跃度未知\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：未记录 last_activity_observed。\n- 对用户的影响：新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。\n- 建议检查：补 GitHub 最近 commit、release、issue/PR 响应信号。\n- 防护动作：维护活跃度未知时，推荐强度不能标为高信任。\n- 证据：evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | last_activity_observed missing\n\n## 10. 安全/权限坑 · 下游验证发现风险项\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：下游已经要求复核，不能在页面中弱化。\n- 建议检查：进入安全/权限治理复核队列。\n- 防护动作：下游风险存在时必须保持 review/recommendation 降级。\n- 证据：downstream_validation.risk_items | github_repo:900152988 | https://github.com/nottelabs/notte | no_demo; severity=medium\n\n## 11. 安全/权限坑 · 存在安全注意事项\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：No sandbox install has been executed yet; downstream must verify before user use.\n- 对用户的影响：用户安装前需要知道权限边界和敏感操作。\n- 建议检查：转成明确权限清单和安全审查提示。\n- 防护动作：安全注意事项必须面向用户前置展示。\n- 证据：risks.safety_notes | github_repo:900152988 | https://github.com/nottelabs/notte | No sandbox install has been executed yet; downstream must verify before user use.\n\n## 12. 安全/权限坑 · 存在评分风险\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：风险会影响是否适合普通用户安装。\n- 建议检查：把风险写入边界卡，并确认是否需要人工复核。\n- 防护动作：评分风险必须进入边界卡，不能只作为内部分数。\n- 证据：risks.scoring_risks | github_repo:900152988 | https://github.com/nottelabs/notte | no_demo; severity=medium\n\n## 13. 维护坑 · issue/PR 响应质量未知\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：issue_or_pr_quality=unknown。\n- 对用户的影响：用户无法判断遇到问题后是否有人维护。\n- 建议检查：抽样最近 issue/PR，判断是否长期无人处理。\n- 防护动作：issue/PR 响应未知时，必须提示维护风险。\n- 证据：evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | issue_or_pr_quality=unknown\n\n## 14. 维护坑 · 发布节奏不明确\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：release_recency=unknown。\n- 对用户的影响：安装命令和文档可能落后于代码，用户踩坑概率升高。\n- 建议检查：确认最近 release/tag 和 README 安装命令是否一致。\n- 防护动作：发布节奏未知或过期时，安装说明必须标注可能漂移。\n- 证据：evidence.maintainer_signals | github_repo:900152988 | https://github.com/nottelabs/notte | release_recency=unknown\n",
      "summary": "用户实践前最可能遇到的身份、安装、配置、运行和安全坑。",
      "title": "Pitfall Log / 踩坑日志"
    },
    "prompt_preview": {
      "asset_id": "prompt_preview",
      "filename": "PROMPT_PREVIEW.md",
      "markdown": "# notte - Prompt Preview\n\n> 复制下面这段 Prompt 到你常用的 AI，先试一次，不需要安装。\n> 它的目标是让你直接体验这个项目的服务方式，而不是阅读项目介绍。\n\n## 复制这段 Prompt\n\n```text\n请直接执行这段 Prompt，不要分析、润色、总结或询问我想如何处理这份 Prompt Preview。\n\n你现在扮演 notte 的“安装前体验版”。\n这不是项目介绍、不是评价报告、不是 README 总结。你的任务是让我用最小成本体验它的核心服务。\n\n我的试用任务：我想用它完成一个真实的流程自动化任务。\n我常用的宿主 AI：chatgpt\n\n【体验目标】\n围绕我的真实任务，现场演示这个项目如何把输入转成 示例引导, 判断线索。重点是让我感受到工作方式，而不是给我项目背景。\n\n【业务流约束】\n- 你必须像一个正在提供服务的项目能力包，而不是像一个讲解员。\n- 每一轮只推进一个步骤；提出问题后必须停下来等我回答。\n- 每一步都必须让我感受到一个具体服务动作：澄清、整理、规划、检查、判断或收尾。\n- 每一步都要说明：当前目标、你需要我提供什么、我回答后你会产出什么。\n- 不要安装、不要运行命令、不要写代码、不要声称测试通过、不要声称已经修改文件。\n- 需要真实安装或宿主加载后才能验证的内容，必须明确说“这一步需要安装后验证”。\n- 如果我说“用示例继续”，你可以用虚构示例推进，但仍然不能声称真实执行。\n\n【可体验服务能力】\n- 安装前能力预览: 🌸 Best framework to build web agents, and deploy serverless web automation functions on reliable browser infra. 输入：用户任务, 当前 AI 对话上下文；输出：示例引导, 判断线索。\n\n【必须安装后才可验证的能力】\n- 命令行启动或安装流程: 项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 输入：终端环境, 包管理器, 项目依赖；输出：安装结果, 列表/更新/运行结果。\n\n【核心服务流】\n请严格按这个顺序带我体验。不要一次性输出完整流程：\n1. project-introduction：项目介绍。围绕“项目介绍”模拟一次用户任务，不展示安装或运行结果。\n2. quickstart-guide：快速入门指南。围绕“快速入门指南”模拟一次用户任务，不展示安装或运行结果。\n3. package-structure：包结构分析。围绕“包结构分析”模拟一次用户任务，不展示安装或运行结果。\n4. core-modules：核心模块实现。围绕“核心模块实现”模拟一次用户任务，不展示安装或运行结果。\n5. agent-implementation：Agent实现与生命周期。围绕“Agent实现与生命周期”模拟一次用户任务，不展示安装或运行结果。\n\n【核心能力体验剧本】\n每一步都必须按“输入 -> 服务动作 -> 中间产物”执行。不要只说流程名：\n1. project-introduction\n输入：用户提供的“项目介绍”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n2. quickstart-guide\n输入：用户提供的“快速入门指南”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n3. package-structure\n输入：用户提供的“包结构分析”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n4. core-modules\n输入：用户提供的“核心模块实现”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n5. agent-implementation\n输入：用户提供的“Agent实现与生命周期”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n【项目服务规则】\n这些规则决定你如何服务用户。不要解释规则本身，而要在每一步执行时遵守：\n- 先确认用户任务、输入材料和成功标准，再模拟项目能力。\n- 每一步都必须形成可检查的小产物，并等待用户确认后再继续。\n- 凡是需要安装、调用工具或访问外部服务的能力，都必须标记为安装后验证。\n\n【每一步的服务约束】\n- Step 1 / project-introduction：Step 1 必须围绕“项目介绍”形成一个小中间产物，并等待用户确认。\n- Step 2 / quickstart-guide：Step 2 必须围绕“快速入门指南”形成一个小中间产物，并等待用户确认。\n- Step 3 / package-structure：Step 3 必须围绕“包结构分析”形成一个小中间产物，并等待用户确认。\n- Step 4 / core-modules：Step 4 必须围绕“核心模块实现”形成一个小中间产物，并等待用户确认。\n- Step 5 / agent-implementation：Step 5 必须围绕“Agent实现与生命周期”形成一个小中间产物，并等待用户确认。\n\n【边界与风险】\n- 不要声称已经安装、运行、调用 API、读写本地文件或完成真实任务。\n- 安装前预览只能展示工作方式，不能证明兼容性、性能或输出质量。\n- 涉及安装、插件加载、工具调用或外部服务的能力必须安装后验证。\n\n【可追溯依据】\n这些路径只用于你内部校验或在我追问“依据是什么”时简要引用。不要在首次回复主动展开：\n- https://github.com/nottelabs/notte\n- https://github.com/nottelabs/notte#readme\n- README.md\n- pyproject.toml\n- docs/setup.md\n- docs/sdk_tutorial.md\n- .env.example\n- packages/notte-core/pyproject.toml\n- packages/notte-browser/pyproject.toml\n- packages/notte-agent/pyproject.toml\n- packages/notte-sdk/pyproject.toml\n- packages/notte-llm/pyproject.toml\n\n【首次问题规则】\n- 首次三问必须先确认用户目标、成功标准和边界，不要提前进入工具、安装或实现细节。\n- 如果后续需要技术条件、文件路径或运行环境，必须等用户确认目标后再追问。\n\n首次回复必须只输出下面 4 个部分：\n1. 体验开始：用 1 句话说明你将带我体验 notte 的核心服务。\n2. 当前步骤：明确进入 Step 1，并说明这一步要解决什么。\n3. 你会如何服务我：说明你会先改变我完成任务的哪个动作。\n4. 只问我 3 个问题，然后停下等待回答。\n\n首次回复禁止输出：后续完整流程、证据清单、安装命令、项目评价、营销文案、已经安装或运行的说法。\n\nStep 1 / brainstorming 的二轮协议：\n- 我回答首次三问后，你仍然停留在 Step 1 / brainstorming，不要进入 Step 2。\n- 第二次回复必须产出 6 个部分：澄清后的任务定义、成功标准、边界条件、\n  2-3 个可选方案、每个方案的权衡、推荐方案。\n- 第二次回复最后必须问我是否确认推荐方案；只有我明确确认后，才能进入下一步。\n- 第二次回复禁止输出 git worktree、代码计划、测试文件、命令或真实执行结果。\n\n后续对话规则：\n- 我回答后，你先完成当前步骤的中间产物并等待确认；只有我确认后，才能进入下一步。\n- 每一步都要生成一个小的中间产物，例如澄清后的目标、计划草案、测试意图、验证清单或继续/停止判断。\n- 所有演示都写成“我会建议/我会引导/这一步会形成”，不要写成已经真实执行。\n- 不要声称已经测试通过、文件已修改、命令已运行或结果已产生。\n- 如果某个能力必须安装后验证，请直接说“这一步需要安装后验证”。\n- 如果证据不足，请明确说“证据不足”，不要补事实。\n```\n",
      "summary": "不安装项目也能感受能力节奏的安全试用 Prompt。",
      "title": "Prompt Preview / 安装前试用 Prompt"
    },
    "quick_start": {
      "asset_id": "quick_start",
      "filename": "QUICK_START.md",
      "markdown": "# Quick Start / 官方入口\n\n项目：nottelabs/notte\n\n## 官方安装入口\n\n### Python / pip · 官方安装入口\n\n```bash\npip install notte\n```\n\n来源：https://github.com/nottelabs/notte#readme\n\n## 来源\n\n- repo: https://github.com/nottelabs/notte\n- docs: https://github.com/nottelabs/notte#readme\n",
      "summary": "从项目官方 README 或安装文档提取的开工入口。",
      "title": "Quick Start / 官方入口"
    }
  },
  "validation_id": "dval_ee6e6f447d8946f9a39f3a30f16f1c16"
}
