默认使用 Redis 后端,需先启动 Redis 服务(推荐 Docker 起 redis-stack-server);未安装数据集时无法在本地运行 server;uv 不会自动加载 .env,需用 --env-file 或手动 export;运行模拟必须提供 OPENAI_API_KEY

sotopia
sotopia-labMIT更新放缓一个开放式社交学习环境,让 LLM 智能体在社交场景中互动,用于评估和训练其社交智能与协作能力。
Sotopia: an Open-ended Social Learning Environment (ICLR 2024 spotlight)
pip install uv; uv sync --all-extras
uv run sotopia installREADME 未说明显存或 GPU 要求;运行依赖 OpenAI API 调用 LLM,未提及本地推理或 CPU 运行方式
一个开放式社交学习环境,用来评测和促进语言智能体的社交智能
一个开放式社交学习环境,让 LLM 智能体在社交场景中互动,用于评估和训练其社交智能与协作能力。
核心能力
- 让多个语言智能体在社交场景中互相交互
- 提供可扩展的环境与智能体扩展机制
- 内置 UniformSampler 采样器与异步 server 跑对话回合
- 支持 Redis 与本地 JSON 两种存储后端
- 提供 HuggingFace 数据集与在线 Demo
容易踩的坑
- v0.1.5v0.1.5 Make redis optional最新正式版2025-12-07 · 2025-12-07 20:21 UTC
- Feature/multi agent framework by @Keyu-He in https://github.com/sotopia-lab/sotopia/pull/329
- Fix custom/local model support bugs by @Keyu-He in https://github.com/sotopia-lab/sotopia/pull/338
- sotopia redis optional by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/341
- v0.1.42025-02-01 · 2025-02-01 22:01 UTC
查看更新说明
What's Changed
- Update langchain requirement from <0.3.0,>=0.2.5 to >=0.2.5,<0.4.0 by @dependabot in https://github.com/sotopia-lab/sotopia/pull/236
- [Automated] Merge release into main by @ProKil in https://github.com/sotopia-lab/sotopia/pull/235
- update macos test runner as macos-latest by @ProKil in https://github.com/sotopia-lab/sotopia/pull/238
- feat(exp_eval): support tag for combo iteration by @lwaekfjlk in https://github.com/sotopia-lab/sotopia/pull/245
- feat: Adding LLM Agents (Interview setting using openhands) to Sotopia Aact (Experimental) by @akhatua2 in https://github.com/sotopia-lab/sotopia/pull/248
- feat: Initial Message for LLM agnets in Sotopia Aact (Experimental) by @akhatua2 in https://github.com/sotopia-lab/sotopia/pull/249
- feat: Adding Chat print node for pretty printing chat conversation between agents by @akhatua2 in https://github.com/sotopia-lab/sotopia/pull/250
- doc: API endpoints for sotopia by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/242
- feat: FastAPI Implementation of Sotopia Part One (wo websocket) by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/246
- update the instruction to load existing data via docker by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/255
- fix doc by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/258
- feat: FastAPI Implementation of Sotopia Part Two (w websocket) by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/252
- Add customizable evaluation dimensions by @bugsz in https://github.com/sotopia-lab/sotopia/pull/256
- Feat/addtional fast apis for non-streaming simulation and managing relationshio by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/265
- add custom eval fast api by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/268
- aact moderator by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/257
- Deploy the api to modal by @bugsz in https://github.com/sotopia-lab/sotopia/pull/267
- Feature/sotopia demo UI by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/261
- feat: enabled saving and evaluation for moderator by @JXZhou0224 in https://github.com/sotopia-lab/sotopia/pull/271
- Demo by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/264
- [Automated] Merge release into main by @ProKil in https://github.com/sotopia-lab/sotopia/pull/274
- fix ui links by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/277
- Fix/ubuntu version by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/278
- feat: enabled saving and evaluation for moderator (#271) by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/272
- remove langchain by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/279
New Contributors
- @akhatua2 made their first contribution in https://github.com/sotopia-lab/sotopia/pull/248
Full Changelog: https://github.com/sotopia-lab/sotopia/compare/v0.1.3...v0.1.4
- v0.1.32025-01-08 · 2025-01-08 19:32 UTC
查看更新说明
What's Changed
- UI update by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/273
Full Changelog: https://github.com/sotopia-lab/sotopia/compare/v0.1.2...v0.1.3
- v0.1.22024-10-14 · 2024-10-14 21:28 UTC
查看更新说明
What's Changed
- [Automated] Merge release into main by @ProKil in https://github.com/sotopia-lab/sotopia/pull/233
- [Experimental] aact-based Based Agent by @ProKil in https://github.com/sotopia-lab/sotopia/pull/221
Full Changelog: https://github.com/sotopia-lab/sotopia/compare/v0.1.1...v0.1.2
- v0.1.12024-10-12 · 2024-10-12 05:07 UTC
查看更新说明
What's Changed
- Update libssl link in the notebook tutorial by @ProKil in https://github.com/sotopia-lab/sotopia/pull/203
- [Automated] Merge release into main by @ProKil in https://github.com/sotopia-lab/sotopia/pull/199
- Update Pydantic to v2 and redis-om to v0.3. by @ProKil in https://github.com/sotopia-lab/sotopia/pull/138
- Fix: add check for JsonModel by @yufansong in https://github.com/sotopia-lab/sotopia/pull/211
- Fix: add fixed hiredis version by @yufansong in https://github.com/sotopia-lab/sotopia/pull/210
- [Automated] Merge release into main by @ProKil in https://github.com/sotopia-lab/sotopia/pull/214
- improve the documentation by @XuhuiZhou in https://github.com/sotopia-lab/sotopia/pull/194
- Fix: change hiredis version to >= 3.0.0 by @yufansong in https://github.com/sotopia-lab/sotopia/pull/216
- Adding a devcontainer with Redis and a Ollama server by @ProKil in https://github.com/sotopia-lab/sotopia/pull/217
- Migration from Poetry to uv by @ProKil in https://github.com/sotopia-lab/sotopia/pull/218
- Update litellm requirement from <1.41.0,>=1.23.12 to >=1.23.12,<1.50.0 by @dependabot in https://github.com/sotopia-lab/sotopia/pull/227
- Update langchain requirement from <0.3.0,>=0.2.5 to >=0.2.5,<0.4.0 by @dependabot in https://github.com/sotopia-lab/sotopia/pull/226
- Update langchain-openai requirement from <0.2.0,>=0.1.8 to >=0.1.8,<0.3.0 by @dependabot in https://github.com/sotopia-lab/sotopia/pull/225
- Bump beartype from 0.14.1 to 0.19.0 by @dependabot in https://github.com/sotopia-lab/sotopia/pull/202
- CI: Removing External Service Dependency in CI by @ProKil in https://github.com/sotopia-lab/sotopia/pull/228
- Bump together from 0.2.11 to 1.3.1 by @dependabot in https://github.com/sotopia-lab/sotopia/pull/206
- Adjusting for docker windows by @hannahcha417 in https://github.com/sotopia-lab/sotopia/pull/230
New Contributors
- @yufansong made their first contribution in https://github.com/sotopia-lab/sotopia/pull/211
- @hannahcha417 made their first contribution in https://github.com/sotopia-lab/sotopia/pull/230
Full Changelog: https://github.com/sotopia-lab/sotopia/compare/v0.1.0...v0.1.1
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
News
- [05/2024] Sotopia was presented at ICLR 2024 as a spotlight ⭐!
Introduction
Sotopia is an open-ended social learning environment that allows agents to interact with each other and the environment. The environment is designed to be a platform for evaluating and faciliating social intelligence in language agents. The environment is designed to be open-ended, meaning that the environment can be easily extended to include new environments and new agents. The environment is also designed to be scalable, meaning that the environment can be easily scaled to include a large number of agents and environments.
@inproceedings{zhou2024sotopia,
title = {SOTOPIA: Interactive Evaluation for Social Intelligence in Language Agents},
author = {Zhou*, Xuhui and Zhu*, Hao and Mathur, Leena and Zhang, Ruohong and Qi, Zhengyang and Yu, Haofei and Morency, Louis-Philippe and Bisk, Yonatan and Fried, Daniel and Neubig, Graham and Sap, Maarten},
journal = {ICLR},
year = {2024},
url = {https://openreview.net/forum?id=mM7VurbA4r},
}
Get started
Install locally
We recommend using a virtual environment, e.g. with uv: pip install uv; uv sync --all-extras.
[!NOTE] You can of course use any other package manager to install the dependencies (e.g. pip, conda, etc.). But we strongly recommend using uv, especially for the development of Sotopia.
Then:
uv run sotopia install
Storage Backend Options
Sotopia supports two storage backends:
-
Redis (default) - Recommended for production use
- Requires Redis server running
- We recommend using Docker:
docker run -d -p 6379:6379 redis/redis-stack-server:latest - Set via:
export SOTOPIA_STORAGE_BACKEND=redis(or leave unset)
-
Local JSON - Simpler setup for development/testing
- No external dependencies required
- Stores data in
~/.sotopia/data/ - Set via:
export SOTOPIA_STORAGE_BACKEND=local - Note: Experimental framework features require Redis
[!WARNING] For Redis setup, we recommend using Docker. Other installation methods have been shown to be error-prone.
Environment Variables
Sotopia uses environment variables for configuration. The recommended way to set them is using a .env file in the project root:
# Create a .env file
cat > .env << EOF
# Required: OpenAI API key
OPENAI_API_KEY=your_openai_key_here
# Storage backend: "redis" (default) or "local"
SOTOPIA_STORAGE_BACKEND=local
# Redis connection (only needed if using Redis backend)
# REDIS_OM_URL=redis://localhost:6379
EOF
Environment Variables:
OPENAI_API_KEY(required): Your OpenAI API key for running LLM-based simulationsSOTOPIA_STORAGE_BACKEND(optional): Storage backend -"redis"(default) or"local"REDIS_OM_URL(optional): Redis connection string (default:"redis://localhost:6379")
Loading Environment Variables:
With uv:
# Option 1: Use --env-file flag
uv run --env-file .env python examples/minimalist_demo.py
# Option 2: Export manually
export $(cat .env | xargs) && uv run python examples/minimalist_demo.py
With other tools (pip, conda):
# Export variables before running
export $(cat .env | xargs)
python examples/minimalist_demo.py
[!NOTE]
uvdoes not automatically load.envfiles. Use the--env-fileflag or export variables manually.
Easy Sample Server
You can view an episode demo with default parameters with the following:
import asyncio
from sotopia.samplers import UniformSampler
from sotopia.server import run_async_server
asyncio.run(
run_async_server(
model_dict={
"env": "gpt-4",
"agent1": "gpt-4o-mini",
"agent2": "gpt-4o-mini",
},
sampler=UniformSampler(),
)
)
[!WARNING] You won't be able to run the server locally if you don't have any datasets installed.
or run
python examples/minimalist_demo.py
Help
[!IMPORTANT] If you are trying to develop on top of Sotopia, we highly recommend to follow the development guide, but cross-reference with this README for latest changes as the documentation may be outdated.