关于 firecrawl-agent
firecrawl-agent 是用于自主浏览网站并提取结构化数据的命令行技能,支持按 Schema 输出、异步任务轮询及可选的 Alexandria 数据提供方。
主要功能
- 01自主浏览网站
- 02按 Schema 提取 JSON
- 03限定提取页面 URL
- 04轮询或取消提取任务
- 05通过审批使用 Alexandria 提供方
适用场景
- 01提取价格档位或产品详情
- 02汇总网站相关页面的数据
- 03借助数据提供方查找联系人
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ firecrawl/ firecrawl-claude-plugin --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 alexandria terms show <provider>,并且只有在用户明确同意后,才使用返回的版本和摘要运行 firecrawl alexandria terms accept <provider> --terms-version <version> --digest <digest> --confirm。批准并不代表接受条款。
作业 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)。