Bird
0
0

Which of the following is the correct syntax to initialize a ReAct agent with tools in LangChain?

easy📝 Syntax Q3 of 15
LangChain - Agents
Which of the following is the correct syntax to initialize a ReAct agent with tools in LangChain?
Aagent = create_react_agent(llm, tools)
Bagent = Agent(tools, llm, type='react')
Cagent = initialize_agent(tools, llm, agent_type='react')
Dagent = ReactAgent(llm, tools)
Step-by-Step Solution
Solution:
  1. Step 1: Recall LangChain's agent initialization pattern

    LangChain uses initialize_agent() with tools, llm, and agent_type parameters.
  2. Step 2: Match options to this pattern

    Only agent = initialize_agent(tools, llm, agent_type='react') matches the correct function and parameter names.
  3. Final Answer:

    agent = initialize_agent(tools, llm, agent_type='react') -> Option C
  4. Quick Check:

    Correct syntax uses initialize_agent() with agent_type='react' [OK]
Quick Trick: Use initialize_agent() with agent_type='react' [OK]
Common Mistakes:
MISTAKES
  • Using wrong function names
  • Swapping tools and llm order
  • Missing agent_type parameter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes