Integrate per-user browser runtimes into subagent API
This commit is contained in:
parent
952b2e7d17
commit
280247e1e5
11 changed files with 777 additions and 21 deletions
|
|
@ -10,12 +10,13 @@ class BrowserRpcClient:
|
|||
self._rpc_url = rpc_url
|
||||
self._session = session
|
||||
|
||||
async def run(self, task: str, timeout_sec: float) -> dict[str, Any]:
|
||||
async def run(self, task: str, timeout_sec: float, rpc_url: str | None = None) -> dict[str, Any]:
|
||||
payload = {"task": task}
|
||||
timeout = aiohttp.ClientTimeout(total=timeout_sec)
|
||||
target_url = rpc_url or self._rpc_url
|
||||
|
||||
try:
|
||||
async with self._session.post(self._rpc_url, json=payload, timeout=timeout) as response:
|
||||
async with self._session.post(target_url, json=payload, timeout=timeout) as response:
|
||||
if response.status >= 400:
|
||||
body = await response.text()
|
||||
raise BrowserRpcError(f"RPC HTTP: {response.status}: {body}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue