I am developing a custom integration using ChatKit and the Agent SDK, along with my own MCP server. I have successfully implemented the setup, but I noticed something that is concerning and might require a rework.
The issue is straightforward: stream_agent_response does not store the raw output from my tool calls. I understand that stream_agent_response is designed to return only the relevant events for the UI, but I don’t see why the tool outputs couldn’t also be saved in the store.
Why is this important?
In my implementation, tool responses contain critical information for future calls—like IDs, for example. Without the ability to persist these IDs, if a user wants to perform an action such as creating a new project for a contact, the agent might generate a new ID just to fulfill the request, which would be incorrect.
I’m wondering whether this is a valid feature request for the dev team, or if I should switch to “manual” event handling using result.stream_events(). I’m also open to any other recommendations or best practices!