Metadata-Version: 2.5
Name: agentsims
Version: 0.1.1
Summary: Time-stepped multi-agent simulation engine powered by LLMs
Project-URL: Homepage, https://github.com/muyuhuatang/agentsims
Project-URL: Repository, https://github.com/muyuhuatang/agentsims
Project-URL: Issues, https://github.com/muyuhuatang/agentsims/issues
Project-URL: Website, https://agentsims.agentsnet.org
Author: muyuhuatang (Fan)
License-Expression: MIT
License-File: LICENSE
Keywords: agent-based-modeling,anthropic,llm,multi-agent,simulation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: anthropic>=0.30
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.0
Requires-Dist: rich>=13.0
Provides-Extra: demo
Requires-Dist: fastapi>=0.115; extra == 'demo'
Requires-Dist: uvicorn>=0.30; extra == 'demo'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Provides-Extra: notebooks
Requires-Dist: jupyterlab>=4.0; extra == 'notebooks'
Requires-Dist: matplotlib>=3.8; extra == 'notebooks'
Provides-Extra: retriever
Requires-Dist: ddgs>=9.16; extra == 'retriever'
Description-Content-Type: text/markdown

# AgentSims

A Python framework for time-stepped multi-agent simulations with role cards,
agent memory, replaceable LLM backends, adaptive retrieval, SQLite persistence,
and terminal replay. Requires Python 3.10 or later.

Source: <https://github.com/muyuhuatang/agentsims> ·
Website: <https://agentsims.agentsnet.org>

## Install

```sh
python -m pip install agentsims
```

Optional extras:

```sh
python -m pip install "agentsims[demo]"        # FastAPI and Uvicorn for the demo API
python -m pip install "agentsims[notebooks]"   # JupyterLab and Matplotlib
python -m pip install "agentsims[retriever]"   # DuckDuckGo search via ddgs
```

## Example

```python
from agentsims import RoleCard, Scenario, Simulation, Tier

scenario = Scenario(
    name="Policy discussion",
    ticks=3,
    initial_metrics={"tension_level": 0.3},
    agents=[
        RoleCard(name="Council", type="institution", tier=Tier.FULL,
                 goals=["Agree on a shared resource plan"]),
        RoleCard(name="Observers", type="public", tier=Tier.RULE),
    ],
)
results = Simulation(scenario, db_path="agentsims.db").run()
try:
    results.report()
finally:
    results.db.close()
```

The default backend calls the Anthropic API and needs `ANTHROPIC_API_KEY`; live
calls are billed by the provider. Subclass `BaseLLM` to run with another backend,
or offline with a scripted one.

## Examples, scenarios, and notebooks

This package contains only the library. The repository also has an offline
example that needs no API key, four scenario scripts, four notebooks, a cookbook,
and a read-only FastAPI demo. To use them, install from a source checkout:

```sh
git clone https://github.com/muyuhuatang/agentsims.git
cd agentsims
python -m pip install -e ./packages/agentsims
python examples/offline_simulation.py
```

The examples are synthetic simulations, not forecasts. Cost figures in the
source come from a static price table and are estimates.

MIT license; see LICENSE.
