They are mostly very talented individuals, but how can you use the tools Agile offers to help them have their freedom but also work with others?
You are conflating things which are not orthogonal. Agile frameworks are based on teamwork and collaboration, so you need to consciously select for that in your team composition even more rigorously than you select for skill.
Analysis and Recommendations
There are mediocre teams that use agile frameworks like Scrum to great effect because the team-based approach enables average programmers to collectively function at a reasonable (and consistent) level of performance. There are also high-functioning teams full of collaborative ninjas who work together to turn out stellar work.
In the middle, you have teams with a few high performers, and some middle-of-the-road folks. As long as everyone works together, the high performers can pair or mentor others in the team to improve overall performance and skills transfer, while the remainder of the team works hard to ensure that they are contributing to the overall effort without becoming "help vampires" or creating drag on the team.
Agile frameworks will not make inadequate developers "rockstars," nor will lone wolves (rockstars or not) improve the overall performance of the team. The team succeeds or fails as a unit; that means that skills definitely matter, but teamwork, communication, and the ability to collaborate effectively matter more.
When you build your team, you need to make sure that you are selecting for the right mix of skills and cultural fit that make an agile team successful. That means filling your team with cross-functional (or at least "T-shaped") team members who are on board with the agile framework and its processes, and who are willing to continuously improve their team collaboration skills.
Anyone who can't work within the framework or collaborate with the team should be placed in a role outside the team that will not impact the team's ability to deliver the project. That precludes treating them as advisors, subject-matter experts, or otherwise creating a project dependency on those people. They may or may not have a place within your company, but lone wolves have no place on an agile project.