

TITLE
Make it easy to get seperate "prints" for individual runs/ users when using Transformers Agent

COMMENTS
3

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
### Feature request

I have started exploring the new Transformers Agent. And I would like to build a UI to help me speed up the process.

I might be running multiple runs in parallel or have multiple users using my application. I would like to be able to stream the information from the run as it arrives. I would like to store the information in a database containing all the runs I've done.

Currently all the valuable information about the run is printed I.e. you are using print to inform me like below

```bash
==Explanation from the agent==
I will use the following  tool: `image_generator` to generate an image.


==Code generated by the agent==
image = image_generator(prompt="rivers and lakes")


==Result==
<PIL.PngImagePlugin.PngImageFile image mode=RGB size=512x512 at 0x7F8DDC11C4C0>
```

This is for example done in `agenst.py`

![image](https://github.com/huggingface/transformers/assets/42288570/ed635571-63f2-45b4-9cc5-8acd33dcbc71)

Using `print` makes it hard for me to distinguish between multiple runs/ users. Especially if run in parallel.

Please provide a simple to use method to stream each run individually. It could be as simple as adding a `print` (or `write`) argument to the `Agent.run`, `HFAgent.run` and `OpenAI.run` method.

Alternatively some `run_id` argument could be provided and printed as well. Then I can split the stream that comes in by `run_id`. This is less preferred though that this also adds some complexity.

### Motivation

This will make it much, much easier to create interesting AI apps.

### Your contribution

I might do it 😄 . But I hope someone with knowledge of the code base would do it.

### Additional Context

An async `.run_async` function would also be much appreciated as my UI is built on top of Tornado. This will help me keep the app responsive.