fix: serialize datetime objects before JSON encoding in create_agent_execution
This commit is contained in:
@@ -537,8 +537,14 @@ async def create_agent_execution(
|
|||||||
raise ValueError("Task or agent not found")
|
raise ValueError("Task or agent not found")
|
||||||
|
|
||||||
# Build input context
|
# Build input context
|
||||||
|
# Prepare input context with serialized datetimes
|
||||||
|
task_for_context = dict(task)
|
||||||
|
for key in ["created_at", "updated_at", "completed_at", "due_date"]:
|
||||||
|
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]
|
||||||
|
|
||||||
input_context = {
|
input_context = {
|
||||||
"task": dict(task),
|
"task": task_for_context,
|
||||||
"agent": dict(agent),
|
"agent": dict(agent),
|
||||||
"timestamp": datetime.utcnow().isoformat()
|
"timestamp": datetime.utcnow().isoformat()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user