LangChain - AgentsWhich of the following is the correct way to create a ReAct agent in LangChain?Aagent = ReActAgent(llm=llm, tools=tools)Bagent = ReActAgent(tools=llm, llm=tools)Cagent = ReActAgent()Dagent = ReActAgent(llm)Check Answer
Step-by-Step SolutionSolution:Step 1: Recall ReAct agent constructor parametersThe ReAct agent requires a language model (llm) and a list of tools (tools) as named arguments.Step 2: Check each option for correct syntaxagent = ReActAgent(llm=llm, tools=tools) correctly passes llm and tools by name. agent = ReActAgent(tools=llm, llm=tools) swaps them incorrectly. agent = ReActAgent() misses required arguments. agent = ReActAgent(llm) passes only llm without tools.Final Answer:agent = ReActAgent(llm=llm, tools=tools) -> Option AQuick Check:Correct parameters = llm and tools [OK]Quick Trick: Pass llm and tools as named parameters to ReActAgent [OK]Common Mistakes:MISTAKESSwapping llm and tools argumentsOmitting required parametersPassing parameters positionally without names
Master "Agents" in LangChain9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More LangChain Quizzes Evaluation and Testing - Custom evaluation metrics - Quiz 13medium LangChain Agents - Why agents add autonomy to LLM apps - Quiz 12easy LangChain Agents - OpenAI functions agent - Quiz 11easy LangGraph for Stateful Agents - Conditional routing in graphs - Quiz 10hard LangGraph for Stateful Agents - Conditional routing in graphs - Quiz 4medium LangGraph for Stateful Agents - Graph nodes and edges - Quiz 15hard LangGraph for Stateful Agents - Why LangGraph handles complex agent flows - Quiz 1easy LangSmith Observability - Setting up LangSmith tracing - Quiz 14medium LangSmith Observability - Setting up LangSmith tracing - Quiz 9hard LangSmith Observability - Feedback collection and annotation - Quiz 4medium