I would go further than this. Call the script yourself (or via some other mechanism/program) and then give the results to the LLM.

The majority of processes don't need nearly as many decision making points as an agent could deal with and look somewhat like this:

1. gather raw information => script

2. turn it into structured data => script

3. produce an actionable plan => script/user/agent (depends)

4. validate the plan => user

5. narrow down the implementation workflow and the set of tools needed => user/agent

6. follow workflow iteratively => user/agent

Doesn't need to be this exact shape, but the lesson I learned is to quasi front load and structure as much as possible with scripts and data. That can be done with agent assistance as well, for example by watching it do the task, or a similar one, in freeform at first.

There's definitely some optimization that can occur, like an orchestrator or Ralph.