This repository contains the source code of SimIIR API wrapper for the paper Making Simulation SimIIR: A Dashboard for User Simulation.
User simulation is a valuable methodology for evaluation in Information Retrieval. However, the steep learning curve and high setup time of existing frameworks often limit their use and make reproducing studies difficult. This paper introduces SimIIR Studio, a web-based workbench created to address these issues. The platform offers a visual, low-code interface for the SimIIR simulation engine, abstracting its underlying complexity. It allows researchers to replicate existing models, construct new simulations by combining components, and conduct comparative analyses within a unified environment. By reducing the implementation overhead, SimIIR Studio makes advanced user simulation more accessible and reproducible for the research community.
Keywords: User simulation, Simulation platforms, Reproducibility
Get started with the SimIIR API in 5 minutes!
- Python 3.9+
- Poetry (for dependency management)
- Git
First, clone the simIIR framework at the root level (same level as simiir-api):
cd /simiir-studio # Or your project root
git clone https://github.com/simint-ai/simiir-3.git simiirYour directory structure should look like:
simiir-studio/
├── simiir/ ← SimIIR framework (just cloned)
└── simiir-api/ ← This API wrapper
SimIIR uses pip and requirements.txt:
cd simiir
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
deactivate
cd ../simiir-apiNote: The SimIIR API will automatically use the system Python to run simIIR since it doesn't have poetry.
Option A: Using the start script (Recommended)
./start.shThis will automatically:
- Install poetry (if needed)
- Install dependencies
- Create directories
- Set up environment
- Initialize database
- Start the server
Option B: Manual setup
# Install dependencies
poetry install
# Set up environment
cp .env.example .env
# Edit .env to set SIMIIR_REPO_PATH if not using default location
nano .env
# Create directories
mkdir -p outputs logs
# Start server
poetry run simiir-apipoetry run simiir-apiThe API will be available at: http://localhost:8000
Open your browser to: http://localhost:8000/docs
Option A: Using the test script with real simIIR config (Recommended)
poetry run python examples/test_with_real_config.pyThis will:
- Read a real simIIR configuration from
../simiir/example_sims/trec_bm25_simulation.xml - Create a simulation via the API
- Show you commands to start and monitor it
Option B: Using the Python example script
poetry run python examples/api_usage.pyOption C: Using curl
# Read example config
CONFIG=$(cat examples/example_simulation_config.xml)
# Create simulation
curl -X POST http://localhost:8000/simulations/ \
-H "Content-Type: application/json" \
-d "{
\"name\": \"My First Simulation\",
\"description\": \"Testing the API\",
\"config_content\": \"$CONFIG\",
\"users\": [\"user1\", \"user2\"],
\"topics\": [\"303\", \"307\"]
}"Response:
{
"id": "sim_abc123def456",
"name": "My First Simulation",
"status": "pending",
...
}# Replace sim_abc123 with your simulation ID
curl -X POST http://localhost:8000/simulations/sim_abc123/control \
-H "Content-Type: application/json" \
-d '{"action": "start"}'# Check status
curl http://localhost:8000/simulations/sim_abc123
# View logs (last 50 lines)
curl http://localhost:8000/simulations/sim_abc123/logs?tail=50# Once completed, get results
curl http://localhost:8000/simulations/sim_abc123/resultsimport requests
BASE_URL = "http://localhost:8000"
# Create simulation
response = requests.post(
f"{BASE_URL}/simulations/",
json={
"name": "My Simulation",
"config_content": open("examples/example_simulation_config.xml").read(),
"users": ["user1", "user2"],
"topics": ["303", "307"]
}
)
sim_id = response.json()['id']
# Start simulation
requests.post(
f"{BASE_URL}/simulations/{sim_id}/control",
json={"action": "start"}
)
# Check status
status = requests.get(f"{BASE_URL}/simulations/{sim_id}").json()
print(f"Status: {status['status']}")
# Get results
results = requests.get(f"{BASE_URL}/simulations/{sim_id}/results").json()
print(f"Queries: {len(results['queries'])}")curl http://localhost:8000/simulations/curl "http://localhost:8000/simulations/?status=running"curl -X POST http://localhost:8000/simulations/sim_abc123/control \
-H "Content-Type: application/json" \
-d '{"action": "pause", "checkpoint_before_action": true}'curl -X POST http://localhost:8000/simulations/sim_abc123/control \
-H "Content-Type: application/json" \
-d '{"action": "resume"}'curl -X POST http://localhost:8000/simulations/sim_abc123/control \
-H "Content-Type: application/json" \
-d '{"action": "stop"}'curl http://localhost:8000/simulations/sim_abc123/checkpointsEdit .env file to configure:
# Server settings
HOST=0.0.0.0
PORT=8000
# SimIIR paths
# Default expects simIIR at same level as simiir-api:
SIMIIR_REPO_PATH=../simiir
SIMIIR_DATA_PATH=../simiir/example_data
# Or use absolute paths:
# SIMIIR_REPO_PATH=/absolute/path/to/simiir
# SIMIIR_DATA_PATH=/absolute/path/to/simiir/example_data
# Simulation settings
MAX_CONCURRENT_SIMULATIONS=3
CHECKPOINT_INTERVAL=100Important: If you cloned simIIR to a different location, update SIMIIR_REPO_PATH in .env
docker-compose up -ddocker-compose logs -fdocker-compose downAfter starting the server, test with a simIIR configuration:
# Create simulation from simIIR example
poetry run python examples/test_with_real_config.py
# Output will show simulation ID, then:
# Start it
curl -X POST http://localhost:8000/simulations/{sim_id}/control \
-H "Content-Type: application/json" \
-d '{"action": "start"}'
# Monitor progress
curl http://localhost:8000/simulations/{sim_id}
# Watch logs in real-time
watch -n 2 "curl -s http://localhost:8000/simulations/{sim_id}/logs?tail=20"
# Get results when complete
curl http://localhost:8000/simulations/{sim_id}/resultscd .. # Go to project root
git clone https://github.com/simint-ai/simiir-3.git simiir
cd simiir
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
deactivateChange the port in .env:
PORT=8001Verify the path in .env matches where you cloned simIIR:
ls $SIMIIR_REPO_PATH/simiir/run_simiir.pyUpdate .env if needed:
SIMIIR_REPO_PATH=/absolute/path/to/simiirMake sure simIIR dependencies are installed:
cd ../simiir
source venv/bin/activate # Activate the virtual environment
pip install -r requirements.txtOr ensure the simIIR venv Python is in your PATH.
chmod +x start.sh- API Reference: Check API_REFERENCE.md for endpoint documentation
- Architecture: See ARCHITECTURE.md for technical details
- Commands: Browse COMMANDS.md for command cheat sheet
- Examples: Explore examples in the
examples/directory - Interactive Docs: Visit http://localhost:8000/docs for Swagger UI
For issues and questions:
- Check the logs in
logs/simiir_api.log - Review simulation logs in
outputs/{simulation_id}/simulation.log - Refer to the main simIIR documentation
Happy simulating!
