AI / LangGraph LangChain Interview questions
What are the different agent types in LangChain?
LangChain provides several agent types, each suited to different LLM capabilities and task requirements:
| Agent Type | How it works | Best for |
|---|---|---|
| OpenAI Tools Agent | Uses OpenAI's native tool/function calling API to select and call tools | OpenAI models (gpt-4o, gpt-4-turbo); most reliable structured tool use |
| OpenAI Functions Agent | Older version using the functions API (now superseded by Tools Agent) | Legacy gpt-3.5/gpt-4 function calling |
| ReAct Agent | Uses Thought/Action/Observation text format in the prompt; parses action from model output | Models without native function calling; transparent reasoning |
| Structured Chat Agent | Like ReAct but handles tools with multi-field structured inputs | Tools that require more than a single string input |
| XML Agent | Uses XML-formatted actions; designed for Anthropic Claude models | Claude models where XML is reliable output format |
| JSON Chat Agent | Uses JSON-formatted actions in the prompt | Models that reliably produce JSON without native tool calling |
In practice, create_openai_tools_agent() or create_react_agent() are the most common entry points. For anything requiring fine-grained control over the agent loop — including human-in-the-loop, persistent state, or multi-agent coordination — consider using LangGraph instead.
More Related questions...