fix: validate existing agent for context
dipi.evil committed
Dec 19, 2025 at 11:17 UTC
a96387d54767d0c128974aa9ea3adb603526f972
1 file changed
+3
-1
python/api/api_message.py
+3
-1
@@ -76,7 +76,9 @@ class ApiMessage(ApiHandler):
76
77
# Get or create context
78
if context_id:
79
- context = AgentContext.use(context_id)
79
+ if agent_profile:
80
+ return Response('{"error": "Cannot override agent profile on existing context"}', status=400, mimetype="application/json")
81
+ context = AgentContext.use(context_id)
82
if not context:
83
return Response('{"error": "Context not found"}', status=404, mimetype="application/json")
84
else: