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