Skip to content

Python / Raw HTTP ​

The current repositories do not ship an installable web-agent-sdk Python package. Python integrations should call the REST API directly; use the OpenAPI spec as the field contract.

bash
pip install httpx
python
import os
import httpx

BASE = "https://webagent.qoni.ai"
PROJECT_ID = os.environ["WEBAGENT_PROJECT_ID"]
HEADERS = {"Authorization": f"Bearer {os.environ['WEBAGENT_API_KEY']}"}

DoAnything ​

python
async with httpx.AsyncClient(base_url=BASE, headers=HEADERS, timeout=None) as client:
    response = await client.post(
        f"/api/v1/projects/{PROJECT_ID}/do_anything/runs",
        json={
            "instructions": "Open Hacker News and list the first five stories.",
            "max_duration_minutes": 10,
        },
    )
    response.raise_for_status()
    run_id = response.json()["run_id"]

    async with client.stream(
        "GET",
        f"/api/v1/projects/{PROJECT_ID}/do_anything/runs/{run_id}/events",
    ) as stream:
        async for line in stream.aiter_lines():
            if line.startswith("data:"):
                print(line[5:].strip())

The run-id surface also provides detail, cancel, intervene, messages, screenshots, pause, resume, and continue routes. Use OpenAPI for their exact bodies.

DeepResearch, WebSearch, and Track ​

python
research = await client.post(
    f"/api/v1/projects/{PROJECT_ID}/deep_research/runs",
    json={"topic": "Browser automation trends in 2026", "depth": "standard"},
)
research.raise_for_status()

search = await client.post(
    f"/api/v1/projects/{PROJECT_ID}/web_search/runs",
    json={"queries": ["browser automation 2026"], "max_results_per_query": 5},
)
search.raise_for_status()

monitor = await client.post(
    f"/api/v1/projects/{PROJECT_ID}/track/tracks",
    json={
        "instructions": "Check this page every morning for changes.",
        "schedule": {"daily_at": "09:00", "tz": "Asia/Singapore"},
    },
)
monitor.raise_for_status()

DeepResearch and WebSearch return asynchronous runs. Track creation returns a resource; run_now returns 202 and a task reference, not completion. Daily scheduling starts 0–30 minutes early; interval scheduling uses integer every_seconds (600–2592000). Read /track/tracks/{track_id}/checks for the recent 50 checks. Creation immediately starts first_look; checks uses done for success. An in-flight check makes run_now return 409 task_in_progress; wait for its terminal state without automatic retries. pause/delete do not cancel an in-flight check. There is no legacy DSL, notification field, or Track SSE; see Track.