run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
35.38k stars 4.98k forks source link

[Feature Request]: Option to view underlying thoughts, observations and actions taken by the Agent #14626

Open shazil-ahmed opened 2 months ago

shazil-ahmed commented 2 months ago

Feature Description

When I ask the ReAct agent to perform a task, it goes through a lot of reasoning and steps under the hood. It is in the form of observations, thoughts and actions. It would be very helpful if we could get these as part of the response that the agent returns after it is asked to perform a task. I would like to output the steps taken and the thoughts,observations,actions taken on a streamlit application.

Reason

The ReAct agent shows the thoughts,actions,observations on the terminal when it is performing the task. But once it is completed and the agent returns a response object, the observations,thoughts,actions that it took to complete that task are not part of that response object. I would like to output these on my application.

Value of Feature

This will allow the users to save the steps taken and the observations, thoughts, actions of the agents in a variable in the code. This will be helpful if you want to output these steps and under-the-hood working on the frontend of your application.

logan-markewich commented 2 months ago

This is already possible if you use the lower level api, or use callbacks.

Here's an example with the low level api https://colab.research.google.com/drive/1hiDkBbAJcO3RDrS7CD2ZeQEHGqNv07pq?usp=sharing