agent: Return 400 error for bad requests