sotopia

sotopia-labMIT更新放缓

一个开放式社交学习环境,让 LLM 智能体在社交场景中互动,用于评估和训练其社交智能与协作能力。

Sotopia: an Open-ended Social Learning Environment (ICLR 2024 spotlight)

v0.1.5发布于 2025-12-07 20:21 UTC342star52fork同步于 2026-11-07 07:29 UTC

怎么上手

由 README 提炼,执行前请确认
pip install uv; uv sync --all-extras
uv run sotopia install
硬件要求按 README 说明

README 未说明显存或 GPU 要求;运行依赖 OpenAI API 调用 LLM,未提及本地推理或 CPU 运行方式

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

一个开放式社交学习环境,用来评测和促进语言智能体的社交智能

一个开放式社交学习环境,让 LLM 智能体在社交场景中互动,用于评估和训练其社交智能与协作能力。

核心能力

  • 让多个语言智能体在社交场景中互相交互
  • 提供可扩展的环境与智能体扩展机制
  • 内置 UniformSampler 采样器与异步 server 跑对话回合
  • 支持 Redis 与本地 JSON 两种存储后端
  • 提供 HuggingFace 数据集与在线 Demo

容易踩的坑

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

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.1.5
  1. v0.1.5v0.1.5 Make redis optional最新正式版2025-12-07 · 2025-12-07 20:21 UTC
  2. v0.1.42025-02-01 · 2025-02-01 22:01 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/sotopia-lab/sotopia/compare/v0.1.3...v0.1.4

  3. v0.1.32025-01-08 · 2025-01-08 19:32 UTC
    查看更新说明
  4. v0.1.22024-10-14 · 2024-10-14 21:28 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/sotopia-lab/sotopia/compare/v0.1.1...v0.1.2

  5. v0.1.12024-10-12 · 2024-10-12 05:07 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/sotopia-lab/sotopia/compare/v0.1.0...v0.1.1

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    pypi versions CI codecov Colab

    Project Page Paper PDF Dataset Demo

    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:

    1. 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)
    2. 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 simulations
    • SOTOPIA_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] uv does not automatically load .env files. Use the --env-file flag 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.