While we're here, let's remove APIError:

```python
return jsonify(error="agents must be a list"), BAD_REQUEST
```

Feel free to add more to the error if you think it would be more descriptive of the problem.