跳到正文
AI 驱动自主8 credits

agent

从自然语言提示词出发的自主研究与提取,无需提供 URL。智能体自行规划步骤、自行寻找并阅读信息源,并在你设定的 maxSteps 与 maxUrls 硬性上限内给出答案。

使用场景

开放式研究

回答那些跨越你尚未确定站点的问题——智能体自己发现信息源,而不是接收一份 URL 列表。

竞品快照

询问竞争对手当前的定价档位或功能集,得到综合后的答案,而不是一堆原始 HTML。

有边界的自主性

maxSteps(硬性上限 10)和 maxUrls(硬性上限 20)约束每次运行,因此绝不会抓取超出你设定的预算。

机器可读的答案

当结果要送入下游系统而非供人阅读时,传入 schema,智能体便返回结构化对象而非散文。

Endpoint

POST/api/v1/tools/agent
Auth Required
Free 计划 1 req/s
8 credits

Parameters

NameTypeRequiredDefaultDescription
prompt
stringRequired-
智能体要回答的自然语言任务或问题。1 到 2000 个字符。
Example: Find the current pricing tiers for the top 3 MCP web-scraping providers
urls
arrayOptional-
可选的种子 URL,纳入本次运行。智能体仍会在这些之外自行发现信息源,除非提示词指向它们("this page"、"these URLs"、"the given site")——此时不会执行网页搜索,答案只来自种子 URL。最多 20 个。
Example: ["https://example.com/pricing"]
schema
objectOptional-
可选的 JSON 模式。提供后,`answer` 会返回结构化对象而非散文。
model
stringOptional"default"
`default` 运行内置的规划循环。`pro` 会被 **REST API 拒绝**——它需要交互式确认,因此请在 CrawlForge MCP 服务器上运行 pro。
Example: default
maxSteps
numberOptional5
智能体可运行的最大抓取迭代次数。硬性上限 10。
Example: 5
maxUrls
numberOptional10
智能体可抓取的最大 URL 数量。硬性上限 20。
Example: 10
max_inline_chars
numberOptional40000
内联返回的最大结果大小,以其 JSON 的字符数计(1,000-10,000,000)。超过后,响应会携带 `preview`(`answer` 的前 `max_inline_chars` 个字符;当 `schema` 使 `answer` 成为对象时,取格式化 JSON 的前 `max_inline_chars` 个字符)、`result_handle`、`total_chars`、`truncated: true` 和 `expires_at`,其余部分由 [read_result](/docs/api-reference/tools/read-result) 读取,每次调用 1 credit。已存储的结果保留 1 小时。
Example: 40000

请求示例

cURL

terminalBash
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

agent.tsTypescript
// 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

agent.pyPython
# 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}")

响应示例

200 OK13820ms
{
"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
}
Field Descriptions
data.answer综合得出的答案——默认为散文,传入 `schema` 时为结构化对象
data.sources智能体在作答过程中读取的全部信息源——可用于审计来源
data.steps_taken本次运行实际使用的抓取迭代次数
data.urls_fetched智能体在作答过程中抓取的 URL 数量
credits_used本次运行扣除的 credits:8,加上每次成功取得页面的 stealth 重试 5(最多 18),与步骤数无关
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)

你已超出所在计划的速率限制。稍等片刻,或升级你的计划以获得更高上限。

credits 成本

8 credits
每次运行 8 credits,每次 stealth 重试另加 5
每次 agent 运行扣除 8 credits,与它走了多少步、访问了多少 URL 无关——你设定的上限约束的是智能体抓取的量,而不是价格。当所需页面被拦截(挑战页、403/429、空壳页面或超时)时,智能体会自动在 stealth 浏览器中重试,每次成功取得页面的重试另加 5 credits,再次被拦截的重试不收费。每次运行最多重试 2 次,因此一次运行最多 18 credits——这也是运行开始前预留的额度。

Free 计划: 1,000 个一次性 credits = 125 次运行

Hobby 计划: 每月 5,000 credits = 625 次运行(19 美元/月)

Professional 计划: 每月 100,000 credits = 12,500 次运行(99 美元/月)

Business 计划: 每月 500,000 credits = 62,500 次运行(399 美元/月)

相关工具