async def METHOD_NAME(use_hosted_api_server):
    """
    Runs an agent listening to all queues.
    Yields:
        The anyio.Process.
    """
    out = tempfile.TemporaryFile()  # capture output for test assertions
    # Will connect to the same database as normal test clients
    async with open_process(
        command=[
            "prefect",
            "agent",
            "start",
            "--match=nonexist",
        ],
        stdout=out,
        stderr=out,
        env={**os.environ, **get_current_settings().to_environment_variables()},
    ) as process:
        process.out = out
        for _ in range(int(STARTUP_TIMEOUT / POLL_INTERVAL)):
            await anyio.sleep(POLL_INTERVAL)
            if out.tell() > 400:
                # Sleep to allow startup to complete
                # TODO: Replace with a healthcheck endpoint
                await anyio.sleep(4)
                break
        assert out.tell() > 400, "The agent did not start up in time"
        assert process.returncode is None, "The agent failed to start up"
        # Yield to the consuming tests
        yield process
        # Then shutdown the process
        try:
            process.terminate()
        except ProcessLookupError:
            pass
        out.close()