Metadata-Version: 2.2
Name: mindspawner
Version: 0.3.1
Summary: A Python library to interact with the MindSpawner agent server
Home-page: https://github.com/professorASU/mindspawner-python
Author: Tomoyoshi Yamamoto
Author-email: karolus@sfc.wide.ad.jp
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: python-socketio
Requires-Dist: numpy
Requires-Dist: execjs
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary


# MindSpawner

[![PyPI version](https://badge.fury.io/py/mindspawner.svg)](https://pypi.org/project/mindspawner/)
[![License](https://img.shields.io/badge/license-GPL%20v3-blue.svg)](LICENSE)
[![Python Versions](https://img.shields.io/pypi/pyversions/mindspawner.svg)](https://pypi.org/project/mindspawner/)

MindSpawner is a Python library that enables developers to create and control AI-powered agents for games and interactive environments. It provides an easy-to-use interface for managing AI behavior and real-time learning.

## 🚀 Features

- Simple API for integrating AI-driven agents
- WebSocket-based real-time communication
- Lightweight and efficient
- Easy to integrate with game engines and simulations

## 📦 Installation

To install MindSpawner, run the following command:

```bash
pip install mindspawner
```

Then, import it in your Python script:

```python
from mindspawner import MindSpawner
```

---

## 🎮 Adding a Game AI

To create and add a game AI, use the following code:

```python
USER_ID = ""  # Copy your "USER ID"
GAMEAI_ID = ""  # Copy your "GAMEAI ID"
gameai = MindSpawner(USER_ID, GAMEAI_ID)
```

---

## 🤖 Running an AI Agent

To send input data to a specific agent and retrieve its output:

```python
AGENT_ID = ""  # Copy your "AGENT ID"
input_data = { "input1": 100 }

action = gameai.agent(AGENT_ID, input_data)
print(action)
```

### 🔹 Key Points:
- `input_data` is any data that will be provided to the game AI.
- `action` stores the AI's response based on the given input.

---

## 📈 Updating the Game AI

### 🔹 Enhancing AI Performance
If you want to improve the AI's performance, evaluate it numerically and update it as follows:

```python
AGENT_ID = ""  # Copy your "AGENT ID"
score = 100  # Example: number of defeated enemies or goals scored
gameai.update_agent(AGENT_ID, score)
```

- `score` is an integer that evaluates the AI's performance.
- Use game-specific metrics (e.g., enemy defeats, successful actions) to assign a meaningful score.

### 🔹 Adjusting AI Behavior
If you want to fine-tune the AI’s behavior, use the web interface and click the **"Instruct"** button for the agent. You can specify behavior rules such as:

- "Avoid enemies when they get too close."
- "Maintain an aggressive playstyle."

---
