Files
JARVIS/backend/app/agents/tools/async_bridge.py
WIN-JHFT4D3SIVT\caoxiaozhu 4972b4e6b1 fix: harden L3 runtime continuity and tool execution
Align the L3 graph, agent service, and sync tool shims on one canonical continuity contract so clarification resumes and persisted snapshots behave consistently. Add targeted regressions and hardening notes covering system-message coalescing, async bridge usage, and continuity rehydration.
2026-04-03 13:14:59 +08:00

19 lines
417 B
Python

from __future__ import annotations
import asyncio
from concurrent.futures import ThreadPoolExecutor
from typing import Any
_executor = ThreadPoolExecutor(max_workers=4)
def run_async(coro: Any, timeout: int = 30):
try:
asyncio.get_running_loop()
except RuntimeError:
return asyncio.run(coro)
return _executor.submit(asyncio.run, coro).result(timeout=timeout)
__all__ = ["run_async"]