refactor(run.py): replace synchronous langfuse.flush() with asyncio task for improved performance

This commit is contained in:
sharath 2025-07-08 19:32:33 +00:00
parent 13e702317e
commit f9a66afade
No known key found for this signature in database
1 changed files with 2 additions and 3 deletions

View File

@ -1,7 +1,6 @@
import os
import json
import re
from uuid import uuid4
import asyncio
from typing import Optional
# from agent.tools.message_tool import MessageTool
@ -633,4 +632,4 @@ async def run_agent(
if generation:
generation.end(output=full_response)
langfuse.flush()
asyncio.create_task(asyncio.to_thread(lambda: langfuse.flush()))