From 971cf340873c1a26402ea568fb068c18b0995b21 Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Thu, 2 Apr 2026 21:55:13 +0800 Subject: [PATCH] fix: serialize datetime objects in agent dict before JSON encoding in create_agent_execution --- dashboard/backend/db/opc_db.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dashboard/backend/db/opc_db.py b/dashboard/backend/db/opc_db.py index 3b0da62..4746915 100644 --- a/dashboard/backend/db/opc_db.py +++ b/dashboard/backend/db/opc_db.py @@ -543,9 +543,14 @@ async def create_agent_execution( if task_for_context.get(key): task_for_context[key] = task_for_context[key].isoformat() if hasattr(task_for_context[key], 'isoformat') else task_for_context[key] + agent_for_context = dict(agent) + for key in ["created_at"]: + if agent_for_context.get(key): + agent_for_context[key] = agent_for_context[key].isoformat() if hasattr(agent_for_context[key], 'isoformat') else agent_for_context[key] + input_context = { "task": task_for_context, - "agent": dict(agent), + "agent": agent_for_context, "timestamp": datetime.utcnow().isoformat() }