You can stream messages, intermediate steps, and other data back to the user using the ChatResponseStream object. You can access this object from your Chat function’s input.
For agent-based application, you can stream intermediate steps back to the client. This can be useful for debugging, or for providing more context to the user. Here’s an example of an agent streaming intermediate step when a new tool is called: