Skip to content
Plurafy

LangChain

LangChain Interview Questions

An agent is an autonomous software that perceives an environment, chooses actions, uses feedbacks/observations and plans its next action util it reaches the goal.

2. Explain the core components of a LangChain ReAct Agent.

Section titled “2. Explain the core components of a LangChain ReAct Agent.”

A LangChain ReAct agent has following 3 core components

  • LLM: has the reasoning capability and can generate the next step in the thought/action format.
  • Tools: are set of callable function names with input/output format that an agent can invoke.
  • Prompt: is set of system instructions, tools list, observations and strict output formatting instructions that can easily parsed by the runtime.

3. Describe the iterative Thought-Action-Observation loop that drives ReAct agent reasoning.

Section titled “3. Describe the iterative Thought-Action-Observation loop that drives ReAct agent reasoning.”
  • Thought is the models internal step-by-step reasoning.
  • Action is the step where model selection a tool to execute.
  • Observation is the response received from the tool execution and can tbe context for the next prompt.

4. Articulate how the agent uses observations from tools to refine its thoughts and determine the next action.

Section titled “4. Articulate how the agent uses observations from tools to refine its thoughts and determine the next action.”

After each tool call the tool response(observation) is be added to the prompt and then the next thought is re-evaluated based on the updated information. If the observation contradicts with the earlier assumptions, it will revise its reasoning and either call another tool with different arguments or adjust the final answer repeating the loop until the result is produced.