关于 firecrawl-agent
firecrawl-agent 是用于自主浏览网站并提取结构化数据的命令行技能,支持按 Schema 输出 JSON、指定目标页面和轮询任务,也可选用 Alexandria 数据提供方。
主要功能
- 01自主浏览网站并提取数据
- 02按 Schema 输出 JSON
- 03指定目标 URL 提取
- 04轮询或取消异步任务
- 05可选 Alexandria 数据提供方
适用场景
- 01提取定价档位或产品信息
- 02汇总指定页面的数据
- 03提交长任务并稍后轮询
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ firecrawl/ cli --skill firecrawl-agent安装后在 Claude Code 中输入/firecrawl-agent确认已加载。
详细介绍
firecrawl agent
AI 驱动的自主提取。Agent 会浏览网站并提取结构化数据(耗时 2-5 分钟)。
开始自主提取结构化记录或列表之前,先检查 firecrawl search alexandria '<data you need>',看看是否有现成的工作流或数据提供方。使用 firecrawl list <provider> <capability> --pretty 检查匹配的契约;如果契约涵盖了任务,则使用 firecrawl scrape --alexandria <provider>/<capability> --options '<input JSON>' 执行。请使用契约中完全一致的提供方、能力和输入字段。没有合适的工具,或任务需要自主浏览时,再使用 Agent。
快速开始
# Extract structured data
firecrawl agent "extract all pricing tiers" --wait --json -o .firecrawl/pricing.json
# With a JSON schema for structured output
firecrawl agent "extract products" --schema '{"type":"object","properties":{"name":{"type":"string"},"price":{"type":"number"}}}' --wait --json -o .firecrawl/products.json
# Focus on specific pages
firecrawl agent "get feature list" --urls "<url>" --wait --json -o .firecrawl/features.json
运行 firecrawl agent --help 查看完整选项列表。
完成条件: 输出文件包含可回答请求的有效 JSON,或有意返回了用于后续轮询的作业 ID。
Alexandria 提供方
只有在运行开始时使用 Alexandria 标志,才会使用已连接的 Alexandria 数据提供方:--alexandria、--toolkits <slugs>(最多 5 个)、--max-calls <n>、--require-approval 或 --on-terms-required skip|ask。在该线程中的后续操作会保留这些设置。
firecrawl agent "find the head of sales at <company>" --toolkits apollo,crunchbase --wait --json -o .firecrawl/contacts.json
使用 --require-approval(需要 --mode chat)时,运行可能以 pendingApproval 结束,而不会发起付费调用。请先询问用户,然后在同一线程中使用 firecrawl agent "<follow-up prompt>" --thread <threadId> --mode chat --approve <approvalId>(或 --decline <approvalId>)作答。terms 审批只有在组织管理员于 Firecrawl 控制面板接受提供方条款后才会继续;请向用户提供 https://www.firecrawl.dev/app/settings?tab=data-sources,如果他们想先查看条款,请使用 firecrawl alexandria terms show <provider>。批准并不代表接受条款。
作业 ID
省略 --wait 会返回作业 ID。UUID 位置参数会自动识别为状态检查:
# Check once (equivalent to adding --status)
firecrawl agent "<job-id>"
# Wait on an existing job, polling every 10 seconds for up to 5 minutes
firecrawl agent "<job-id>" --wait --poll-interval 10 --timeout 300
# Cancel an active job
firecrawl agent "<job-id>" --cancel
提示
- 使用
--wait获取内联结果;只有在想稍后通过轮询获取作业 ID 时才省略此选项(参见作业 ID)。 - 使用
--schema获取可预测的结构化输出;否则 Agent 会返回自由格式的数据。 - Agent 运行消耗的额度多于简单抓取。使用
--max-credits限制开销。 - 对于简单的单页提取,优先使用
scrape,速度更快、成本更低。
另请参阅
- firecrawl-scrape — 更简单的单页提取
- firecrawl-interact — 抓取 + 交互,用于手动与页面交互(控制更精细)
- firecrawl-crawl — 无需 AI 的批量提取
- firecrawl-build-scrape — 将结构化提取构建到应用中,而不是在此处运行
Alexandria 会话反馈
若要报告 Alexandria 会话结果或提供方/能力缺口,请使用 firecrawl alexandria feedback --rating good|partial|bad --url <website> --requested-functionality '<what was needed>' --objective '<the underlying goal of the task>' --rationale '<what happened>' --json。请在说明中使用实际观察到的结果。无需作业 ID;请在最近一次 Alexandria 搜索、发现或执行后的 20 分钟内提交,否则会被拒绝。每次提交会退还 1 个额度,每个网站最多 10 个,每个团队每天(UTC)最多 100 个。可选的 --provider-feedback 和 --capability-feedback JSON 数组可用于描述具体缺口;请运行 firecrawl alexandria feedback --help 查看其字段。提供方存在但缺少所需能力时,请使用能力问题 missing_capability;需要申请新能力时,请使用 new_capability_request(并提供 requestedFunctionality)。