A few weeks ago I ran a session like this for my family - one of my daughters wanted to do a murder mystery for her birthday.
I adapted a murder scenario from an old Traveller module, and wrote up some characters (one for each other family member, plus a couple for their entourages, plus a small number of important NPCs whom I played). There was no action resolution in any mechanical sense - the players described what their PCs were doing, and who they were talking to, and I delivered up information as seemed appropriate (eg what they found if they searched a stateroom; what a NPC said if they spoke to him/her; etc).
This is an example of puzzle-solving: the players' goal is to acquire enough information to be able to infer to the hidden bit of my notes (ie whodunnit). It is a different experience from watching an episode of Death in Paradise or The Mentalist, as there is the first-person description element to it. But it doesn't really involve very much more agency.
One way to invest this play with agency is the following:
For every move the group makes (go to place x to investigate, interrogate NPC y, read newpaper article z to suss out connection), their final score is subtracted from a predetermined tally. The less moves they make before solving the puzzle, the better score they get (eg starting at Sherlock Holmes and ending at Amateur Dick).
Done well, that would invest play with a Skilled Play goal and the scorekeeping apparatus to divine the skill.
Yet another way to invest this play with agency is the following:
The 2 players play characters around a murder mystery (not a detective) with a dramatic need (perhaps a card is drawn at the outset of play with a pithy agenda on it). Each player has 1 Relationship Point, 1 Alibi Point, and 1 Clue Point. They can use their Relationship to oblige the GM to have someone important to them enter a scene and can orient that NPC in anyway the player sees fit (the GM then plays it out). They can use their Alibi to oblige the GM to affirm either their alibi or an NPC's alibi when some matter of that alibi is in question (which could have significant trickle down effect up-to-and-including taking the character off the table for the crime). They can spend their Clue to place an item or a piece of forensic evidence in a scene. This can't pin the crime on someone but it can point in a direction. When they spend any Point, they roll 1d6. On a 4-6, they get what they want. On a 2-3, they get what they want, but something else is true that they wish wasn't (perhaps they were going to visit the newspaper next to speak to the lead author of a piece...but they've just showed up in the morgue!). On a 1, things go bad.
Done well, that would invest play with Story Now protagonism where they get to significantly impact the shape and trajectory of the unfolding mystery (including their character and and their characters' relationships orientation to the final outcome).
Without some version of either of those two and without some form of clear, concrete, and game-specific metagoal ("have fun" is none of those things) and corresponding intentful design which allows players to skillfully/artfully pursue it (fulfilling or failing)...I don't see where play invests the players with much agency. Revealing an already written mystery for the sake of the excitement of a well-conceived case-unraveling is fun as hell...but its certainly not brimming with agency.