{"id":8485,"date":"2023-12-17T08:45:11","date_gmt":"2023-12-17T16:45:11","guid":{"rendered":"https:\/\/live-cometml.pantheonsite.io\/?p=8485"},"modified":"2025-04-24T17:03:49","modified_gmt":"2025-04-24T17:03:49","slug":"plan-and-execute-agents-in-langchain","status":"publish","type":"post","link":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/","title":{"rendered":"Plan-and-Execute Agents in Langchain"},"content":{"rendered":"\n<section class=\"section section--body\">\n<div class=\"section-divider\"><span style=\"color: var(--wpex-heading-color); font-size: var(--wpex-text-2xl); font-weight: var(--wpex-heading-font-weight); font-family: var(--wpex-body-font-family, var(--wpex-font-sans));\">Evolution from Action to Plan-and-Execute<\/span><\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<figure class=\"graf graf--figure\">\n<\/figure><\/div><\/div><\/section>\n\n\n\n<figure class=\"wp-block-image aligncenter graf-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*pmTMECIkzMMrWJ5d\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Photo by <a href=\"https:\/\/unsplash.com\/@halacious?utm_source=medium&amp;utm_medium=referral\">Hal Gatewood<\/a> on\u00a0<a href=\"http:\/\/Unsplash.com\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<p class=\"graf graf--p\">Traditional \u201cAction Agents\u201d followed a framework where user input was received, the agent decided on a tool to use, and this process was repeated until the agent responded to the user.<\/p>\n\n\n\n<p class=\"graf graf--p\">However, the need for a more advanced system arose as user objectives became more intricate and developers began to rely more on agents.<\/p>\n\n\n\n<p class=\"graf graf--p\">This led to developing \u201cPlan-and-Execute\u201d agents that separate planning from execution, allowing for more focused and reliable operations.<\/p>\n\n\n\n<h4 class=\"wp-block-heading graf graf--h4\">Introducing Plan-and-Execute Agents<\/h4>\n\n\n\n<p class=\"graf graf--p\">Plan-and-execute agents are a new breed of agents designed to address the limitations of their traditional counterparts.<\/p>\n\n\n\n<p class=\"graf graf--p\">They accomplish objectives by planning what to do and executing the sub-tasks.<\/p>\n\n\n\n<p class=\"graf graf--p\">Drawing inspiration from the BabyAGI concept and the \u201c<a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/aclanthology.org\/2023.acl-long.147.pdf\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/aclanthology.org\/2023.acl-long.147.pdf\">Plan-and-Solve<\/a>\u201d paper, these agents represent a significant leap in agent technology.<\/p>\n\n\n\n<h4 class=\"wp-block-heading graf graf--h4\">Components of Plan-and-Execute Agents<\/h4>\n\n\n\n<p class=\"graf graf--p\">The core of this agent framework consists of a planner and an executor.<\/p>\n\n\n\n<p class=\"graf graf--p\">The planner, typically a language model, plans the steps and deals with ambiguities.<\/p>\n\n\n\n<p class=\"graf graf--p\">Conversely, the executor is an Action Agent that takes the high-level objective from the planner and determines the tools to achieve it.<\/p>\n\n\n\n<h4 class=\"wp-block-heading graf graf--h4\">How Do Plan-and-Execute Agents&nbsp;Work?<\/h4>\n\n\n\n<p class=\"graf graf--p\"><strong class=\"markup--strong markup--p-strong\">Planning:<\/strong> Typically done by a Language Model (LLM), this phase involves mapping out the steps required to achieve the objective. The LLM\u2019s reasoning ability is harnessed to plan and deal with ambiguities or edge cases.<\/p>\n\n\n\n<p class=\"graf graf--p\"><strong class=\"markup--strong markup--p-strong\">Execution:<\/strong> A separate agent, equipped with the necessary tools, takes over in this phase. It receives the high-level objectives from the planner and determines the tools and methods to achieve them.<\/p>\n\n\n\n<p class=\"graf graf--p\">This separation allows for more specialized attention to planning and execution, potentially leading to better results.<\/p>\n\n\n\n<ul class=\"wp-block-list postList\">\n<li><strong class=\"markup--strong markup--li-strong\">Complex Objectives: <\/strong>Traditional agents can lose focus on intricate tasks.<\/li>\n\n\n\n<li><strong class=\"markup--strong markup--li-strong\">Reliability: <\/strong>As reliance on agents grows, so does the need for reliability.<\/li>\n\n\n\n<li><strong class=\"markup--strong markup--li-strong\">Scalability: <\/strong>Increasing complexity and reliability demands can overwhelm traditional agents.<\/li>\n<\/ul>\n\n\n\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\">\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<blockquote class=\"graf graf--pullquote\"><p>Want to learn how to build modern software with LLMs using the newest tools and techniques in the field? <a class=\"markup--anchor markup--pullquote-anchor\" href=\"https:\/\/www.comet.com\/production\/site\/llm-course\/?utm_source=Heartbeat&amp;utm_medium=referral&amp;utm_content=Medium&amp;utm_campaign=Heartbeat_LangChain_Series_HS\" target=\"_blank\" rel=\"noopener ugc nofollow\" data-href=\"https:\/\/www.comet.com\/production\/site\/llm-course\/?utm_source=Heartbeat&amp;utm_medium=referral&amp;utm_content=Medium&amp;utm_campaign=Heartbeat_LangChain_Series_HS\">Check out this free LLMOps course<\/a> from industry expert Elvis Saravia of&nbsp;DAIR.AI!<\/p><\/blockquote>\n<\/div>\n<\/div>\n<\/section>\n\n\n\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\">\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 class=\"graf graf--h4\">Benefits Over Traditional Agents:<\/h4>\n<p class=\"graf graf--p\">They are particularly effective when the objective requires complex planning and coordination of multiple sub-tasks.<\/p>\n<p class=\"graf graf--p\">These agents can handle tasks that involve multiple steps and dependencies between them.<\/p>\n<p class=\"graf graf--p\">To determine if you should use plan-and-execute agents, consider the complexity of your objective and the need for planning and coordination.<\/p>\n<p class=\"graf graf--p\">If your objective can be achieved through a simple sequence of steps without much planning, other types of agents may be more suitable.<\/p>\n<h4 class=\"graf graf--h4\">Preliminaries<\/h4>\n<p class=\"graf graf--p\">Let\u2019s get some preliminaries out of the way\u2026<\/p>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"1\" data-code-block-lang=\"javascript\"><span class=\"pre--content\">%%capture\n!pip install langchain langchain_experimental openai duckduckgo-search youtube_search wikipedia\n\n<span class=\"hljs-keyword\">import<\/span> os\n<span class=\"hljs-keyword\">import<\/span> getpass\n\nos.<span class=\"hljs-property\">environ<\/span>[<span class=\"hljs-string\">\"OPENAI_API_KEY\"<\/span>] = getpass.<span class=\"hljs-title function_\">getpass<\/span>(<span class=\"hljs-string\">\"Enter Your OpenAI API Key:\"<\/span>)\n\n<span class=\"hljs-keyword\">from<\/span> langchain.<span class=\"hljs-property\">chat_models<\/span> <span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-title class_\">ChatOpenAI<\/span>\n<span class=\"hljs-keyword\">from<\/span> langchain_experimental.<span class=\"hljs-property\">plan_and_execute<\/span> <span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-title class_\">PlanAndExecute<\/span>, load_agent_executor, load_chat_planner\n<span class=\"hljs-keyword\">from<\/span> langchain.<span class=\"hljs-property\">llms<\/span> <span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-title class_\">OpenAI<\/span>\n<span class=\"hljs-keyword\">from<\/span> langchain.<span class=\"hljs-property\">tools<\/span> <span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-title class_\">DuckDuckGoSearchRun<\/span>\n<span class=\"hljs-keyword\">from<\/span> langchain.<span class=\"hljs-property\">agents<\/span>.<span class=\"hljs-property\">tools<\/span> <span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-title class_\">Tool<\/span>\n<span class=\"hljs-keyword\">from<\/span> langchain <span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-title class_\">LLMMathChain<\/span><\/span><\/pre>\n<h3 class=\"graf graf--h3\">\u2692\ufe0f Define the&nbsp;Tools<\/h3>\n<p class=\"graf graf--p\">Start by defining the tools the agent will use to execute its sub-tasks.<\/p>\n<p class=\"graf graf--p\">These tools can be functions or APIs that perform specific actions.<\/p>\n<p class=\"graf graf--p\">For example, you can define a tool for searching the internet or performing calculations.<\/p>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"python\"><span class=\"pre--content\">llm = ChatOpenAI(model=<span class=\"hljs-string\">\"gpt-4-1106-preview\"<\/span>,temperature=<span class=\"hljs-number\">0<\/span>)\n\nllm_math_chain = LLMMathChain.from_llm(llm=llm, verbose=<span class=\"hljs-literal\">True<\/span>)\n\nsearch = DuckDuckGoSearchRun()\n\nsearch_tool = Tool(\n    name=<span class=\"hljs-string\">\"Search\"<\/span>,\n    func=search.run,\n    description=<span class=\"hljs-string\">\"Useful for answering questions about up to the minute and current events\"<\/span>\n    )\n\ncalcuator_tool = Tool(\n    name=<span class=\"hljs-string\">\"Calculator\"<\/span>,\n    func=llm_math_chain.run,\n    description=<span class=\"hljs-string\">\"Useful for when you need to do math\"<\/span>\n)\n\nagent_tools = [search_tool, calcuator_tool]<\/span><\/pre>\n<h3 class=\"graf graf--h3\">\ud83d\udd75\ud83c\udffd Create the Planner and Executor&nbsp;Agents<\/h3>\n<h4 class=\"graf graf--h4\">\ud83d\udc69\u200d\ud83d\udcbc Implement the&nbsp;planner<\/h4>\n<p class=\"graf graf--p\">This method takes in the intermediate steps taken by the agent and user inputs as arguments.<\/p>\n<p class=\"graf graf--p\">It should analyze the current state and decide what action or tool to use next.<\/p>\n<p class=\"graf graf--p\">The plan method should return a list of AgentAction objects specifying the tools to use.<\/p>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"python\"><span class=\"pre--content\">model = ChatOpenAI(model=<span class=\"hljs-string\">\"gpt-4\"<\/span>,temperature=<span class=\"hljs-number\">0<\/span>)\n\nplanner = load_chat_planner(model)\n\nplanner.llm_chain.prompt.messages[<span class=\"hljs-number\">0<\/span>].content<\/span><\/pre>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"plaintext\"><span class=\"pre--content\">Let's first understand the problem and devise a plan to solve the problem. Please output the plan starting with the header 'Plan:' and then followed by a numbered list of steps. Please make the plan the minimum number of steps required to accurately complete the task. If the task is a question, the final step should almost always be 'Given the above steps taken, please respond to the users original question'. At the end of your plan, say '&lt;END_OF_PLAN&gt;'<\/span><\/pre>\n<h3 class=\"graf graf--h3\">\ud83d\udc68\ud83c\udffd\u200d\ud83d\udcbc Instantiate the AgentExecutor<\/h3>\n<p class=\"graf graf--p\">Finally, create an instance of the agent executor class, passing in the agent and tools as arguments.<\/p>\n<p class=\"graf graf--p\">The agent executor handles the execution of the agent\u2019s actions and tools.<\/p>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"python\"><span class=\"pre--content\">executor = load_agent_executor(model, agent_tools, verbose=<span class=\"hljs-literal\">True<\/span>)\n\nagent = PlanAndExecute(planner=planner, executor=executor, verbose=<span class=\"hljs-literal\">True<\/span>)\n\n<span class=\"hljs-built_in\">print<\/span>(executor.chain.agent.llm_chain.prompt.messages[<span class=\"hljs-number\">0<\/span>].prompt.template)<\/span><\/pre>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"plaintext\"><span class=\"pre--content\">Respond to the human as helpfully and accurately as possible. You have access to the following tools:\n\nSearch: Useful for answering questions about current events, args: {{'tool_input': {{'type': 'string'}}}}\nCalculator: Useful for when you need to do math, args: {{'tool_input': {{'type': 'string'}}}}\n\nUse a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).\n\nValid \"action\" values: \"Final Answer\" or Search, Calculator\n\nProvide only ONE action per $JSON_BLOB, as shown:\n\n```\n{{\n  \"action\": $TOOL_NAME,\n  \"action_input\": $INPUT\n}}\n```\n\nFollow this format:\n\nQuestion: input question to answer\nThought: consider previous and subsequent steps\nAction:\n```\n$JSON_BLOB\n```\nObservation: action result\n... (repeat Thought\/Action\/Observation N times)\nThought: I know what to respond\nAction:\n```\n{{\n  \"action\": \"Final Answer\",\n  \"action_input\": \"Final response to human\"\n}}\n```\n\nBegin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation:.\nThought:<\/span><\/pre>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"python\"><span class=\"pre--content\">agent.run(<span class=\"hljs-string\">\"Who is the current Premier of Manitoba? What is their current age raised to the 0.43 power?\"<\/span>)<\/span><\/pre>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"plaintext\"><span class=\"pre--content\">Response: The current Premier of Manitoba, Wab Kinew, is 41 years old as of 2023.\n\n&gt; Entering new AgentExecutor chain...\nThought: The current age of the Premier of Manitoba is 41 years old. The task is to calculate the age of the Premier raised to the 0.43 power. I can use the Calculator tool to perform this calculation.\nAction:\n```\n{\n  \"action\": \"Calculator\",\n  \"action_input\": \"41^0.43\"\n}\n```\n\n&gt; Entering new LLMMathChain chain...\n41^0.43```text\n41**0.43\n```\n...numexpr.evaluate(\"41**0.43\")...\n\nAnswer: 4.9373857399466665\n&gt; Finished chain.\n\nObservation: Answer: 4.9373857399466665\nThought:The calculator tool has provided the result of 41 raised to the power of 0.43, which is approximately 4.94. I can now provide this as the final answer.\nAction:\n```\n{\n  \"action\": \"Final Answer\",\n  \"action_input\": \"The age of the Premier raised to the 0.43 power is approximately 4.94.\"\n}\n```\n\n&gt; Finished chain.\n*****\n\nStep: Calculate the age of the Premier raised to the 0.43 power.\n\nResponse: The age of the Premier raised to the 0.43 power is approximately 4.94.\n\n&gt; Entering new AgentExecutor chain...\nThought: The user's original question isn't provided in the prompt, but based on the steps taken, it seems like they were asking for the age of the Premier of Manitoba raised to the 0.43 power. The answer to that has been calculated as approximately 4.94.\nAction:\n```\n{\n  \"action\": \"Final Answer\",\n  \"action_input\": \"The age of the Premier of Manitoba, Wab Kinew, raised to the 0.43 power is approximately 4.94.\"\n}\n```\n\n&gt; Finished chain.\n*****\n\nStep: Given the above steps taken, please respond to the users original question.\n\n\nResponse: The age of the Premier of Manitoba, Wab Kinew, raised to the 0.43 power is approximately 4.94.\n&gt; Finished chain.\nThe age of the Premier of Manitoba, Wab Kinew, raised to the 0.43 power is approximately 4.94.<\/span><\/pre>\n<h3 class=\"graf graf--h3\">Conclusion<\/h3>\n<p class=\"graf graf--p\">To conclude, throughout this blog, I\u2019ve taken you through the transformative journey from traditional \u201cAction Agents\u201d to the more advanced \u201cPlan-and-Execute\u201d agents. This new generation of agents, which separates planning from execution, is a game-changer in managing complex tasks more efficiently and reliably.<\/p>\n<p class=\"graf graf--p\">I\u2019ve broken down the components that make up these agents: a planner, usually a language model, which outlines the steps and deals with uncertainties, and an executor, an Action Agent that implements the high-level plan using various tools. This division of labor between planning and execution is key to their enhanced performance.<\/p>\n<p class=\"graf graf--p\">Plan-and-Execute agents&#8217; major advantage over traditional agents is their ability to handle intricate tasks involving multiple steps and dependencies. They are not just a step up in complexity but also in reliability and scalability, crucial factors as we increasingly rely on AI agents in various domains.<\/p>\n<p class=\"graf graf--p\">In the blog, I\u2019ve also walked you through the preliminary steps for setting these agents up, from defining tools to creating planner and executor agents. The real-world example I provided illustrates how effective these agents can be in analyzing, planning, and executing complex queries.<\/p>\n<p class=\"graf graf--p\">This evolution from simple action-oriented agents to sophisticated Plan-and-Execute agents marks a significant advancement in AI capabilities, offering us smarter, more reliable tools for tackling increasingly complex challenges.<\/p>\n<\/div>\n<\/div>\n<\/section>\n\n\n\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\">\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\"><\/div>\n<\/div>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>Evolution from Action to Plan-and-Execute Traditional \u201cAction Agents\u201d followed a framework where user input was received, the agent decided on a tool to use, and this process was repeated until the agent responded to the user. However, the need for a more advanced system arose as user objectives became more intricate and developers began to [&hellip;]<\/p>\n","protected":false},"author":68,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"customer_name":"","customer_description":"","customer_industry":"","customer_technologies":"","customer_logo":"","footnotes":""},"categories":[65,7],"tags":[70,71,52,31,34],"coauthors":[166],"class_list":["post-8485","post","type-post","status-publish","format-standard","hentry","category-llmops","category-tutorials","tag-langchain","tag-language-models","tag-llm","tag-llmops","tag-prompt-engineering"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Plan-and-Execute Agents in Langchain - Comet<\/title>\n<meta name=\"description\" content=\"Plan-and-execute agents accomplish objectives by planning what to do and executing the sub-tasks using a planner Agent and executor Agent\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Plan-and-Execute Agents in Langchain\" \/>\n<meta property=\"og:description\" content=\"Plan-and-execute agents accomplish objectives by planning what to do and executing the sub-tasks using a planner Agent and executor Agent\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/\" \/>\n<meta property=\"og:site_name\" content=\"Comet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cometdotml\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-17T16:45:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-24T17:03:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*pmTMECIkzMMrWJ5d\" \/>\n<meta name=\"author\" content=\"Harpreet Sahota\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Cometml\" \/>\n<meta name=\"twitter:site\" content=\"@Cometml\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Harpreet Sahota\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Plan-and-Execute Agents in Langchain - Comet","description":"Plan-and-execute agents accomplish objectives by planning what to do and executing the sub-tasks using a planner Agent and executor Agent","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/","og_locale":"en_US","og_type":"article","og_title":"Plan-and-Execute Agents in Langchain","og_description":"Plan-and-execute agents accomplish objectives by planning what to do and executing the sub-tasks using a planner Agent and executor Agent","og_url":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/","og_site_name":"Comet","article_publisher":"https:\/\/www.facebook.com\/cometdotml","article_published_time":"2023-12-17T16:45:11+00:00","article_modified_time":"2025-04-24T17:03:49+00:00","og_image":[{"url":"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*pmTMECIkzMMrWJ5d","type":"","width":"","height":""}],"author":"Harpreet Sahota","twitter_card":"summary_large_image","twitter_creator":"@Cometml","twitter_site":"@Cometml","twitter_misc":{"Written by":"Harpreet Sahota","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/#article","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/"},"author":{"name":"Harpreet Sahota","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/46036ab474aa916e2873daece26a28d6"},"headline":"Plan-and-Execute Agents in Langchain","datePublished":"2023-12-17T16:45:11+00:00","dateModified":"2025-04-24T17:03:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/"},"wordCount":780,"publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*pmTMECIkzMMrWJ5d","keywords":["LangChain","Language Models","LLM","LLMOps","Prompt Engineering"],"articleSection":["LLMOps","Tutorials"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/","url":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/","name":"Plan-and-Execute Agents in Langchain - Comet","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/#primaryimage"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*pmTMECIkzMMrWJ5d","datePublished":"2023-12-17T16:45:11+00:00","dateModified":"2025-04-24T17:03:49+00:00","description":"Plan-and-execute agents accomplish objectives by planning what to do and executing the sub-tasks using a planner Agent and executor Agent","breadcrumb":{"@id":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/#primaryimage","url":"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*pmTMECIkzMMrWJ5d","contentUrl":"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*pmTMECIkzMMrWJ5d"},{"@type":"BreadcrumbList","@id":"https:\/\/www.comet.com\/site\/blog\/plan-and-execute-agents-in-langchain\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.comet.com\/site\/"},{"@type":"ListItem","position":2,"name":"Plan-and-Execute Agents in Langchain"}]},{"@type":"WebSite","@id":"https:\/\/www.comet.com\/site\/#website","url":"https:\/\/www.comet.com\/site\/","name":"Comet","description":"Build Better Models Faster","publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.comet.com\/site\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.comet.com\/site\/#organization","name":"Comet ML, Inc.","alternateName":"Comet","url":"https:\/\/www.comet.com\/site\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","width":310,"height":310,"caption":"Comet ML, Inc."},"image":{"@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cometdotml","https:\/\/x.com\/Cometml","https:\/\/www.youtube.com\/channel\/UCmN63HKvfXSCS-UwVwmK8Hw"]},{"@type":"Person","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/46036ab474aa916e2873daece26a28d6","name":"Harpreet Sahota","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/image\/2d21512be19ba7e19a71a803309e2a88","url":"https:\/\/secure.gravatar.com\/avatar\/a6ca5a533fc9f143a0a7428037ff652aa0633d66bf27e76ae89b955ae72a0f2d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a6ca5a533fc9f143a0a7428037ff652aa0633d66bf27e76ae89b955ae72a0f2d?s=96&d=mm&r=g","caption":"Harpreet Sahota"},"url":"https:\/\/www.comet.com\/site\/blog\/author\/theartistsofdatasciencegmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/8485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/users\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/comments?post=8485"}],"version-history":[{"count":1,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/8485\/revisions"}],"predecessor-version":[{"id":15418,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/8485\/revisions\/15418"}],"wp:attachment":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/media?parent=8485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/categories?post=8485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/tags?post=8485"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/coauthors?post=8485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}