LangChain - AgentsYou want your custom agent to choose actions based on input keywords. Which approach best fits this requirement?AUse the default agent without changes; it handles keywords automatically.BCreate a separate function outside the agent to handle keywords.CModify the agent's run method to ignore input and return fixed actions.DOverride the plan method to check keywords and return specific actions.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand keyword-based decision needsThe agent must analyze input and decide actions based on keywords.Step 2: Choose method to customize decision logicOverriding the plan method allows custom logic to inspect input and select actions.Final Answer:Override the plan method to check keywords and return specific actions. -> Option DQuick Check:Custom plan method for keyword logic [OK]Quick Trick: Use plan method to customize input-based decisions [OK]Common Mistakes:MISTAKESAssuming default agent handles keywords automaticallyModifying run method instead of planHandling keywords outside agent loses integration
Master "Agents" in LangChain9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More LangChain Quizzes Evaluation and Testing - Creating evaluation datasets - Quiz 8hard LangGraph for Stateful Agents - Why LangGraph handles complex agent flows - Quiz 3easy LangGraph for Stateful Agents - Human-in-the-loop with LangGraph - Quiz 12easy LangGraph for Stateful Agents - Multi-agent graphs - Quiz 4medium LangSmith Observability - Comparing prompt versions - Quiz 4medium LangSmith Observability - Cost tracking across runs - Quiz 8hard Production Deployment - LangServe for API deployment - Quiz 7medium Production Deployment - LangServe for API deployment - Quiz 14medium Production Deployment - Streaming in production - Quiz 3easy Production Deployment - FastAPI integration patterns - Quiz 5medium