{"id":27645829,"url":"https://github.com/zfw1226/d2a","last_synced_at":"2025-04-24T01:13:10.771Z","repository":{"id":267651483,"uuid":"900328182","full_name":"zfw1226/D2A","owner":"zfw1226","description":"Simulating Human-like Daily Activities with Desire-driven Autonomy","archived":false,"fork":false,"pushed_at":"2025-03-14T03:59:12.000Z","size":19875,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T01:13:02.925Z","etag":null,"topics":["autonomous-agents","intrinsic-motivation","llm-based-agent","text-based-game"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zfw1226.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-08T13:55:33.000Z","updated_at":"2025-04-18T07:36:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"17ba0d17-b50d-4a5e-8e88-d5e8b5d796b2","html_url":"https://github.com/zfw1226/D2A","commit_stats":null,"previous_names":["zfw1226/d2a"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfw1226%2FD2A","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfw1226%2FD2A/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfw1226%2FD2A/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfw1226%2FD2A/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zfw1226","download_url":"https://codeload.github.com/zfw1226/D2A/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250540924,"owners_count":21447427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autonomous-agents","intrinsic-motivation","llm-based-agent","text-based-game"],"created_at":"2025-04-24T01:13:10.147Z","updated_at":"2025-04-24T01:13:10.758Z","avatar_url":"https://github.com/zfw1226.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# D2A\n**\\[ICLR 2025\\] Simulating Human-like Daily Activities with Desire-driven Autonomy**\n\npaper link: [http://arxiv.org/abs/2412.06435](http://arxiv.org/abs/2412.06435)\n\n![GIF](imgs/video_v3.gif)\n## Abstract\n\nExisting task-oriented AI agents often depend on explicit instructions or external rewards, limiting their ability to be driven by intrinsic motivations like humans. In this paper, we present a desire-driven autonomy framework to guide a Large Language Model based(LLM-based) agent to simulate human-like daily activities. In contrast to previous agents, our Desire-driven Autonomous Agent (D2A) operates on the principle of intrinsic desire, allowing it to propose and select tasks that fulfill its motivational framework autonomously. Inspired by the Theory of Needs, the motivational framework incorporates an understanding of human-like desires, such as the need for social interaction, personal fulfillment, and self-care. Utilizing a desire-driven task generation mechanism, the agent evaluates its current state and takes a sequence of activities aligned with its intrinsic motivations. Through simulations, we demonstrate that our Desire-driven Autonomous Agent (D2A) generates coherent, contextually relevant daily activities while exhibiting variability and adaptability similar to human behavior. A comparative analysis with other LLM-based frameworks demonstrates that our approach significantly enhances the rationality of the simulated activities\n\n## Desire-driven Autonomous Agent Framework\n\n![image](imgs/framework.png)\n\n## Environment\n1. Clone D2A:\n```bash\ngit clone https://github.com/zfw1226/D2A\ncd D2A\n```\n2. Install the D2A module\n```bash\nconda env create -f environment_D2A.yml\nconda activate D2A\n```\n3. Re-install the Concordia module (in the `D2A` folder that contains `concordia` and `examples`)\n```bash\npip install -e .[dev]\n```\n\n\n## Usage\n\nThe D2A environment is under the `examples/D2A` folder.\n\nIn D2A folder the file structure is:\n```\nexamples/\n├── D2A/\n│   ├── Baseline_agent/\n│   │   ├── BabyAGI_ActComp.py\n│   │   ├── Baseline_BabyAGI.py\n│   │   ├── Baseline_comp.py\n│   │   ├── Baseline_LLMob.py\n│   │   ├── Baseline_ReAct.py\n│   │   ├── LLMob_ActComp.py\n│   │   └── ReAct_ActComp.py\n│   └── D2A_agent/\n│       ├── Value_ActComp.py\n│       └── ValueAgent.py\n├── Environment_construction/\n│   └── generate_indoor_situation.py\n├── NPC_agent/\n│   └── generic_support_agent.py\n├── result_folder/\n├── value_components/\n│   ├── hardcoded_value_state.py\n│   └── init_value_info_social.py\n│\n├── value_comp.py\n├── __init__.py\n├── experiment_setup_indoor.py\n├── experiment_setup_outdoor.py\n├── indoor_Room.py\n├── NullObservation.py\n└── outdoor_party.py\n```\n\n## Usage\n\n\n### Run the simulation\n1. Set up the **environment dependencies** by following **Environment** section\n\n2. Set up the **experiment setting** in `experiment_setup_indoor.py` and `experiment_setup_outdoor.py`\n   - ROOT (the root path of the project, the folder which has `concordia` and `examples` in it)\n   - episode_length\n   - disable_language_model\n   - st_model\n   - tested_agents\n   - whether to use previous profile\n     - Use_Previous_profile\n     - previous_profile_file\n     - previous_profile\n     - previous_profile's path\n   - Backbone LLM (details refers to concordia package)\n     - api_type\n     - model_name\n     - api_key\n   - desires-related stuff (the desire dimensions to be used while simulating)\n     - visible_desires (will appear in the context as the hint for the agent)\n     - hidden_desires (will not appear in the context as the hint for the agent)\n   - the path to store the result\n\n3. **run the simulation** by `python PATH/to/indoor_Room.py` or `python PATH/to/outdoor_party.py`\n\n## To modify desire-related components, navigate to the `value_components` folder and follow these steps across different files:\n_assume that we want to add a new desire called `sense of wonder`_\n### value_comp.py\n1. create the new desire component subclass in `value_comp.py`\n  ```python\n  # example:\n  class SenseOfWonderWithoutPreAct(desireWithoutPreAct):\n    def __init__(self, *args, **kwargs):\n        super().__init__(**kwargs)\n  class SenseOfWonder(desire):\n    def __init__(self, *args, **kwargs):\n        super().__init__(**kwargs)\n  ```\n### init_value_info_social.py\n1. Modify the profile_dict by adding a new entry:\n  ```python\n    # {\"descriptive_adjective\": \"desire_name\"}\n    # example:\n    profile_dict = {\n      'gluttonous': 'hunger',\n      # ...\n      \"curious\": \"sense of wonder\",\n    }\n  ```\n2. Add the desire name to the `values_names` list\n  ```python\n    values_names = [\n      'hunger',\n      # ...\n      \"sense of wonder\",\n  ]\n  ```\n3. Add corresponding descriptions to `values_names_descriptions`\n  ```python\n  values_names_descriptions = {\n    'hunger': 'The value....',\n    # ....\n    'sense of wonder': \"The value of sense of wonder ranges from 0 to 10. A score of 0 means you feel no curiosity or amazement about the world, lacking any interest in exploration or new experiences, while a score of 10 means you are deeply fascinated and captivated by the world around you, constantly seeking to discover, learn, and marvel at new things.\"\n  }\n  ```\n4. Add corresponding subclass to `get_all_desire_components` and `get_all_desire_components_without_PreAct`.\n  ```python\n  def get_all_desire_components_without_PreAct():\n    for desire in wanted_desires:\n      if desire == 'hunger':\n        init = value_comp.HungerWithoutPreAct\n      # ......\n      elif desire == 'sense of wonder':\n        init = value_comp.SenseOfWonderWithoutPreAct\n      # ......\n\n  def get_all_desire_components():\n    for desire in wanted_desires:\n      if desire == 'hunger':\n        init = value_comp.Hunger\n      # ......\n      elif desire == 'sense of wonder':\n        init = value_comp.SenseOfWonder\n      # ......\n  ```\n### hardcoded_value_state.py\n1. Add numerical value mappings to `hardcore_state`. You can use GPT to design appropriate mapping scales.\n  ```python\n  hardcode_state = {\n    'hunger': {'...': '.....'},\n    # ......\n    'sense of wonder': {\n      0: \"No curiosity or amazement about the world, lacking any interest in exploration or new experiences.\",\n      1: \"Very low sense of wonder, rarely feeling curious or amazed by anything.\",\n      2: \"Minimal sense of wonder, occasionally feeling a slight curiosity about the world.\",\n      3: \"Somewhat low sense of wonder, infrequently feeling a mild interest in new experiences.\",\n      4: \"Slight sense of wonder, occasionally feeling curious or amazed by certain things.\",\n      5: \"Moderate sense of wonder, sometimes feeling curious and interested in exploring new things.\",\n      6: \"Noticeable sense of wonder, often feeling curious and amazed by many aspects of the world.\",\n      7: \"Strong sense of wonder, frequently feeling a deep fascination and desire to explore and understand the world.\",\n      8: \"Very strong sense of wonder, consistently feeling captivated and eager to discover new things.\",\n      9: \"Extremely strong sense of wonder, feeling intensely curious and amazed by almost everything around you.\",\n      10: \"Complete sense of wonder, deeply fascinated and constantly seeking to discover, learn, and marvel at new things.\"\n    }\n  }\n  ```\n  The prompt can be like:\n  ```python\n  prompt = (\n    \"describe 'sense of wonder' in the format of the example, sense of wonder is defined as: The value of sense of wonder ranges from 0 to 10. A score of 0 means you feel no curiosity or amazement about the world, lacking any interest in exploration or new experiences, while a score of 10 means you are deeply fascinated and captivated by the world around you, constantly seeking to discover, learn, and marvel at new things.\\n\"\n    \"Example: \\n\"\n    \"\"\"\n    'social connectivity': {\n        0: \"Completely isolated, lacking any meaningful social connections.\",\n        1: \"Very lonely, minimal social connectivity and rare interactions.\",\n        2: \"Disconnected, limited social interactions and frequent feelings of isolation.\",\n        3: \"Somewhat isolated, occasional social engagements but still feeling disconnected.\",\n        4: \"Slightly connected, some social interactions but not very strong or supportive.\",\n        5: \"Moderately connected, a few meaningful relationships and occasional social interactions.\",\n        6: \"Regularly engaged, growing network of social connections.\",\n        7: \"Socially connected, several meaningful and supportive relationships.\",\n        8: \"Highly connected, strong network of friends and supportive relationships.\",\n        9: \"Profoundly connected, deep and meaningful social relationships.\",\n        10: \"Highly socially connected, strong and supportive network of relationships.\"\n      }\n      \"\"\"\n    )\n  ```\n\n### experiment_setup_outdoor.py or experiment_setup_indoor.py\n1. Add desire name to `wanted_desires` and `hidden_desires(optional)`\n  ```python\n  wanted_desires = [\n  'hunger',\n  # ......\n  'sense of wonder'\n  ]\n  ```\n\n#### Optional: Enable LLM Value Conversion\nTo use LLM for action value conversion, reach `value_comp.py`\n- replace `_convert_numeric_desire_to_qualitative_by_hard_coding(self)` function in the `_make_pre_act_value(self)` with `_convert_numeric_desire_to_qualitative(self)`.\n\n## Citation D2A\nIf you use D2A in your work, please cite the article:\n```bibtex\n@article{wang2024simulating,\n  title={Simulating Human-like Daily Activities with Desire-driven Autonomy},\n  author={Wang, Yiding and Chen, Yuxuan and Zhong, Fangwei and Ma, Long and Wang, Yizhou},\n  journal={arXiv preprint arXiv:2412.06435},\n  year={2024}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfw1226%2Fd2a","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzfw1226%2Fd2a","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfw1226%2Fd2a/lists"}