mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-21 12:06:18 +00:00
15 lines
365 B
Python
15 lines
365 B
Python
from __future__ import annotations
|
|
|
|
import inspect
|
|
from typing import Any
|
|
|
|
|
|
async def close_agent_stream(stream: Any) -> None:
|
|
"""Close an agent stream when its runtime exposes asynchronous cleanup."""
|
|
close = getattr(stream, "aclose", None)
|
|
if close is None:
|
|
return
|
|
result = close()
|
|
if inspect.isawaitable(result):
|
|
await result
|