diff --git a/python/api/api_message.py b/python/api/api_message.py index de0859387..8eb5b53ef 100644 --- a/python/api/api_message.py +++ b/python/api/api_message.py @@ -76,7 +76,9 @@ class ApiMessage(ApiHandler): # Get or create context if context_id: - context = AgentContext.use(context_id) + if agent_profile: + return Response('{"error": "Cannot override agent profile on existing context"}', status=400, mimetype="application/json") + context = AgentContext.use(context_id) if not context: return Response('{"error": "Context not found"}', status=404, mimetype="application/json") else: