airtop-agents
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAirtop Agents Skill
Airtop Agents 技能
You can list, run, monitor, and cancel Airtop agents using their REST API.
你可以通过REST API列出、运行、监控和取消Airtop Agent。
Authentication
身份验证
The Airtop API key is required for all operations. Resolve it in this order:
- environment variable
$AIRTOP_API_KEY - A file in this skill's directory containing
.envAIRTOP_API_KEY=... - If neither is found, offer the user two options before proceeding:
Option A — Set it up yourself (recommended if you prefer not to share your key in chat):Run these commands in your terminal:cp "$(dirname "$SKILL_PATH")/.env.example" "$(dirname "$SKILL_PATH")/.env"Then open thefile and replace.envwith your key from https://portal.airtop.ai/api-keys.your-api-key-hereOnce done, say "done" and I'll pick it up automatically.Option B — Paste it here and I'll save it for you:Paste your API key (from https://portal.airtop.ai/api-keys) and I'll write it to thefile so it's available for future use..env
Print both options exactly as above (with the actual resolved path instead of the expression) and wait for the user to choose. Do not assume a preference.
$(dirname ...)所有操作都需要Airtop API密钥,按以下顺序获取:
- 环境变量
$AIRTOP_API_KEY - 本技能目录下包含的
AIRTOP_API_KEY=...文件.env - 如果以上都未找到,在继续前向用户提供两个选项:
选项A — 自行设置(推荐,如果你不想在聊天中共享密钥):在终端中运行以下命令:cp "$(dirname "$SKILL_PATH")/.env.example" "$(dirname "$SKILL_PATH")/.env"设置完成后,回复“done”,我会自动读取密钥。选项B — 在此粘贴密钥,我会帮你保存:
请完全按照上述内容展示两个选项(将表达式替换为实际解析后的路径),然后等待用户选择,不要预设偏好。
$(dirname ...)Handling a pasted key (Option B)
处理粘贴的密钥(选项B)
Important — always load the key from the file, never use a pasted value directly.
.envWhen a user provides their API key interactively (e.g. pasting it into chat), text copied from web UIs or chat messages can contain invisible Unicode characters (zero-width spaces, byte-order marks, etc.) that silently break authentication. To avoid this:
- Write the key to first — this round-trips it through file I/O which strips invisible characters:
.envbashecho "AIRTOP_API_KEY=<pasted-value>" > "$(dirname "$SKILL_PATH")/.env" - Then read it back from the file to get a clean value:
bash
API_KEY=$(grep AIRTOP_API_KEY "$(dirname "$SKILL_PATH")/.env" | cut -d= -f2-)
Even when is already set in the environment, prefer loading from if the file exists — the environment variable may have been set in the same shell session from a pasted value and could carry the same invisible characters.
$AIRTOP_API_KEY.envNever assign a user-pasted key directly to a shell variable and use it in API calls (e.g. followed by ). Always go through the file write-then-read cycle to sanitize the value.
API_KEY="<pasted-value>"curl -H "Authorization: Bearer $API_KEY".env重要提示 — 始终从文件加载密钥,切勿直接使用粘贴的值。
.env当用户通过交互方式提供API密钥时(例如粘贴到聊天框),从网页UI或聊天消息复制的文本可能包含不可见的Unicode字符(零宽空格、字节顺序标记等),这些字符会导致身份验证静默失败。为避免此问题:
- 先将密钥写入文件 — 通过文件I/O往返处理可以去除不可见字符:
.envbashecho "AIRTOP_API_KEY=<pasted-value>" > "$(dirname "$SKILL_PATH")/.env" - 再从文件中读取 以获取干净的密钥值:
bash
API_KEY=$(grep AIRTOP_API_KEY "$(dirname "$SKILL_PATH")/.env" | cut -d= -f2-)
即使环境中已设置,如果文件存在,也优先从该文件加载 — 环境变量可能是在同一个shell会话中从粘贴的值设置的,可能包含相同的不可见字符。
$AIRTOP_API_KEY.env切勿将用户粘贴的密钥直接赋值给shell变量并用于API调用(例如后接)。始终通过写入文件再读取的流程来清理值。
API_KEY="<pasted-value>"curl -H "Authorization: Bearer $API_KEY".envLoading and validating the key
加载并验证密钥
Once the file exists (whether set up by the user or written by you), load and validate:
.envbash
API_KEY=$(grep AIRTOP_API_KEY "$(dirname "$SKILL_PATH")/.env" | cut -d= -f2-)Validate the key immediately after loading it:
bash
curl -sf -H "Authorization: Bearer ${API_KEY}" "https://api.airtop.ai/api/v2/agents?limit=1" > /dev/nullIf this returns a non-zero exit code, tell the user their API key appears invalid and link them to https://portal.airtop.ai/api-keys.
一旦文件存在(无论是用户自行设置还是由你写入),加载并验证:
.envbash
API_KEY=$(grep AIRTOP_API_KEY "$(dirname "$SKILL_PATH")/.env" | cut -d= -f2-)加载后立即验证密钥:
bash
curl -sf -H "Authorization: Bearer ${API_KEY}" "https://api.airtop.ai/api/v2/agents?limit=1" > /dev/null如果返回非零退出码,告知用户其API密钥无效,并引导他们访问https://portal.airtop.ai/api-keys。
Base URL
基础URL
All authenticated API endpoints use:
https://api.airtop.ai/apiWebhook endpoints (run agent, poll result) use the public path:
https://api.airtop.ai/api/hooks/所有需要身份验证的API端点使用:
https://api.airtop.ai/apiWebhook端点(运行Agent、轮询结果)使用公共路径:
https://api.airtop.ai/api/hooks/Argument Parsing
参数解析
Parse as follows:
$ARGUMENTSlist [--name <filter>] List agents
run <agent-name-or-id> [--vars {}] Run an agent with optional config variables
status <agentId> <invocationId> Check invocation status
cancel <agentId> <invocationId> Cancel a running invocation
history <agentId> View recent invocationsIf is empty or unrecognized, show the usage summary above and ask the user what they'd like to do.
$ARGUMENTS按以下规则解析:
$ARGUMENTSlist [--name <filter>] 列出Agent
run <agent-name-or-id> [--vars {}] 运行Agent,可附带配置变量
status <agentId> <invocationId> 检查调用状态
cancel <agentId> <invocationId> 取消正在运行的调用
history <agentId> 查看近期调用记录如果为空或无法识别,展示上述使用说明并询问用户需求。
$ARGUMENTSCommands
命令
1. List Agents
1. 列出Agent
bash
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents?limit=25&sortBy=lastRun&sortOrder=desc&createdByMe=true"Always include to show only agents owned by the current user (not the entire organization).
createdByMe=trueOptional query parameters to append:
- — case-insensitive partial match (use when
&name=<filter>is provided)--name - — filter to enabled agents only
&enabled=true - — filter to published agents only
&published=true
Display: Format the response as a markdown table with columns: Name, ID, Enabled, Last Run. Show the count in a header line.
pagination.totalExample output:
Found 3 agents:
| Name | ID | Enabled | Last Run |
|-------------------|--------------------------------------|---------|-------------|
| Price Tracker | 550e8400-e29b-41d4-a716-446655440000 | Yes | 2 hours ago |
| Lead Enricher | 6ba7b810-9dad-11d1-80b4-00c04fd430c8 | Yes | Yesterday |
| Competitor Monitor| 6ba7b811-9dad-11d1-80b4-00c04fd430c8 | No | Never |bash
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents?limit=25&sortBy=lastRun&sortOrder=desc&createdByMe=true"始终包含以仅显示当前用户拥有的Agent(而非整个组织的)。
createdByMe=true可选的查询参数:
- — 不区分大小写的部分匹配(当提供
&name=<filter>时使用)--name - — 仅筛选启用的Agent
&enabled=true - — 仅筛选已发布的Agent
&published=true
展示方式:将响应格式化为Markdown表格,列包括:名称、ID、启用状态、最后运行时间。在表头行显示的计数。
pagination.total示例输出:
找到3个Agent:
| 名称 | ID | 启用状态 | 最后运行时间 |
|-------------------|--------------------------------------|---------|-------------|
| 价格追踪器 | 550e8400-e29b-41d4-a716-446655440000 | 是 | 2小时前 |
| 线索丰富器 | 6ba7b810-9dad-11d1-80b4-00c04fd430c8 | 是 | 昨天 |
| 竞品监控器 | 6ba7b811-9dad-11d1-80b4-00c04fd430c8 | 否 | 从未运行 |2. Run Agent
2. 运行Agent
This is a multi-step process:
Step 1 — Resolve agent by name or ID.
If the argument looks like a UUID, use it directly as the agent ID. Otherwise, search by name:
bash
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents?name=$(printf '%s' '<agent-name>' | jq -sRr @uri)&createdByMe=true"- If exactly one agent matches, use it (but still validate it in Step 2).
- If multiple agents match, prefer enabled and published agents over disabled or draft-only ones. If there is still ambiguity, display them in a table (with Enabled and Published status columns) and ask the user to pick one.
- If no agents match, tell the user no agent was found and suggest running .
list
Step 2 — Validate the agent is runnable.
Fetch the full agent details (already available from step 1 if resolved by name, or fetch now):
bash
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents/<agentId>"Check the following before proceeding:
- Disabled agent (is
enabled): Tell the user the agent is disabled and cannot be run. Suggest they enable it in the Airtop portal.false - Draft-only agent (is
hasDraftANDtrueis absent): Tell the user the agent has only a draft version and has never been published. It must be published in the Airtop portal before it can be invoked via webhook.publishedVersion - Published agent with draft (is
hasDraftANDtrueis present): The agent is runnable. Note to the user that the agent has unpublished draft changes, and the published version will be used. Use thepublishedVersionvalue for the version parameter.publishedVersion - Published agent (is present,
publishedVersionishasDraft): The agent is runnable. Use thefalsevalue for the version parameter.publishedVersion
Step 3 — Check required configVars.
The agent details response includes a field. Inspect it for properties. If the user has not provided values for required configVars via , prompt them for the missing values before invoking.
versionData.configVarsSchemarequired--varsDisplay the required and optional parameters with their descriptions and defaults so the user knows what to provide.
Step 4 — Get the agent's webhook.
bash
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents/<agentId>/webhooks?limit=10"Use the first webhook from the array. If no webhooks exist, tell the user the agent needs a webhook configured in the Airtop portal (https://portal.airtop.ai).
webhooksStep 5 — Invoke the webhook.
bash
curl -s -X POST "https://api.airtop.ai/api/hooks/agents/<agentId>/webhooks/<webhookId>" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"configVars": { <user-provided key-value pairs from --vars, or empty object {}> },
"version": <publishedVersion from agent details>
}'Always use the value from the agent details as the parameter — never hardcode it.
publishedVersionversionThe response contains . Save this for polling.
{ "invocationId": "<uuid>" }Step 6 — Poll for the result.
bash
curl -s "https://api.airtop.ai/api/hooks/agents/<agentId>/invocations/<invocationId>/result" \
-H "Authorization: Bearer $API_KEY"Polling rules:
- Poll every 5 seconds
- Print a status update to the user after each poll (e.g., "Status: Running...")
- Terminal statuses: ,
Completed,FailedCancelled - Timeout after 5 minutes (60 polls). If not complete, tell the user the invocation is still running and provide the invocation ID so they can check later with the command.
status
Step 7 — Display the result.
- On : Show the
Completedfield. If it's JSON, format it nicely. If it's a string, display it directly.output - On : Show the
Failedfield and the full status.error - On : Inform the user the invocation was cancelled.
Cancelled
这是一个多步骤流程:
步骤1 — 通过名称或ID解析Agent。
如果参数看起来是UUID,直接将其作为Agent ID使用。否则,按名称搜索:
bash
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents?name=$(printf '%s' '<agent-name>' | jq -sRr @uri)&createdByMe=true"- 如果恰好匹配一个Agent,使用该Agent(但仍需在步骤2中验证)。
- 如果匹配多个Agent,优先选择已启用且已发布的Agent,而非禁用或仅草稿的Agent。如果仍有歧义,将它们以表格形式展示(包含启用状态和发布状态列),并请用户选择一个。
- 如果没有匹配的Agent,告知用户未找到,并建议运行命令。
list
步骤2 — 验证Agent是否可运行。
获取完整的Agent详情(如果是通过名称解析的,步骤1中已获取;否则现在获取):
bash
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents/<agentId>"继续之前检查以下内容:
- 禁用的Agent(为
enabled):告知用户该Agent已禁用,无法运行。建议他们在Airtop门户中启用。false - 仅草稿Agent(为
hasDraft且true不存在):告知用户该Agent只有草稿版本,从未发布。必须先在Airtop门户中发布,才能通过Webhook调用。publishedVersion - 有草稿的已发布Agent(为
hasDraft且true存在):该Agent可运行。告知用户该Agent有未发布的草稿变更,将使用已发布版本。使用publishedVersion值作为版本参数。publishedVersion - 已发布Agent(存在,
publishedVersion为hasDraft):该Agent可运行。使用false值作为版本参数。publishedVersion
步骤3 — 检查必填configVars。
Agent详情响应包含字段。检查其中的属性。如果用户未通过提供必填configVars的值,在调用前提示用户补充。
versionData.configVarsSchemarequired--vars展示必填和可选参数及其描述和默认值,方便用户了解需要提供的内容。
步骤4 — 获取Agent的Webhook。
bash
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents/<agentId>/webhooks?limit=10"使用数组中的第一个Webhook。如果没有Webhook,告知用户需要在Airtop门户(https://portal.airtop.ai)中为该Agent配置Webhook。
webhooks步骤5 — 调用Webhook。
bash
curl -s -X POST "https://api.airtop.ai/api/hooks/agents/<agentId>/webhooks/<webhookId>" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"configVars": { <用户通过--vars提供的键值对,或空对象{}> },
"version": <Agent详情中的publishedVersion>
}'始终使用Agent详情中的值作为参数 — 切勿硬编码。
publishedVersionversion响应包含。保存该ID用于轮询。
{ "invocationId": "<uuid>" }步骤6 — 轮询结果。
bash
curl -s "https://api.airtop.ai/api/hooks/agents/<agentId>/invocations/<invocationId>/result" \
-H "Authorization: Bearer $API_KEY"轮询规则:
- 每5秒轮询一次
- 每次轮询后向用户输出状态更新(例如:“状态:运行中...”)
- 终止状态包括:(完成)、
Completed(失败)、Failed(已取消)Cancelled - 5分钟后超时(60次轮询)。如果仍未完成,告知用户调用仍在运行,并提供调用ID,以便他们后续使用命令检查。
status
步骤7 — 展示结果。
- 当状态为:展示
Completed字段。如果是JSON,进行格式化展示;如果是字符串,直接显示。output - 当状态为:展示
Failed字段和完整状态。error - 当状态为:告知用户调用已取消。
Cancelled
3. Check Status
3. 检查状态
Poll a specific invocation's result:
bash
curl -s "https://api.airtop.ai/api/hooks/agents/<agentId>/invocations/<invocationId>/result" \
-H "Authorization: Bearer $API_KEY"Display the field. If terminal, also display or .
statusoutputerrorNote: This requires both the agent ID and invocation ID. If the user only provides one, ask for the other.
轮询特定调用的结果:
bash
curl -s "https://api.airtop.ai/api/hooks/agents/<agentId>/invocations/<invocationId>/result" \
-H "Authorization: Bearer $API_KEY"展示字段。如果是终止状态,同时展示或。
statusoutputerror注意:此命令需要Agent ID和调用ID。如果用户只提供了其中一个,询问另一个。
4. Cancel Invocation
4. 取消调用
bash
curl -s -X DELETE -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents/<agentId>/invocations/<invocationId>?reason=user_requested"Confirm to the user that the cancellation was requested.
bash
curl -s -X DELETE -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents/<agentId>/invocations/<invocationId>?reason=user_requested"向用户确认已请求取消调用。
5. View History
5. 查看调用记录
bash
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents/<agentId>/invocations?limit=10"Display results as a table with columns: Invocation ID, Status, Trigger, Started At.
bash
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.airtop.ai/api/v2/agents/<agentId>/invocations?limit=10"将结果以表格形式展示,列包括:调用ID、状态、触发方式、开始时间。
Error Handling
错误处理
- 401 Unauthorized: Tell the user their API key is invalid or expired. Direct them to https://portal.airtop.ai/api-keys.
- 404 Not Found: The agent or invocation doesn't exist. Suggest checking the ID or running .
list - 429 Rate Limited: Tell the user they've hit the rate limit and should wait before retrying.
- No webhook configured: Explain that the agent needs a webhook set up in the Airtop portal before it can be invoked from the CLI.
- Multiple name matches: List all matches and ask the user to pick one or use the agent ID directly.
- Empty API key: Guide the user to set or provide it interactively.
AIRTOP_API_KEY
- 401 Unauthorized:告知用户其API密钥无效或已过期。引导他们访问https://portal.airtop.ai/api-keys。
- 404 Not Found:Agent或调用不存在。建议检查ID或运行命令。
list - 429 Rate Limited:告知用户已达到速率限制,应等待后重试。
- 未配置Webhook:说明需要在Airtop门户中为Agent配置Webhook,才能从CLI调用。
- 多个名称匹配:列出所有匹配项并请用户选择一个,或直接使用Agent ID。
- API密钥为空:引导用户设置或交互式提供密钥。
AIRTOP_API_KEY
Important Notes
重要说明
- Always use (silent mode) to avoid progress bars in output.
curl -s - Parse all JSON responses with or inline JSON parsing in bash.
jq - The webhook invoke and poll endpoints are under (public path), NOT
/api/hooks/./api/v2/ - The list, webhooks, history, and cancel endpoints are under (authenticated path).
/api/v2/ - When displaying times, convert ISO timestamps to human-readable relative times (e.g., "2 hours ago").
- 始终使用(静默模式)以避免输出进度条。
curl -s - 使用或bash中的内联JSON解析来处理所有JSON响应。
jq - Webhook调用和轮询端点位于(公共路径),而非
/api/hooks/。/api/v2/ - 列表、Webhook、调用记录和取消端点位于(需身份验证的路径)。
/api/v2/ - 展示时间时,将ISO时间戳转换为人类可读的相对时间(例如“2小时前”)。