{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/promptagent-strategic-planning-with-language","title":"PromptAgent: Strategic Planning with Language Models Enables Expert-level Prompt Optimization","arxiv_id":"2310.16427","date":"2023-10-25","proceeding":null,"authors":["Xinyuan Wang","Chenxi Li","Zhen Wang","Fan Bai","Haotian Luo","Jiayou Zhang","Nebojsa Jojic","Eric P. Xing","Zhiting Hu"],"abstract":"Highly effective, task-specific prompts are often heavily engineered by experts to integrate detailed instructions and domain insights based on a deep understanding of both instincts of large language models (LLMs) and the intricacies of the target task. However, automating the generation of such expert-level prompts remains elusive. Existing prompt optimization methods tend to overlook the depth of domain knowledge and struggle to efficiently explore the vast space of expert-level prompts. Addressing this, we present PromptAgent, an optimization method that autonomously crafts prompts equivalent in quality to those handcrafted by experts. At its core, PromptAgent views prompt optimization as a strategic planning problem and employs a principled planning algorithm, rooted in Monte Carlo tree search, to strategically navigate the expert-level prompt space. Inspired by human-like trial-and-error exploration, PromptAgent induces precise expert-level insights and in-depth instructions by reflecting on model errors and generating constructive error feedback. Such a novel framework allows the agent to iteratively examine intermediate prompts (states), refine them based on error feedbacks (actions), simulate future rewards, and search for high-reward paths leading to expert prompts. We apply PromptAgent to 12 tasks spanning three practical domains: BIG-Bench Hard (BBH), as well as domain-specific and general NLP tasks, showing it significantly outperforms strong Chain-of-Thought and recent prompt optimization baselines. Extensive analyses emphasize its capability to craft expert-level, detailed, and domain-insightful prompts with great efficiency and generalizability.","url_abs":"https://arxiv.org/abs/2310.16427v2","url_pdf":"https://arxiv.org/pdf/2310.16427v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"promptagent-strategic-planning-with-language","repo_url":"https://github.com/xinyuanwangcs/promptagent","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"promptagent-strategic-planning-with-language","repo_url":"https://github.com/karayanni/structurease","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"navigate","task_name":"Navigate"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2310.16427","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.16427"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/xinyuanwangcs/promptagent","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/karayanni/structurease","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":4,"unverified":15},"by_repo_kind":{"official":{"samples":5,"ran":4,"repositories":1},"listed":{"samples":14,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"ff90ff7b4449ccf2","entry":"create_logger","repo":"xinyuanwangcs/promptagent","repo_kind":"official","path":"src/prompt_optim_agent/utils.py","file_url":"https://github.com/xinyuanwangcs/promptagent/blob/HEAD/src/prompt_optim_agent/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ff90ff7b4449ccf2"}},{"code_sha256_prefix":"e4736e9992d1de49","entry":"is_chunk_end","repo":"xinyuanwangcs/promptagent","repo_kind":"official","path":"src/tasks/ncbi.py","file_url":"https://github.com/xinyuanwangcs/promptagent/blob/HEAD/src/tasks/ncbi.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e4736e9992d1de49"}},{"code_sha256_prefix":"405fd06f23bf2a87","entry":"is_chunk_start","repo":"xinyuanwangcs/promptagent","repo_kind":"official","path":"src/tasks/ncbi.py","file_url":"https://github.com/xinyuanwangcs/promptagent/blob/HEAD/src/tasks/ncbi.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"405fd06f23bf2a87"}},{"code_sha256_prefix":"f9a22a5ce23105fd","entry":"split_tag","repo":"xinyuanwangcs/promptagent","repo_kind":"official","path":"src/tasks/ncbi.py","file_url":"https://github.com/xinyuanwangcs/promptagent/blob/HEAD/src/tasks/ncbi.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f9a22a5ce23105fd"}},{"code_sha256_prefix":"4f76d3cd1e441183","entry":"ImprovePrompt","repo":"karayanni/structurease","repo_kind":"listed","path":"PromptCreationFlow/PromptImprovementStep.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/PromptCreationFlow/PromptImprovementStep.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4f76d3cd1e441183"}},{"code_sha256_prefix":"1d17c85bcc65edb6","entry":"InitialGenerateClassificationPrompt","repo":"karayanni/structurease","repo_kind":"listed","path":"PromptCreationFlow/ClassificationPromptGeneration.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/PromptCreationFlow/ClassificationPromptGeneration.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1d17c85bcc65edb6"}},{"code_sha256_prefix":"5332965d29e0a6d6","entry":"classification_using_llm","repo":"karayanni/structurease","repo_kind":"listed","path":"Evaluation/EvaluatePrompt.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/Evaluation/EvaluatePrompt.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5332965d29e0a6d6"}},{"code_sha256_prefix":"ea3228b60ee75404","entry":"evaluate_classification_accuracy","repo":"karayanni/structurease","repo_kind":"listed","path":"Evaluation/EvaluateOutputFile.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/Evaluation/EvaluateOutputFile.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ea3228b60ee75404"}},{"code_sha256_prefix":"e041cf790e68003b","entry":"evaluate_classification_accuracy","repo":"karayanni/structurease","repo_kind":"listed","path":"Evaluation/temp.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/Evaluation/temp.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e041cf790e68003b"}},{"code_sha256_prefix":"725d28343ca4ee57","entry":"evaluate_manual_to_llm_df","repo":"karayanni/structurease","repo_kind":"listed","path":"Evaluation/EvaluateCurrentPromptOnEntireDS.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/Evaluation/EvaluateCurrentPromptOnEntireDS.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"725d28343ca4ee57"}},{"code_sha256_prefix":"0787b09ede80ffb2","entry":"evaluate_manual_to_llm_df","repo":"karayanni/structurease","repo_kind":"listed","path":"PromptCreationFlow/ChooseLabelingData.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/PromptCreationFlow/ChooseLabelingData.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0787b09ede80ffb2"}},{"code_sha256_prefix":"d614ff0573a148ab","entry":"exponential_backoff_retry","repo":"karayanni/structurease","repo_kind":"listed","path":"Evaluation/EvaluateCurrentPromptOnEntireDS.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/Evaluation/EvaluateCurrentPromptOnEntireDS.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d614ff0573a148ab"}},{"code_sha256_prefix":"acadf8a5b1c39943","entry":"exponential_backoff_retry","repo":"karayanni/structurease","repo_kind":"listed","path":"PromptCreationFlow/ClassificationPromptGeneration.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/PromptCreationFlow/ClassificationPromptGeneration.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"acadf8a5b1c39943"}},{"code_sha256_prefix":"822eda707ef35c73","entry":"exponential_backoff_retry","repo":"karayanni/structurease","repo_kind":"listed","path":"PromptCreationFlow/EvaluateCurrentPrompt.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/PromptCreationFlow/EvaluateCurrentPrompt.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"822eda707ef35c73"}},{"code_sha256_prefix":"f13ea50d50bffac3","entry":"extract_classification_number","repo":"karayanni/structurease","repo_kind":"listed","path":"Evaluation/EvaluateCurrentPromptOnEntireDS.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/Evaluation/EvaluateCurrentPromptOnEntireDS.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f13ea50d50bffac3"}},{"code_sha256_prefix":"1089b70c19023e24","entry":"extract_classification_number","repo":"karayanni/structurease","repo_kind":"listed","path":"Evaluation/EvaluatePrompt.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/Evaluation/EvaluatePrompt.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1089b70c19023e24"}},{"code_sha256_prefix":"5270fe06945781dd","entry":"extract_classification_number","repo":"karayanni/structurease","repo_kind":"listed","path":"PromptCreationFlow/ChooseLabelingData.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/PromptCreationFlow/ChooseLabelingData.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5270fe06945781dd"}},{"code_sha256_prefix":"e0b75026e83eb284","entry":"extract_classification_number","repo":"karayanni/structurease","repo_kind":"listed","path":"PromptCreationFlow/EvaluateCurrentPrompt.py","file_url":"https://github.com/karayanni/structurease/blob/HEAD/PromptCreationFlow/EvaluateCurrentPrompt.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e0b75026e83eb284"}},{"code_sha256_prefix":"7aff0c6a7e5e52d0","entry":"parse_model_args","repo":"xinyuanwangcs/promptagent","repo_kind":"official","path":"src/prompt_optim_agent/utils.py","file_url":"https://github.com/xinyuanwangcs/promptagent/blob/HEAD/src/prompt_optim_agent/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7aff0c6a7e5e52d0"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}