{"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/stateact-state-tracking-and-reasoning-for","title":"StateAct: State Tracking and Reasoning for Acting and Planning with Large Language Models","arxiv_id":"2410.02810","date":"2024-09-21","proceeding":null,"authors":["Nikolai Rozanov","Marek Rei"],"abstract":"Planning and acting to solve `real' tasks using large language models (LLMs) in interactive environments has become a new frontier for AI methods. While recent advances allowed LLMs to interact with online tools, solve robotics tasks and many more, long range reasoning tasks remain a problem for LLMs. Existing methods to address this issue are very resource intensive and require additional data or human crafted rules, instead, we propose a simple method based on few-shot in-context learning alone to enhance `chain-of-thought' with state-tracking for planning and acting with LLMs. We show that our method establishes the new state-of-the-art on Alfworld for in-context learning methods (+14\\% over the previous best few-shot in-context learning method) and performs on par with methods that use additional training data and additional tools such as code-execution. We also demonstrate that our enhanced `chain-of-states' allows the agent to both solve longer horizon problems and to be more efficient in number of steps required to solve a task. We show that our method works across a variety of LLMs for both API-based and open source ones. Finally, we also conduct ablation studies and show that `chain-of-thoughts' helps state-tracking accuracy, while a json-structure harms overall performance. We open-source our code and annotations at https://github.com/ai-nikolai/StateAct.","url_abs":"https://arxiv.org/abs/2410.02810v2","url_pdf":"https://arxiv.org/pdf/2410.02810v2.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":"stateact-state-tracking-and-reasoning-for","repo_url":"https://github.com/ai-nikolai/stateact","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"in-context-learning","task_name":"In-Context Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2410.02810","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.02810"}},"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/ai-nikolai/stateact","reach":{"status":"ok"}}],"summary":{"ran":11,"ran_draft_wrong":1,"unverified":7},"by_repo_kind":{"official":{"samples":19,"ran":12,"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":19,"samples":[{"code_sha256_prefix":"2ab8b87e8d7a5b77","entry":"extract_command_and_format","repo":"ai-nikolai/stateact","repo_kind":"official","path":"alfworld_runs/alfworld_react_prompt_utils.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/alfworld_runs/alfworld_react_prompt_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2ab8b87e8d7a5b77"}},{"code_sha256_prefix":"6077500f2a5fe7bb","entry":"general_action_cleaning","repo":"ai-nikolai/stateact","repo_kind":"official","path":"alfworld_runs/alfworld_run.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/alfworld_runs/alfworld_run.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6077500f2a5fe7bb"}},{"code_sha256_prefix":"615dc37d09ed8ef9","entry":"get_env_type","repo":"ai-nikolai/stateact","repo_kind":"official","path":"alfworld_runs/alfworld_run.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/alfworld_runs/alfworld_run.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"615dc37d09ed8ef9"}},{"code_sha256_prefix":"bee05b7b2b0ae815","entry":"parse_expression","repo":"ai-nikolai/stateact","repo_kind":"official","path":"textcraft_runs/run_textcraft_adapt.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/textcraft_runs/run_textcraft_adapt.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bee05b7b2b0ae815"}},{"code_sha256_prefix":"df43aebbc0d02eb2","entry":"parse_results","repo":"ai-nikolai/stateact","repo_kind":"official","path":"webshop_runs/transform.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/webshop_runs/transform.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"df43aebbc0d02eb2"}},{"code_sha256_prefix":"9eae20ece0fa12fe","entry":"phi","repo":"ai-nikolai/stateact","repo_kind":"official","path":"textcraft_runs/run_textcraft_thread.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/textcraft_runs/run_textcraft_thread.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9eae20ece0fa12fe"}},{"code_sha256_prefix":"163b27b8444b232b","entry":"plan_to_args","repo":"ai-nikolai/stateact","repo_kind":"official","path":"textcraft_runs/run_textcraft_adapt.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/textcraft_runs/run_textcraft_adapt.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"163b27b8444b232b"}},{"code_sha256_prefix":"142de1580a8559de","entry":"psi","repo":"ai-nikolai/stateact","repo_kind":"official","path":"textcraft_runs/run_textcraft_thread.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/textcraft_runs/run_textcraft_thread.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"142de1580a8559de"}},{"code_sha256_prefix":"2757e9521faf9ae2","entry":"remove_keys","repo":"ai-nikolai/stateact","repo_kind":"official","path":"alfworld_runs/alfworld_ablation_generator.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/alfworld_runs/alfworld_ablation_generator.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2757e9521faf9ae2"}},{"code_sha256_prefix":"2a292e9393408367","entry":"transform_baseprompt_into_jsonstate_string","repo":"ai-nikolai/stateact","repo_kind":"official","path":"alfworld_runs/alfworld_ablation_generator.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/alfworld_runs/alfworld_ablation_generator.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2a292e9393408367"}},{"code_sha256_prefix":"19fd321d955bf1c7","entry":"transform_baseprompt_into_stringstate_string","repo":"ai-nikolai/stateact","repo_kind":"official","path":"alfworld_runs/alfworld_ablation_generator.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/alfworld_runs/alfworld_ablation_generator.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"19fd321d955bf1c7"}},{"code_sha256_prefix":"5ac406ca03d4dcc5","entry":"transform_put_action","repo":"ai-nikolai/stateact","repo_kind":"official","path":"alfworld_runs/alfworld_run.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/alfworld_runs/alfworld_run.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5ac406ca03d4dcc5"}},{"code_sha256_prefix":"0b9398a05fe8427e","entry":"llm","repo":"ai-nikolai/stateact","repo_kind":"official","path":"textcraft_runs/run_textcraft_adapt.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/textcraft_runs/run_textcraft_adapt.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0b9398a05fe8427e"}},{"code_sha256_prefix":"fa6aecfd93116153","entry":"llm","repo":"ai-nikolai/stateact","repo_kind":"official","path":"webshop_runs/run_webshop_adapted.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/webshop_runs/run_webshop_adapted.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fa6aecfd93116153"}},{"code_sha256_prefix":"fa828596043c1e90","entry":"llm_chat","repo":"ai-nikolai/stateact","repo_kind":"official","path":"webshop_runs/run_webshop_adapted.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/webshop_runs/run_webshop_adapted.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fa828596043c1e90"}},{"code_sha256_prefix":"8377ace36b15d7c1","entry":"llm_tropic","repo":"ai-nikolai/stateact","repo_kind":"official","path":"webshop_runs/run_webshop_adapted.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/webshop_runs/run_webshop_adapted.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8377ace36b15d7c1"}},{"code_sha256_prefix":"c67ce7ef9daabda8","entry":"load_results","repo":"ai-nikolai/stateact","repo_kind":"official","path":"alfworld_runs/get_score.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/alfworld_runs/get_score.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c67ce7ef9daabda8"}},{"code_sha256_prefix":"2173d108b18e06c8","entry":"return_json_react_examples","repo":"ai-nikolai/stateact","repo_kind":"official","path":"alfworld_runs/alfworld_react_prompt_utils.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/alfworld_runs/alfworld_react_prompt_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2173d108b18e06c8"}},{"code_sha256_prefix":"8515d68e79091391","entry":"return_react_examples","repo":"ai-nikolai/stateact","repo_kind":"official","path":"alfworld_runs/alfworld_react_prompt_utils.py","file_url":"https://github.com/ai-nikolai/stateact/blob/HEAD/alfworld_runs/alfworld_react_prompt_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8515d68e79091391"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}