AI / LangGraph LangChain Interview questions
How do agents plan and reason?
LangChain agents use the ReAct (Reasoning + Acting) framework to plan and reason. The model is prompted to produce interleaved Thought, Action, and Observation sequences. The Thought is the model's explicit reasoning about what to do next; the Action is the tool call decision; the Observation is the tool's returned result. This cycle repeats until the model produces a "Final Answer".
A ReAct trace looks like this:
Question: Who is the CEO of Anthropic and when was the company founded? Thought: I need to search for information about Anthropic. Action: search Action Input: "Anthropic CEO founder" Observation: Anthropic was founded in 2021. Dario Amodei is the CEO. Thought: I now have both pieces of information needed to answer. Final Answer: Anthropic's CEO is Dario Amodei. The company was founded in 2021.
For models with native function calling (OpenAI, Anthropic), the reasoning is more structured: the model returns a JSON tool call object rather than parsing free text, which is more reliable. The OpenAI Tools Agent uses this approach. Newer techniques like chain-of-thought prompting and tree-of-thought can be integrated to improve multi-step reasoning quality by providing examples of good reasoning chains in the system prompt.
More Related questions...