add api_url() to the agent model to limit duplicated logic elsewhere