Sotopia: an Open-ended Social Learning Environment
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.
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
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
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(),
)
)
or run
python examples/minimalist_demo.py
Help
Metadata
Release files for sotopia 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sotopia-0.1.5.tar.gz | 1.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sotopia-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.3 MB
Release files / sotopia-0.1.5.tar.gz
| Download URL | sotopia-0.1.5.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5aed51ff79cc39891550cafbe94207bb7eb2762c7b9459492fec61c263e40c31
|
|
BLAKE2b-256 checksum How to use checksums |
28bdda15abc77855231b369e9f691c4a14431bc14320e1622d97d9a7f51310aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / sotopia-0.1.5-py3-none-any.whl
| Download URL | sotopia-0.1.5-py3-none-any.whl |
|---|---|
| Size | 110.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
137fdcff35c3d20a53b5bf9195a5e0f320efa0cc3d457b0ffc73b5e8a7a802e2
|
|
BLAKE2b-256 checksum How to use checksums |
2f76c78a6d96df05bf96cbb354484f767f2f744b37a94b62a0ccf80d28ea604d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|