-: The last part is to trace everything with LangSmith.
And let's see everything we've learned beautifully displayed
in the user interface of LangSmith.
Go to .env and I'm going to paste my environment variables.
The LangSmith display name is going to be ReAct.
Now I'm going to simply run everything again
and we got back the result.
Now let's go to LangSmith
and here we see, we have here the ReAct.
And let's have a look on the tracing.
So this is the first call to the LLM,
and we can see that we took the ReAct prompt
and we populated with our tools and our tools description
and the question that we asked our agent,
what is the length of the word dog?
And in the answer we can see
that I should get the text length function
to determine the length of the word dog.
So the action here is text length and dog.
However, now let's see what our output parser did.
So it received this, and as an output it gave us
an object of type AgentAction.
And we saw it already,
which has the following keys and values.
So it has in the tool field, get_text_length,
which is the name of the function that we want to run.
The tool input is dog, and you can see it right here.
And the log over here is sort of a proof
of how did langchain
come up with this object of AgentAction.
So we ran the tool, we got the result three,
and now you can see that we added
to our scratch pad over here that the observation was three.
So this was after we ran the tool, we got the result.
And this is the observation.
And right now the LLM can actually determine
the result and can determine
what's the length of the word dog.
So it now says, "I now know the final answer.
"Final answer: 3."
And we invoke the output parser again.
So the output parer parses it
and gives us an AgentFinish object,
and its field of output is going to be three, and that's it.