Skip to content

5 分钟上手

5 分钟。注册账号、装 SDK、起一个 run、看到事件流回来。

Step 0 —— 拿到 API key(30 秒)

  1. dashboard.qoni.ai 注册
  2. Settings → API Keys → Create
  3. 复制 wa_…。**只显示一次。**丢了只能撤销重建
bash
export WEBAGENT_API_KEY=wa_xxxxxxxxxxxxxxxxxxxxxxxx
export WEBAGENT_PROJECT_ID=proj_xxxxxxxxxxxxxxxxxxxxxxxx

Project ID

所有 project-scoped 路径都以 project 为隔离单位:/v1/projects/{pid}/…(DoAnything / WebSearch / Track)。在 Console URL 里Project Switcher → 你的 project就能找到。Standalone 端点(DeepResearch)的 project 由 Bearer token 解析。

Step 1 —— 装 SDK(30 秒)

bash
pip install web-agent-sdk
bash
npm install @web-agent/sdk
bash
# 不用装

Step 2 —— 跑一个任务(90 秒)

WebAgent 是 4 个并列的 API——DoAnything、DeepResearch、WebSearch、Track,按你要做什么直接选其一。

下面用 DoAnything 走一遍完整流程作演示——4 个 API 共用同一套机制:Client → 起任务 → 订阅事件流到终态。其余 3 个见 Step 3。

Client 起一个 DoAnything session,订阅事件流到终态。

python
import asyncio
from web_agent.v1 import Client
from web_agent.v1.types import CreateSessionRequest

async def main():
    async with Client(
        api_key="wa_demo_xxxxxxxxxxxxxxxx",
        project_id="proj_demo_0001",
    ) as client:
        session = await client.sessions.create(CreateSessionRequest(
            instructions="搜 Hacker News 今天 Top 5 的故事,列成 list 返回。",
        ))
        run = session.runs[0]
        async for event in client.events.stream(session.id, run.id):
            print(event.type, event.data)
            if event.type == "run.completed":
                break

asyncio.run(main())
typescript
import { Client } from "@web-agent/sdk";

const client = new Client({
  apiKey: "wa_demo_xxxxxxxxxxxxxxxx",
  projectId: "proj_demo_0001",
});

const session = await client.sessions.create({
  instructions: "搜 Hacker News 今天 Top 5 的故事,列成 list 返回。",
});
const run = session.runs[0]!;
for await (const event of client.events.stream(session.id, run.id)) {
  console.log(event.type, event.data);
  if (event.type === "run.completed") break;
}
bash
curl https://api.eak.eazo.ai/v1/projects/proj_demo_0001/do_anything/sessions \
  -H "Authorization: Bearer wa_demo_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "instructions": "搜 Hacker News 今天 Top 5 的故事,列成 list 返回。"
  }'

同样的代码 Console 也能给你

Console 的 Get Code 对话框输出的就是这段——带你的真实 API key 和当前表单值。打开 dashboard.qoni.ai/new,填表,点 Get Code,就省掉了打字。

Step 3 —— DeepResearch / WebSearch / Track(60 秒)

这 3 个 API 跟 DoAnything 共用同一套 Client / 端点 / 错误信封。要研究报告 / 搜索结果 / 变更监控时,直接用对应的那个:

python
async with Client(api_key="wa_...", project_id="proj_demo") as client:
    run = await client.deep_research.run(
        topic="2026 年开源向量数据库格局",
        depth="deep",
    )
    print(run["run_id"])
python
async with Client(api_key="wa_...", project_id="proj_demo") as client:
    # wait=true 默认,同步阻塞 ≤30s
    result = await client.web_search.run(
        queries=["best Python ORM 2026"],
    )
    for hit in result["results"]["results"]:
        print(hit["title"], hit["url"])
python
async with Client(api_key="wa_...", project_id="proj_demo") as client:
    mon = await client.track.create(
        intent="苹果股价跌破 $200 时通知我",
        schedule={"kind": "interval", "interval_seconds": 3600},
        notify_channel={"kind": "callback_url", "url": "https://hooks.example.com/track"},
    )
    print(mon["id"])

这 3 个 API 的端点 / 字段 / 错误信封都跟 DoAnything 走同一份契约——见 Python SDK / TypeScript SDK

Step 4 —— 在 Console 看一眼(30 秒)

打开 https://dashboard.qoni.ai/sessions/<session.id>(用 step 2 打印的 id)。你会看到刚才那个 run 的 chat + Live Preview iframe——和 SSE 流里的内容一样,可视化呈现。

接下来呢

排错

现象原因
401 unauthorizedkey 错 / 过期 / 撤销Settings → API Keys 重建
402 insufficient_credits免费额度耗尽Settings → Billing → Add credits
SSE 流卡 60s+网络断 / proxy 缓冲Last-Event-ID 重连,详见 Events & SSE
429 rate_limit_exceeded短时间 burst退避重试;Dev plan 默认 5–10 并发