agentsociety2 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. agentsociety2-2.0.0/.gitignore +64 -0
  2. agentsociety2-2.0.0/LICENSE +201 -0
  3. agentsociety2-2.0.0/PKG-INFO +427 -0
  4. agentsociety2-2.0.0/README.md +333 -0
  5. agentsociety2-2.0.0/agentsociety2/__init__.py +40 -0
  6. agentsociety2-2.0.0/agentsociety2/agent/__init__.py +4 -0
  7. agentsociety2-2.0.0/agentsociety2/agent/base.py +790 -0
  8. agentsociety2-2.0.0/agentsociety2/agent/donothing.py +167 -0
  9. agentsociety2-2.0.0/agentsociety2/agent/person.py +3145 -0
  10. agentsociety2-2.0.0/agentsociety2/backend/API_REFERENCE.md +348 -0
  11. agentsociety2-2.0.0/agentsociety2/backend/README.md +355 -0
  12. agentsociety2-2.0.0/agentsociety2/backend/__init__.py +2 -0
  13. agentsociety2-2.0.0/agentsociety2/backend/analysis/README.md +225 -0
  14. agentsociety2-2.0.0/agentsociety2/backend/analysis/__init__.py +95 -0
  15. agentsociety2-2.0.0/agentsociety2/backend/analysis/agents.py +977 -0
  16. agentsociety2-2.0.0/agentsociety2/backend/analysis/eda.py +147 -0
  17. agentsociety2-2.0.0/agentsociety2/backend/analysis/models.py +334 -0
  18. agentsociety2-2.0.0/agentsociety2/backend/analysis/prompts.py +78 -0
  19. agentsociety2-2.0.0/agentsociety2/backend/analysis/report_generator.py +802 -0
  20. agentsociety2-2.0.0/agentsociety2/backend/analysis/service.py +1081 -0
  21. agentsociety2-2.0.0/agentsociety2/backend/analysis/skills/00_xml_contract.md +9 -0
  22. agentsociety2-2.0.0/agentsociety2/backend/analysis/skills/10_visualization_reliability.md +15 -0
  23. agentsociety2-2.0.0/agentsociety2/backend/analysis/skills/20_core_skills.md +76 -0
  24. agentsociety2-2.0.0/agentsociety2/backend/analysis/skills/30_advanced_analysis.md +51 -0
  25. agentsociety2-2.0.0/agentsociety2/backend/analysis/tool_executor.py +620 -0
  26. agentsociety2-2.0.0/agentsociety2/backend/analysis/utils.py +334 -0
  27. agentsociety2-2.0.0/agentsociety2/backend/app.py +184 -0
  28. agentsociety2-2.0.0/agentsociety2/backend/models.py +68 -0
  29. agentsociety2-2.0.0/agentsociety2/backend/routers/__init__.py +5 -0
  30. agentsociety2-2.0.0/agentsociety2/backend/routers/chat.py +179 -0
  31. agentsociety2-2.0.0/agentsociety2/backend/routers/custom.py +331 -0
  32. agentsociety2-2.0.0/agentsociety2/backend/routers/experiments.py +485 -0
  33. agentsociety2-2.0.0/agentsociety2/backend/routers/literature.py +281 -0
  34. agentsociety2-2.0.0/agentsociety2/backend/routers/mineru.py +274 -0
  35. agentsociety2-2.0.0/agentsociety2/backend/routers/modules.py +71 -0
  36. agentsociety2-2.0.0/agentsociety2/backend/routers/prefill_params.py +176 -0
  37. agentsociety2-2.0.0/agentsociety2/backend/routers/replay.py +844 -0
  38. agentsociety2-2.0.0/agentsociety2/backend/routers/workspace.py +192 -0
  39. agentsociety2-2.0.0/agentsociety2/backend/run.py +47 -0
  40. agentsociety2-2.0.0/agentsociety2/backend/services/__init__.py +2 -0
  41. agentsociety2-2.0.0/agentsociety2/backend/services/completion_service.py +673 -0
  42. agentsociety2-2.0.0/agentsociety2/backend/services/custom/__init__.py +9 -0
  43. agentsociety2-2.0.0/agentsociety2/backend/services/custom/generator.py +168 -0
  44. agentsociety2-2.0.0/agentsociety2/backend/services/custom/scanner.py +274 -0
  45. agentsociety2-2.0.0/agentsociety2/backend/services/custom/script_generator.py +302 -0
  46. agentsociety2-2.0.0/agentsociety2/backend/sse/__init__.py +21 -0
  47. agentsociety2-2.0.0/agentsociety2/backend/sse/models.py +65 -0
  48. agentsociety2-2.0.0/agentsociety2/backend/tasks/__init__.py +5 -0
  49. agentsociety2-2.0.0/agentsociety2/backend/tasks/manager.py +327 -0
  50. agentsociety2-2.0.0/agentsociety2/backend/tools/__init__.py +2 -0
  51. agentsociety2-2.0.0/agentsociety2/backend/tools/analysis_workspace.py +310 -0
  52. agentsociety2-2.0.0/agentsociety2/backend/tools/base.py +95 -0
  53. agentsociety2-2.0.0/agentsociety2/backend/tools/data_analysis.py +155 -0
  54. agentsociety2-2.0.0/agentsociety2/backend/tools/experiment_analysis.py +596 -0
  55. agentsociety2-2.0.0/agentsociety2/backend/tools/experiment_config.py +1630 -0
  56. agentsociety2-2.0.0/agentsociety2/backend/tools/file_system.py +916 -0
  57. agentsociety2-2.0.0/agentsociety2/backend/tools/generate_paper.py +787 -0
  58. agentsociety2-2.0.0/agentsociety2/backend/tools/hypothesis.py +691 -0
  59. agentsociety2-2.0.0/agentsociety2/backend/tools/literature_models.py +173 -0
  60. agentsociety2-2.0.0/agentsociety2/backend/tools/literature_search.py +430 -0
  61. agentsociety2-2.0.0/agentsociety2/backend/tools/load_literature.py +362 -0
  62. agentsociety2-2.0.0/agentsociety2/backend/tools/miro_web_research.py +190 -0
  63. agentsociety2-2.0.0/agentsociety2/backend/tools/registry.py +161 -0
  64. agentsociety2-2.0.0/agentsociety2/backend/tools/run_experiment.py +755 -0
  65. agentsociety2-2.0.0/agentsociety2/backend/tools/run_shell_command.py +320 -0
  66. agentsociety2-2.0.0/agentsociety2/backend/tools/write_todo.py +180 -0
  67. agentsociety2-2.0.0/agentsociety2/code_executor/__init__.py +23 -0
  68. agentsociety2-2.0.0/agentsociety2/code_executor/api.py +191 -0
  69. agentsociety2-2.0.0/agentsociety2/code_executor/code_executor.py +96 -0
  70. agentsociety2-2.0.0/agentsociety2/code_executor/code_generator.py +284 -0
  71. agentsociety2-2.0.0/agentsociety2/code_executor/code_saver.py +88 -0
  72. agentsociety2-2.0.0/agentsociety2/code_executor/dependency_detector.py +203 -0
  73. agentsociety2-2.0.0/agentsociety2/code_executor/docker_runner.py +295 -0
  74. agentsociety2-2.0.0/agentsociety2/code_executor/local_executor.py +145 -0
  75. agentsociety2-2.0.0/agentsociety2/code_executor/models.py +130 -0
  76. agentsociety2-2.0.0/agentsociety2/code_executor/path_config.py +167 -0
  77. agentsociety2-2.0.0/agentsociety2/code_executor/runtime_config.py +118 -0
  78. agentsociety2-2.0.0/agentsociety2/config/__init__.py +17 -0
  79. agentsociety2-2.0.0/agentsociety2/config/config.py +673 -0
  80. agentsociety2-2.0.0/agentsociety2/config/list_models.py +92 -0
  81. agentsociety2-2.0.0/agentsociety2/contrib/__init__.py +0 -0
  82. agentsociety2-2.0.0/agentsociety2/contrib/agent/__init__.py +19 -0
  83. agentsociety2-2.0.0/agentsociety2/contrib/agent/commons_tragedy_agent.py +415 -0
  84. agentsociety2-2.0.0/agentsociety2/contrib/agent/llm_donor_agent.py +610 -0
  85. agentsociety2-2.0.0/agentsociety2/contrib/agent/prisoners_dilemma_agent.py +330 -0
  86. agentsociety2-2.0.0/agentsociety2/contrib/agent/public_goods_agent.py +354 -0
  87. agentsociety2-2.0.0/agentsociety2/contrib/agent/trust_game_agent.py +577 -0
  88. agentsociety2-2.0.0/agentsociety2/contrib/agent/volunteer_dilemma_agent.py +372 -0
  89. agentsociety2-2.0.0/agentsociety2/contrib/env/__init__.py +35 -0
  90. agentsociety2-2.0.0/agentsociety2/contrib/env/commons_tragedy.py +355 -0
  91. agentsociety2-2.0.0/agentsociety2/contrib/env/economy_space.py +359 -0
  92. agentsociety2-2.0.0/agentsociety2/contrib/env/endowment_effect.py +273 -0
  93. agentsociety2-2.0.0/agentsociety2/contrib/env/event_space.py +483 -0
  94. agentsociety2-2.0.0/agentsociety2/contrib/env/global_information.py +100 -0
  95. agentsociety2-2.0.0/agentsociety2/contrib/env/mobility_space/__init__.py +11 -0
  96. agentsociety2-2.0.0/agentsociety2/contrib/env/mobility_space/download_sim.py +56 -0
  97. agentsociety2-2.0.0/agentsociety2/contrib/env/mobility_space/environment.py +934 -0
  98. agentsociety2-2.0.0/agentsociety2/contrib/env/mobility_space/map.py +933 -0
  99. agentsociety2-2.0.0/agentsociety2/contrib/env/mobility_space/replay_tables.py +38 -0
  100. agentsociety2-2.0.0/agentsociety2/contrib/env/mobility_space/utils/__init__.py +13 -0
  101. agentsociety2-2.0.0/agentsociety2/contrib/env/mobility_space/utils/const.py +244 -0
  102. agentsociety2-2.0.0/agentsociety2/contrib/env/mobility_space/utils/map_utils.py +154 -0
  103. agentsociety2-2.0.0/agentsociety2/contrib/env/mobility_space/utils/port.py +54 -0
  104. agentsociety2-2.0.0/agentsociety2/contrib/env/prisoners_dilemma.py +288 -0
  105. agentsociety2-2.0.0/agentsociety2/contrib/env/public_goods.py +272 -0
  106. agentsociety2-2.0.0/agentsociety2/contrib/env/reputation_game.py +823 -0
  107. agentsociety2-2.0.0/agentsociety2/contrib/env/self_enhancement.py +290 -0
  108. agentsociety2-2.0.0/agentsociety2/contrib/env/self_reference_effect.py +570 -0
  109. agentsociety2-2.0.0/agentsociety2/contrib/env/simple_social_space.py +408 -0
  110. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/__init__.py +18 -0
  111. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/models.py +397 -0
  112. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommend.py +301 -0
  113. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/README.md +719 -0
  114. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/__init__.py +36 -0
  115. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/__init__.py +38 -0
  116. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/core.py +248 -0
  117. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/deepfm/__init__.py +12 -0
  118. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/deepfm/config.py +49 -0
  119. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/deepfm/model.py +431 -0
  120. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/din/__init__.py +12 -0
  121. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/din/config.py +53 -0
  122. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/din/model.py +689 -0
  123. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/lightgcn/__init__.py +12 -0
  124. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/lightgcn/config.py +43 -0
  125. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/lightgcn/model.py +435 -0
  126. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/mf/__init__.py +15 -0
  127. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/mf/config.py +34 -0
  128. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/mf/enhanced_config.py +93 -0
  129. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/mf/enhanced_model.py +427 -0
  130. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/mf/model.py +335 -0
  131. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/ncf/__init__.py +12 -0
  132. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/ncf/config.py +45 -0
  133. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/ncf/model.py +408 -0
  134. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/sasrec/__init__.py +14 -0
  135. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/sasrec/sasrec_algorithm.py +438 -0
  136. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/sasrec/sasrec_config.py +119 -0
  137. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/algorithms/sasrec/sasrec_model.py +391 -0
  138. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/metrics.py +266 -0
  139. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/models.py +110 -0
  140. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/service.py +236 -0
  141. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/storage.py +173 -0
  142. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/recommendation/trainer.py +229 -0
  143. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/replay_tables.py +105 -0
  144. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/schemas.py +144 -0
  145. agentsociety2-2.0.0/agentsociety2/contrib/env/social_media/social_media_space.py +1974 -0
  146. agentsociety2-2.0.0/agentsociety2/contrib/env/trust_game.py +471 -0
  147. agentsociety2-2.0.0/agentsociety2/contrib/env/volunteer_dilemma.py +247 -0
  148. agentsociety2-2.0.0/agentsociety2/custom/README.md +247 -0
  149. agentsociety2-2.0.0/agentsociety2/custom/__init__.py +16 -0
  150. agentsociety2-2.0.0/agentsociety2/custom/agents/__init__.py +23 -0
  151. agentsociety2-2.0.0/agentsociety2/custom/agents/examples/advanced_agent.py +137 -0
  152. agentsociety2-2.0.0/agentsociety2/custom/agents/examples/simple_agent.py +132 -0
  153. agentsociety2-2.0.0/agentsociety2/custom/envs/__init__.py +23 -0
  154. agentsociety2-2.0.0/agentsociety2/custom/envs/examples/advanced_env.py +164 -0
  155. agentsociety2-2.0.0/agentsociety2/custom/envs/examples/simple_env.py +157 -0
  156. agentsociety2-2.0.0/agentsociety2/designer/README_LITERATURE_SEARCH.md +139 -0
  157. agentsociety2-2.0.0/agentsociety2/designer/__init__.py +46 -0
  158. agentsociety2-2.0.0/agentsociety2/designer/agent_processing/__init__.py +28 -0
  159. agentsociety2-2.0.0/agentsociety2/designer/agent_processing/agent_file_processor.py +429 -0
  160. agentsociety2-2.0.0/agentsociety2/designer/agent_processing/agent_filter.py +876 -0
  161. agentsociety2-2.0.0/agentsociety2/designer/agent_processing/agent_generator.py +420 -0
  162. agentsociety2-2.0.0/agentsociety2/designer/agent_processing/agent_selector.py +439 -0
  163. agentsociety2-2.0.0/agentsociety2/designer/agent_processing/agent_supplement_checker.py +141 -0
  164. agentsociety2-2.0.0/agentsociety2/designer/agent_processing/field_metadata.py +87 -0
  165. agentsociety2-2.0.0/agentsociety2/designer/agent_processing/utils.py +42 -0
  166. agentsociety2-2.0.0/agentsociety2/designer/config_builder.py +678 -0
  167. agentsociety2-2.0.0/agentsociety2/designer/exp_designer.py +1782 -0
  168. agentsociety2-2.0.0/agentsociety2/designer/exp_executor.py +696 -0
  169. agentsociety2-2.0.0/agentsociety2/designer/exp_pipeline.py +137 -0
  170. agentsociety2-2.0.0/agentsociety2/designer/literature_search.py +739 -0
  171. agentsociety2-2.0.0/agentsociety2/env/__init__.py +22 -0
  172. agentsociety2-2.0.0/agentsociety2/env/base.py +460 -0
  173. agentsociety2-2.0.0/agentsociety2/env/benchmark.py +11 -0
  174. agentsociety2-2.0.0/agentsociety2/env/function_parser.py +339 -0
  175. agentsociety2-2.0.0/agentsociety2/env/pydantic_collector.py +133 -0
  176. agentsociety2-2.0.0/agentsociety2/env/router_base.py +1256 -0
  177. agentsociety2-2.0.0/agentsociety2/env/router_codegen.py +1488 -0
  178. agentsociety2-2.0.0/agentsociety2/env/router_plan_execute.py +602 -0
  179. agentsociety2-2.0.0/agentsociety2/env/router_react.py +418 -0
  180. agentsociety2-2.0.0/agentsociety2/env/router_search_tool.py +532 -0
  181. agentsociety2-2.0.0/agentsociety2/env/router_two_tier_plan_execute.py +466 -0
  182. agentsociety2-2.0.0/agentsociety2/env/router_two_tier_react.py +541 -0
  183. agentsociety2-2.0.0/agentsociety2/logger/__init__.py +366 -0
  184. agentsociety2-2.0.0/agentsociety2/mcp/README.md +513 -0
  185. agentsociety2-2.0.0/agentsociety2/mcp/__init__.py +20 -0
  186. agentsociety2-2.0.0/agentsociety2/mcp/models.py +82 -0
  187. agentsociety2-2.0.0/agentsociety2/mcp/registry.py +75 -0
  188. agentsociety2-2.0.0/agentsociety2/mcp/server.py +703 -0
  189. agentsociety2-2.0.0/agentsociety2/society/__init__.py +27 -0
  190. agentsociety2-2.0.0/agentsociety2/society/cli.py +554 -0
  191. agentsociety2-2.0.0/agentsociety2/society/helper.py +852 -0
  192. agentsociety2-2.0.0/agentsociety2/society/models.py +108 -0
  193. agentsociety2-2.0.0/agentsociety2/society/society.py +253 -0
  194. agentsociety2-2.0.0/agentsociety2/storage/__init__.py +28 -0
  195. agentsociety2-2.0.0/agentsociety2/storage/models.py +46 -0
  196. agentsociety2-2.0.0/agentsociety2/storage/replay_writer.py +285 -0
  197. agentsociety2-2.0.0/agentsociety2/storage/table_schema.py +98 -0
  198. agentsociety2-2.0.0/pyproject.toml +128 -0
@@ -0,0 +1,64 @@
1
+ scientist_demo/
2
+ docs/_build/
3
+ *.mo
4
+ .env
5
+ .python-version
6
+ .venv/
7
+ wheelhouse/
8
+ build/
9
+ .python-version
10
+ log/
11
+ /test
12
+ /test/
13
+ **/test/
14
+ **/tests/
15
+ test_*.py
16
+ *_test.py
17
+ cache/
18
+ ignore/
19
+ *.ipynb*
20
+ *.ipynb*/
21
+ *pycache*
22
+ *pycache*/
23
+ *.DS_Store*
24
+ *.DS_Store*/
25
+ dist/
26
+ *egg-info/
27
+ __*
28
+ !__init__.py
29
+ TODO
30
+ agentsociety-sim
31
+ agentsociety-ui
32
+ agentsociety_data/
33
+ .agentsociety-benchmark/
34
+ logs/
35
+ *.txt
36
+ *.pb
37
+ *.pb.*
38
+ venv_arm/
39
+ mobibench/
40
+ *.pkl
41
+ benchmark_results/
42
+ .agentsociety/
43
+ groundtruth/
44
+ .env.*
45
+ result_commons_tragedy_person_agent/
46
+ result_prisoners_dilemma_person_agent/
47
+ result_public_goods_person_agent/
48
+ result_trust_game_person_agent/
49
+ result_volunteer_dilemma_person_agent/
50
+ game_log/
51
+ *.json
52
+ .vscode/
53
+ *.template
54
+ NEXT_STEPS.md
55
+ PUBLISH_CHECKLIST.md
56
+
57
+ # Sphinx build outputs
58
+ packages/agentsociety2/docs/_build/
59
+ docs_v1/_build/
60
+
61
+ # User workspace (may contain API keys)
62
+ workspace/
63
+ packages/agentsociety2/venv/
64
+ packages/agentsociety2/.chainlit/
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2025] [FIB LAB, Tsinghua University]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,427 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentsociety2
3
+ Version: 2.0.0
4
+ Summary: A modern, LLM-native agent simulation platform for social science research
5
+ Project-URL: Homepage, https://github.com/tsinghua-fib-lab/agentsociety
6
+ Project-URL: Documentation, https://agentsociety2.readthedocs.io/
7
+ Project-URL: Repository, https://github.com/tsinghua-fib-lab/agentsociety.git
8
+ Project-URL: Issues, https://github.com/tsinghua-fib-lab/agentsociety/issues
9
+ Project-URL: Changelog, https://github.com/tsinghua-fib-lab/agentsociety/blob/main/CHANGELOG.md
10
+ Author-email: Jun Zhang <zhangjun990222@gmail.com>
11
+ Maintainer-email: Jun Zhang <zhangjun990222@gmail.com>
12
+ License: Apache-2.0
13
+ License-File: LICENSE
14
+ Keywords: agents,artificial-intelligence,experiment,llm,multi-agent,reinforcement-learning,simulation,social-science
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Science/Research
18
+ Classifier: License :: OSI Approved :: Apache Software License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.11
27
+ Requires-Dist: aiohttp>=3.10.11
28
+ Requires-Dist: aiosqlite>=0.20.0
29
+ Requires-Dist: black>=25.12.0
30
+ Requires-Dist: chromadb>=1.4.0
31
+ Requires-Dist: click>=8.0.0
32
+ Requires-Dist: dill>=0.4.0
33
+ Requires-Dist: doclayout-yolo>=0.0.4
34
+ Requires-Dist: elemental-xenon>=1.1.0
35
+ Requires-Dist: faiss-cpu>=1.7.0
36
+ Requires-Dist: fastapi>=0.128.0
37
+ Requires-Dist: fastmcp>=2.12.2
38
+ Requires-Dist: ftfy>=6.3.1
39
+ Requires-Dist: geojson>=3.1.0
40
+ Requires-Dist: greenlet>=3.0.0
41
+ Requires-Dist: json-repair>=0.46.2
42
+ Requires-Dist: litellm>=1.77.7
43
+ Requires-Dist: mcp[cli]>=1.13.1
44
+ Requires-Dist: mem0ai>=1.0.0
45
+ Requires-Dist: mineru[core]>=1.0.0
46
+ Requires-Dist: numpy<2.0.0,>=1.20.0
47
+ Requires-Dist: pandas>=2.0.0
48
+ Requires-Dist: prompt-toolkit>=3.0.51
49
+ Requires-Dist: pycityproto>=2.4.5
50
+ Requires-Dist: pyclipper>=1.4.0
51
+ Requires-Dist: pydantic>=2.10.4
52
+ Requires-Dist: pyproj>=3.6.0
53
+ Requires-Dist: python-dotenv>=1.0.0
54
+ Requires-Dist: pyyaml>=6.0.2
55
+ Requires-Dist: qdrant-client>=1.7.0
56
+ Requires-Dist: ruamel-yaml>=0.18.15
57
+ Requires-Dist: shapely>=2.0.6
58
+ Requires-Dist: sqlmodel>=0.0.16
59
+ Requires-Dist: stringcase>=1.2.0
60
+ Requires-Dist: sweetviz>=2.3.0
61
+ Requires-Dist: torch>=2.9.1
62
+ Requires-Dist: transformers>=4.57.3
63
+ Requires-Dist: ultralytics>=8.3.243
64
+ Requires-Dist: uvicorn>=0.35.0
65
+ Requires-Dist: ydata-profiling>=4.6.0
66
+ Provides-Extra: all
67
+ Requires-Dist: furo>=2024.8.6; extra == 'all'
68
+ Requires-Dist: mypy>=1.14.0; extra == 'all'
69
+ Requires-Dist: myst-parser>=4.0.0; extra == 'all'
70
+ Requires-Dist: pre-commit>=3.8.0; extra == 'all'
71
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'all'
72
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'all'
73
+ Requires-Dist: pytest>=9.0.2; extra == 'all'
74
+ Requires-Dist: ruff>=0.11.13; extra == 'all'
75
+ Requires-Dist: sphinx-autobuild>=2024.9.19; extra == 'all'
76
+ Requires-Dist: sphinx-autodoc2>=0.5.0; extra == 'all'
77
+ Requires-Dist: sphinx-intl==2.1.0; extra == 'all'
78
+ Requires-Dist: sphinx>=7.0.0; extra == 'all'
79
+ Provides-Extra: dev
80
+ Requires-Dist: mypy>=1.14.0; extra == 'dev'
81
+ Requires-Dist: pre-commit>=3.8.0; extra == 'dev'
82
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
83
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
84
+ Requires-Dist: pytest>=9.0.2; extra == 'dev'
85
+ Requires-Dist: ruff>=0.11.13; extra == 'dev'
86
+ Provides-Extra: docs
87
+ Requires-Dist: furo>=2024.8.6; extra == 'docs'
88
+ Requires-Dist: myst-parser>=4.0.0; extra == 'docs'
89
+ Requires-Dist: sphinx-autobuild>=2024.9.19; extra == 'docs'
90
+ Requires-Dist: sphinx-autodoc2>=0.5.0; extra == 'docs'
91
+ Requires-Dist: sphinx-intl==2.1.0; extra == 'docs'
92
+ Requires-Dist: sphinx>=7.0.0; extra == 'docs'
93
+ Description-Content-Type: text/markdown
94
+
95
+ # AgentSociety 2
96
+
97
+ [![PyPI Version](https://img.shields.io/pypi/v/agentsociety2.svg)](https://pypi.org/project/agentsociety2/)
98
+ [![Python Version](https://img.shields.io/pypi/pyversions/agentsociety2.svg)](https://pypi.org/project/agentsociety2/)
99
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
100
+ [![Documentation](https://img.shields.io/badge/docs-latest-brightgreen.svg)](https://agentsociety2.readthedocs.io/)
101
+ [![中文文档](https://img.shields.io/badge/docs-%E4%B8%AD%E6%96%87-red.svg)](https://agentsociety2.readthedocs.io/zh_CN/latest/)
102
+
103
+ > **AgentSociety 2** is a modern, LLM-native agent simulation platform designed for social science research and experimentation.
104
+
105
+ ## Features
106
+
107
+ - **LLM-Native Design**: Built from the ground up for LLM-driven agents
108
+ - **Flexible Environment System**: Modular environment components with hot-pluggable tools
109
+ - **Multiple Reasoning Patterns**: ReAct, Plan-Execute, Code Generation, and Two-Tier routers
110
+ - **Developer-Friendly**: Pythonic API with type hints and comprehensive documentation
111
+ - **Experiment Replay**: Full SQLite-based replay system for analysis and debugging
112
+ - **MCP Support**: Model Context Protocol integration for tool extensibility
113
+
114
+ ## Installation
115
+
116
+ ```bash
117
+ pip install agentsociety2
118
+ ```
119
+
120
+ ### Requirements
121
+
122
+ - Python >= 3.11
123
+ - An LLM API key (OpenAI, Anthropic, or any provider supported by litellm)
124
+
125
+ ## Quick Start
126
+
127
+ ### Create Your First Agent
128
+
129
+ ```python
130
+ import asyncio
131
+ from datetime import datetime
132
+ from agentsociety2 import PersonAgent
133
+ from agentsociety2.env import CodeGenRouter
134
+ from agentsociety2.contrib.env import SimpleSocialSpace
135
+ from agentsociety2.society import AgentSociety
136
+
137
+ async def main():
138
+ # Create an agent with a profile
139
+ agent = PersonAgent(
140
+ id=1,
141
+ profile={
142
+ "name": "Alice",
143
+ "age": 28,
144
+ "personality": "friendly and curious",
145
+ "bio": "A software engineer who loves hiking and reading."
146
+ }
147
+ )
148
+
149
+ # Create environment module with agent info
150
+ social_env = SimpleSocialSpace(
151
+ agent_id_name_pairs=[(agent.id, agent.name)]
152
+ )
153
+
154
+ # Create environment router
155
+ env_router = CodeGenRouter(env_modules=[social_env])
156
+
157
+ # Create the society
158
+ society = AgentSociety(
159
+ agents=[agent],
160
+ env_router=env_router,
161
+ start_t=datetime.now(),
162
+ )
163
+
164
+ # Initialize (sets up agents with environment)
165
+ await society.init()
166
+
167
+ # Query (read-only)
168
+ response = await society.ask("What's your favorite activity?")
169
+ print(f"Agent: {response}")
170
+
171
+ # Close the society
172
+ await society.close()
173
+
174
+ if __name__ == "__main__":
175
+ asyncio.run(main())
176
+ ```
177
+
178
+ ### Create a Custom Environment Module
179
+
180
+ ```python
181
+ from agentsociety2.env import EnvBase, tool
182
+
183
+ class MyCustomEnvironment(EnvBase):
184
+ """A custom environment module."""
185
+
186
+ @tool(readonly=True, kind="observe")
187
+ def get_weather(self, agent_id: int) -> str:
188
+ """Get the current weather for an agent."""
189
+ return "The weather is sunny and 25°C."
190
+
191
+ @tool(readonly=False)
192
+ def set_mood(self, agent_id: int, mood: str) -> str:
193
+ """Change the mood of an agent."""
194
+ return f"Agent {agent_id}'s mood is now {mood}."
195
+
196
+ # Use the custom module
197
+ from agentsociety2.env import ReActRouter
198
+
199
+ env = ReActRouter()
200
+ env.register_module(MyCustomEnvironment())
201
+ ```
202
+
203
+ ### Run a Complete Experiment
204
+
205
+ ```python
206
+ import asyncio
207
+ from datetime import datetime
208
+ from agentsociety2 import PersonAgent
209
+ from agentsociety2.env import CodeGenRouter
210
+ from agentsociety2.contrib.env import SimpleSocialSpace
211
+ from agentsociety2.storage import ReplayWriter
212
+ from agentsociety2.society import AgentSociety
213
+
214
+ async def main():
215
+ # Setup replay writer for experiment tracking
216
+ writer = ReplayWriter("my_experiment.db")
217
+ await writer.initialize()
218
+
219
+ # Create agents first (needed for SimpleSocialSpace)
220
+ agents = [
221
+ PersonAgent(id=i, profile={"name": f"Player{i}", "personality": "friendly"})
222
+ for i in range(1, 4)
223
+ ]
224
+
225
+ # Create environment router
226
+ env_router = CodeGenRouter(
227
+ env_modules=[SimpleSocialSpace(
228
+ agent_id_name_pairs=[(a.id, a.name) for a in agents]
229
+ )]
230
+ )
231
+ env_router.set_replay_writer(writer)
232
+
233
+ # Create the society with replay enabled
234
+ society = AgentSociety(
235
+ agents=agents,
236
+ env_router=env_router,
237
+ start_t=datetime.now(),
238
+ replay_writer=writer,
239
+ )
240
+ await society.init()
241
+
242
+ # Query (read-only)
243
+ answer = await society.ask("What are the names of all agents?")
244
+ print(f"Answer: {answer}")
245
+
246
+ # Intervene (read-write)
247
+ result = await society.intervene("Set all agents' happiness to 0.8")
248
+ print(f"Result: {result}")
249
+
250
+ await society.close()
251
+
252
+ if __name__ == "__main__":
253
+ asyncio.run(main())
254
+ ```
255
+
256
+ ## Core Concepts
257
+
258
+ ### Agents
259
+
260
+ Agents are autonomous entities that interact with environments through LLM-powered reasoning:
261
+
262
+ - **AgentBase**: Abstract base class for all agents
263
+ - **PersonAgent**: Ready-to-use person agent with memory and personality
264
+ - Agents support two interaction modes:
265
+ - `ask(question, readonly=True)`: Query without side effects
266
+ - `intervene(instruction)`: Make changes to the environment
267
+
268
+ ### Environment Modules
269
+
270
+ Environment modules encapsulate specific functionality through tools:
271
+
272
+ - **EnvBase**: Base class for creating custom modules
273
+ - **@tool decorator**: Register methods as discoverable tools
274
+ - Tool kinds:
275
+ - `observe`: Single-parameter observation functions
276
+ - `statistics`: No-parameter aggregation functions
277
+ - Regular tools: Full read/write operations
278
+
279
+ ### Routers
280
+
281
+ Routers mediate agent-environment interactions using different reasoning patterns:
282
+
283
+ - **ReActRouter**: Reasoning + Acting loop
284
+ - **PlanExecuteRouter**: Plan-first, then execute
285
+ - **CodeGenRouter**: Code generation based tool use
286
+ - **TwoTierReActRouter**: Two-level reasoning hierarchy
287
+ - **TwoTierPlanExecuteRouter**: Two-level planning hierarchy
288
+
289
+ ### Storage
290
+
291
+ The ReplayWriter system captures all interactions for analysis:
292
+
293
+ ```python
294
+ from agentsociety2.storage import ReplayWriter
295
+
296
+ writer = ReplayWriter("experiment.db")
297
+ await writer.initialize()
298
+
299
+ # Framework tables (auto-created):
300
+ # - agent_profile: Agent profiles
301
+ # - agent_status: Agent status over time
302
+ # - agent_dialog: Agent LLM interactions
303
+
304
+ # Custom tables
305
+ from agentsociety2.storage import ColumnDef, TableSchema
306
+ schema = TableSchema(
307
+ name="custom_metrics",
308
+ columns=[
309
+ ColumnDef(name="metric_id", dtype="INTEGER", primary_key=True),
310
+ ColumnDef(name="value", dtype="REAL"),
311
+ ]
312
+ )
313
+ writer.register_table(schema)
314
+ ```
315
+
316
+ ## Configuration
317
+
318
+ Set your LLM API credentials via environment variables:
319
+
320
+ **Required Configuration**
321
+
322
+ ```bash
323
+ # Default LLM (required - used for most operations)
324
+ export AGENTSOCIETY_LLM_API_KEY="your-api-key"
325
+ export AGENTSOCIETY_LLM_API_BASE="https://api.openai.com/v1"
326
+ export AGENTSOCIETY_LLM_MODEL="gpt-4o-mini"
327
+ ```
328
+
329
+ **Optional Configuration**
330
+
331
+ For specialized tasks, you can configure separate LLM instances:
332
+
333
+ ```bash
334
+ # Code Generation LLM (for code-related tasks)
335
+ # Falls back to default LLM if not set
336
+ export AGENTSOCIETY_CODER_LLM_API_KEY="your-coder-api-key"
337
+ export AGENTSOCIETY_CODER_LLM_API_BASE="https://api.openai.com/v1"
338
+ export AGENTSOCIETY_CODER_LLM_MODEL="gpt-4o"
339
+
340
+ # Nano LLM (for high-frequency, low-latency operations)
341
+ # Falls back to default LLM if not set
342
+ export AGENTSOCIETY_NANO_LLM_API_KEY="your-nano-api-key"
343
+ export AGENTSOCIETY_NANO_LLM_API_BASE="https://api.openai.com/v1"
344
+ export AGENTSOCIETY_NANO_LLM_MODEL="gpt-4o-mini"
345
+
346
+ # Embedding Model (for text embeddings and semantic search)
347
+ # Falls back to default LLM if not set
348
+ export AGENTSOCIETY_EMBEDDING_API_KEY="your-embedding-api-key"
349
+ export AGENTSOCIETY_EMBEDDING_API_BASE="https://api.openai.com/v1"
350
+ export AGENTSOCIETY_EMBEDDING_MODEL="text-embedding-3-small"
351
+ export AGENTSOCIETY_EMBEDDING_DIMS="1536"
352
+
353
+ # Data directory (optional, default: ./agentsociety_data)
354
+ export AGENTSOCIETY_HOME_DIR="/path/to/your/data"
355
+ ```
356
+
357
+ Or use a `.env` file:
358
+
359
+ ```bash
360
+ cp .env.example .env
361
+ # Edit .env with your credentials
362
+ ```
363
+
364
+ ## Examples
365
+
366
+ The `examples/` directory contains ready-to-run examples:
367
+
368
+ - `basics/`: Basic agent and environment usage
369
+ - `games/`: Classic game theory simulations
370
+ - Prisoner's Dilemma
371
+ - Public Goods Game
372
+ - Trust Game
373
+ - Volunteer's Dilemma
374
+ - Commons Tragedy
375
+ - `advanced/`: Advanced usage patterns
376
+ - Custom environment modules
377
+ - Multi-router setups
378
+ - Experiment replay and analysis
379
+
380
+ ## Documentation
381
+
382
+ - [English Documentation](https://agentsociety2.readthedocs.io/)
383
+ - [中文文档](https://agentsociety2.readthedocs.io/zh_CN/latest/)
384
+ - [API Reference](https://agentsociety2.readthedocs.io/en/latest/api.html)
385
+
386
+ ## Development
387
+
388
+ For development and contribution guidelines, see [DEVELOPMENT.md](DEVELOPMENT.md).
389
+
390
+ ### Contributing
391
+
392
+ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
393
+
394
+ ## Citation
395
+
396
+ If you use AgentSociety 2 in your research, please cite:
397
+
398
+ ```bibtex
399
+ @software{agentsociety2,
400
+ title = {AgentSociety 2: A Modern LLM-Native Agent Simulation Platform},
401
+ author = {Zhang, Jun and others},
402
+ year = {2025},
403
+ url = {https://github.com/tsinghua-fib-lab/agentsociety}
404
+ }
405
+ ```
406
+
407
+ ## License
408
+
409
+ Apache License 2.0 - see [LICENSE](LICENSE) for details.
410
+
411
+ ## Acknowledgments
412
+
413
+ AgentSociety 2 builds upon excellent open-source projects:
414
+
415
+ - [litellm](https://github.com/BerriAI/litellm) - Unified LLM API
416
+ - [mem0ai](https://github.com/mem0ai/mem0) - Memory management
417
+ - [FastAPI](https://fastapi.tiangolo.com/) - Backend API framework
418
+ - [Pydantic](https://docs.pydantic.dev/) - Data validation
419
+
420
+ ## Contact
421
+
422
+ - **Issues**: [GitHub Issues](https://github.com/tsinghua-fib-lab/agentsociety/issues)
423
+ - **Discussions**: [GitHub Discussions](https://github.com/tsinghua-fib-lab/agentsociety/discussions)
424
+
425
+ ---
426
+
427
+ For the original AgentSociety (v1.x) focused on city simulation, see the [agentsociety package](https://pypi.org/project/agentsociety/).