fix(simulation): add int coercion and 400 validation for max_agents in prepare endpoint

This commit is contained in:
Ubuntu 2026-05-03 21:56:03 +00:00
parent ef46ba1743
commit 306414a555
1 changed files with 5 additions and 0 deletions

View File

@ -449,6 +449,11 @@ def prepare_simulation():
entity_types_list = data.get('entity_types')
max_agents = data.get('max_agents') # optional: limit to top-N most-connected entities
if max_agents is not None:
try:
max_agents = int(max_agents)
except (TypeError, ValueError):
return jsonify({"success": False, "error": "max_agents must be an integer"}), 400
use_llm_for_profiles = data.get('use_llm_for_profiles', True)
parallel_profile_count = data.get('parallel_profile_count', 5)