fix(agent): increase timeout for pending Redis operations and improve error logging for cost calculation

This commit is contained in:
sharath 2025-06-05 11:21:34 +00:00
parent a1a71a05de
commit 6fb2c544d3
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -578,8 +578,8 @@ class ResponseProcessor:
logger.info("Stream cost calculation resulted in zero or None, not storing cost message.") logger.info("Stream cost calculation resulted in zero or None, not storing cost message.")
self.trace.update(metadata={"cost": 0}) self.trace.update(metadata={"cost": 0})
except Exception as e: except Exception as e:
logger.error(f"Error calculating final cost for stream: {str(e)}") logger.warning(f"Failed to calculate final cost for stream: {str(e)}")
self.trace.event(name="error_calculating_final_cost_for_stream", level="ERROR", status_message=(f"Error calculating final cost for stream: {str(e)}")) self.trace.event(name="failed_to_calculate_final_cost_for_stream", level="WARNING", status_message=(f"Failed to calculate final cost for stream: {str(e)}"))
# --- Final Finish Status --- # --- Final Finish Status ---
@ -1069,7 +1069,7 @@ class ResponseProcessor:
"arguments": params # The extracted parameters "arguments": params # The extracted parameters
} }
logger.debug(f"Created tool call: {tool_call}") # logger.debug(f"Created tool call: {tool_call}")
return tool_call, parsing_details # Return both dicts return tool_call, parsing_details # Return both dicts
except Exception as e: except Exception as e:

View File

@ -235,7 +235,7 @@ async def run_agent_background(
# Wait for all pending redis operations to complete, with timeout # Wait for all pending redis operations to complete, with timeout
try: try:
await asyncio.wait_for(asyncio.gather(*pending_redis_operations), timeout=5.0) await asyncio.wait_for(asyncio.gather(*pending_redis_operations), timeout=30.0)
except asyncio.TimeoutError: except asyncio.TimeoutError:
logger.warning(f"Timeout waiting for pending Redis operations for {agent_run_id}") logger.warning(f"Timeout waiting for pending Redis operations for {agent_run_id}")