agent
从自然语言提示词出发的自主研究与提取,无需提供 URL。智能体自行规划步骤、自行寻找并阅读信息源,并在你设定的 maxSteps 与 maxUrls 硬性上限内给出答案。
使用场景
开放式研究
回答那些跨越你尚未确定站点的问题——智能体自己发现信息源,而不是接收一份 URL 列表。
竞品快照
询问竞争对手当前的定价档位或功能集,得到综合后的答案,而不是一堆原始 HTML。
有边界的自主性
maxSteps(硬性上限 10)和 maxUrls(硬性上限 20)约束每次运行,因此绝不会抓取超出你设定的预算。
机器可读的答案
当结果要送入下游系统而非供人阅读时,传入 schema,智能体便返回结构化对象而非散文。
Endpoint
/api/v1/tools/agentParameters
maxSteps(硬性上限 10)和 maxUrls(硬性上限 20)由工具强制执行,不是传给模型的建议。单次运行可能超过 REST API 约 50 秒的窗口(底层工具允许最多 120s),因此在 REST 上请把两者都设小——或把耗时较长的任务以及 pro 模型放到 CrawlForge MCP 服务器上运行。| Name | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Required | - | 智能体要回答的自然语言任务或问题。1 到 2000 个字符。 Example: Find the current pricing tiers for the top 3 MCP web-scraping providers |
urls | array | Optional | - | 可选的种子 URL,纳入本次运行——智能体仍会在这些之外自行发现信息源。最多 20 个。 Example: ["https://example.com/pricing"] |
schema | object | Optional | - | 可选的 JSON 模式。提供后,`answer` 会返回结构化对象而非散文。 |
model | string | Optional | "default" | `default` 运行内置的规划循环。`pro` 会被 **REST API 拒绝**——它需要交互式确认,因此请在 CrawlForge MCP 服务器上运行 pro。 Example: default |
maxSteps | number | Optional | 5 | 智能体可运行的最大抓取迭代次数。硬性上限 10。 Example: 5 |
maxUrls | number | Optional | 10 | 智能体可抓取的最大 URL 数量。硬性上限 20。 Example: 10 |
请求示例
cURL
curl -X POST https://crawlforge.dev/api/v1/tools/agent \
-H "X-API-Key: cf_test_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Find the current pricing tiers for the top 3 MCP web-scraping providers",
"maxSteps": 5,
"maxUrls": 10
}'TypeScript
// npm install crawlforge-sdk
import { CrawlForge } from 'crawlforge-sdk';
const client = new CrawlForge({ apiKey: process.env.CRAWLFORGE_API_KEY });
const result = await client.agent({
prompt: 'Find the current pricing tiers for the top 3 MCP web-scraping providers',
maxSteps: 5, // fetch iterations, hard cap 10
maxUrls: 10, // URLs to fetch, hard cap 20
// Optional: seed the run with URLs you already trust (max 20)
// urls: ['https://example.com/pricing'],
// Optional: pass a JSON schema to get a structured answer instead of prose
// schema: { type: 'object', properties: { /* ... */ } },
});
// result.data is untyped in crawlforge-sdk 0.1 — its shape is the Response Example below.
const { answer, steps_taken, sources } = result.data as {
answer: string; steps_taken: number; sources: { url: string; title: string }[];
};
console.log('Answer:', answer);
console.log('Steps taken:', steps_taken);
console.log('Sources read:', sources);
console.log('Credits used:', result.creditsUsed);
console.log('Credits remaining:', result.creditsRemaining);Python
# pip install crawlforge
from crawlforge import CrawlForge
client = CrawlForge() # reads CRAWLFORGE_API_KEY
result = client.agent(
prompt='Find the current pricing tiers for the top 3 MCP web-scraping providers',
maxSteps=5, # fetch iterations, hard cap 10
maxUrls=10, # URLs to fetch, hard cap 20
# Optional: seed the run with URLs you already trust (max 20)
# urls=['https://example.com/pricing'],
# Optional: pass a JSON schema to get a structured answer instead of prose
# schema={'type': 'object', 'properties': {}},
)
# result.data is a plain dict — its shape is the Response Example below.
print(f"Answer: {result.data['answer']}")
print(f"Steps taken: {result.data['steps_taken']}")
print(f"Sources read: {result.data['sources']}")
print(f"Credits used: {result.credits_used}")
print(f"Credits remaining: {result.credits_remaining}")响应示例
{ "success": true, "data": { "answer": "## Pricing comparison\n\n- **CrawlForge** — Free (1,000 credits), Hobby $19/mo, Professional $99/mo...", "sources": [ { "url": "https://example.com/pricing", "title": "Example — Pricing" }, { "url": "https://example.org/plans", "title": "Example Org — Plans" } ], "steps_taken": 3, "urls_fetched": 5 }, "credits_used": 8, "credits_remaining": 992, "processing_time": 13820}data.answer综合得出的答案——默认为散文,传入 `schema` 时为结构化对象data.sources智能体在作答过程中读取的全部信息源——可用于审计来源data.steps_taken本次运行实际使用的抓取迭代次数data.urls_fetched智能体在作答过程中抓取的 URL 数量credits_used本次运行扣除的 credits(每次运行 8 credits,与步骤数无关)credits_remaining你剩余的 credits 余额错误处理
输入无效(400 Bad Request)
prompt 缺失或不在 1 到 2000 个字符范围内,maxSteps/maxUrls 超出范围,或 model 设为了 pro——REST API 会拒绝它,因为它需要交互式确认。
智能体运行失败(500 Internal Server Error)
本次运行无法完成。失败的运行不扣除 credits——请用更聚焦的提示词或更小的 maxSteps 重试。
credits 不足(402 Payment Required)
你的账户 credits 不足。购买更多 credits 或升级你的计划。
超出速率限制(429 Too Many Requests)
你已超出所在计划的速率限制。稍等片刻,或升级你的计划以获得更高上限。
maxSteps 和 maxUrls 设小;耗时较长的运行或 pro 模型请使用 CrawlForge MCP 服务器。credits 成本
Free 计划: 1,000 个一次性 credits = 125 次运行
Hobby 计划: 每月 5,000 credits = 625 次运行(19 美元/月)
Professional 计划: 每月 50,000 credits = 6,250 次运行(99 美元/月)
Business 计划: 每月 250,000 credits = 31,250 次运行(399 美元/月)