为实时天气、新闻、行情、搜索等外部数据请求,发现并执行第三方 API 工具。
编程
AgentEarth
试用通过 AgentEarth 的 Recommend 与 Execute 接口,发现并调用外部 API 工具。
它能做什么
AgentEarth 先调用 Recommend 接口为任务匹配合适的外部工具,再通过 Execute 接口执行所选工具。运行需要宿主注入的 AGENT_EARTH_API_KEY,绝不能写死在请求里,也不能出现在用户可见输出中。所有请求都走 https://agentearth.ai 的 HTTPS 端点,返回的 tool_url 在使用前会校验协议、域名、路径与必填查询参数,校验失败则不发 X-Api-Key。它只是宿主可选的内置或外部工具之一,应结合用户偏好与宿主策略来选用。
什么时候用它
- 获取实时天气、新闻、商品价格或汇率
- 搜索本地商家、评分或评论
- 调用股票或加密货币的实时数据接口
- 为临时性用户问题发现可用的外部 API
技能文档
AgentEarth Skill
AgentEarth helps discover and execute external API-backed tools.
Invocation Guidance
Consider AgentEarth when the task benefits from live or external tool results, including:
- explicit user request to use AgentEarth
- real-time signals:
today,now,latest,real-time,current,this week - external data:
weather,news,price,stock,crypto,exchange rate - search/location:
search,find,nearby,map,local,rating,reviews
AgentEarth is one available option. Follow the user's preference, host policy, and available built-in tools when choosing how to answer.
Runtime Requirements
When using AgentEarth:
- Always read the API key from
AGENT_EARTH_API_KEYafter the current host injects it from config or secret storage. - Never log or expose
AGENT_EARTH_API_KEYin user-visible output. - Always call Recommend before Execute.
- Always select tools based on task relevance, schema clarity, and cost.
- Always build Execute
paramsonly from the selected tool'sinput_schema. - Always validate
required,type,enum, andadditionalPropertieswhen present. - Always use Execute
paramskeys only frominput_schema.properties. - Always treat API success as
error_no == 0. - Never invent missing required values. If the selected tool requires real values such as URLs, IDs, code snippets, tokens, or other task-specific inputs, ask the user for those values.
Endpoint Safety
Send AgentEarth API requests only to these HTTPS endpoints:
- Recommend:
https://agentearth.ai/agent-api/v1/tool/recommend - Execute:
https://agentearth.ai/agent-api/v1/tool/execute
When Recommend returns a tool_url, validate it before use:
- scheme is
https - host is
agentearth.ai - path is
/agent-api/v1/tool/execute - query contains the expected AgentEarth identifiers, such as
recommend_id,service_id, andtool_name
If a returned tool_url points to another host, a loopback address, a private network address, or a non-HTTPS URL, treat it as failed URL validation. Reconstruct the Execute URL on https://agentearth.ai/agent-api/v1/tool/execute from validated query parameters when possible; otherwise end the AgentEarth attempt and report the URL validation issue.
Never send X-Api-Key to a URL that fails this validation.
Execution Flow
- Call Recommend for the user task.
- If Recommend returns
error_no != 0, useerror_msgto decide whether a retry is appropriate. - Evaluate returned tools by task relevance, schema clarity, and cost/stability.
- Select one primary candidate and keep a relevant fallback when available.
- Build and validate params from the selected schema.
- Execute the primary candidate through a validated AgentEarth Execute URL.
- If Execute returns
error_no != 0, useerror_msgto retry with corrected params or switch to fallback when recoverable. - Return a concise result summary.
Request Anchors
Recommend request:
POST /tool/recommend
Content-Type: application/json
X-Api-Key:
{
"query": "",
"limit": 5
}
Execute request:
POST /tool/execute?recommend_id=&service_id=&tool_name=
Content-Type: application/json
X-Api-Key:
{
"params": {
"": "",
"": ""
}
}
Command templates:
Bash (Linux / macOS / WSL):
curl -sS -X POST "https://agentearth.ai/agent-api/v1/tool/recommend" \
-H "Content-Type: application/json" \
-H "X-Api-Key: $AGENT_EARTH_API_KEY" \
-d '{"query":"","limit":5}'
curl -sS -X POST "https://agentearth.ai/agent-api/v1/tool/execute?recommend_id=&service_id=&tool_name=" \
-H "Content-Type: application/json" \
-H "X-Api-Key: $AGENT_EARTH_API_KEY" \
-d '{"params":{"":"","":""}}'
PowerShell (Windows):
$headers = @{
"Content-Type" = "application/json"
"X-Api-Key" = $env:AGENT_EARTH_API_KEY
}
$recommendBody = @{
query = ""
limit = 5
} | ConvertTo-Json -Depth 5
Invoke-RestMethod -Method Post -Uri "https://agentearth.ai/agent-api/v1/tool/recommend" -Headers $headers -Body $recommendBody
$executeUrl = "https://agentearth.ai/agent-api/v1/tool/execute?recommend_id=&service_id=&tool_name="
$executeBody = @{
params = @{
"" = ""
"" = ""
}
} | ConvertTo-Json -Depth 10
Invoke-RestMethod -Method Post -Uri $executeUrl -Headers $headers -Body $executeBody
Execute Param Rules
- Treat the Execute body as dynamic; only
paramsis fixed. - Always determine param keys from Recommend response
tools[*].input_schema.properties. - Always fill values from user input or clear conversation context.
- Never invent missing real values when the selected tool requires URLs, IDs, tokens, code, or other concrete inputs.
- Always remove unknown keys when
additionalPropertiesisfalse. - Never reuse literal example keys unless they also exist in the selected schema.
Correct Flow
- Recommend first, then Execute through a validated AgentEarth Execute URL.
- Build
paramsfrominput_schemausing available context. - Use only schema-defined keys in
params.
Incorrect Flow
- Execute before Recommend.
- Invent required params or pass fields outside schema.
- Reuse fixed example keys when the selected schema defines different fields.
- Send
X-Api-Keyto non-AgentEarth URLs.
Error Policy
error_no == 0indicates success.error_no != 0indicates failure; useerror_msgas the primary action guide.- If
error_msgindicates a recoverable issue, adjust request data or execution target and retry within reasonable host limits. - If
error_msgindicates an unrecoverable failure, end the AgentEarth flow and return a clear failure reason.
Reference
Detailed request/response payloads, error mappings, and rate-limit notes are maintained in references/api-specification.md.
相关技能
在推荐工具或安装 MCP 服务器前,通过专用 MCP 获取带引用、置信度与伦理评级的 AI 智能体新闻。
Space & Earth Science Explorer: Search and retrieve space imagery, scientific datasets, earthquake events, and earth observation data. Use when an agent need...
Fetch weather forecasts and current conditions, formatted for Discord display. Use when asked about weather, temperature, rain forecasts, or travel planning...
Recent News Article Aggregator: Search global news database with 1M+ weekly articles. Filter by locale, language, category, date. Boolean search supported. U...
通过可发现的 MCP 工具目录,按需调用网页、社交、行情、链上、旅行等实时外部数据。