Agents/Tool Calling: Pass data to subsequent steps without showing it to the LLM (return of execute())
Feature Description
Right now when you return data from execute within a tool, that data is included in the next request to the LLM.
It would be nice if we were able to return some data that could be accessed in following steps or outside of the agent loop, that is nicely tied to a specific step.
Currently this is possible by keeping external state, but it's kind of ugly.
This is especially important if you have larger data that the LLM does not need to see.
Use Cases
Tool 2 requires variables/state determined in Tool 1, but the LLM does not need to see that data.
Additional context
I'm not sure what the right design for this would be, but think it could be nice for the return type of execute to have two fields:
{ exposed: hidden: }
exposed goes to the LLM (like how it does currently) and hidden: does not. Can use a type guard to make this backwards compatible, if these keys are not seen then we just treat it the same way it is now.
I'm running into a similar use case, maybe it would be better to use the ai's provider package directly? I couldn't find any other issue with this specific problem
Same use case here, any other solutions?