Spaces:
Sleeping
Sleeping
deploy from github
Browse files- README.md +4 -1
- api/minimax_client.py +8 -5
- config.py +1 -1
- web/app.py +6 -1
README.md
CHANGED
|
@@ -17,10 +17,13 @@ AI agents powered by MiniMax-M2.1 compete in an automated DeFi market. Agents tr
|
|
| 17 |
|
| 18 |
## What's New
|
| 19 |
|
| 20 |
-
### Agent Incentives (v1.
|
| 21 |
|
| 22 |
- **Boredom Penalty**: Agents lose 10 tokens after 1+ consecutive do_nothing actions
|
| 23 |
- **Alliance Bonuses**: Mutual alliance proposals grant +15 tokens to both agents
|
|
|
|
|
|
|
|
|
|
| 24 |
- **Market Maker**: Creates volatility every 3 turns with 15% trades
|
| 25 |
- **Price Shocks**: Random +/-10% price events create trading opportunities
|
| 26 |
|
|
|
|
| 17 |
|
| 18 |
## What's New
|
| 19 |
|
| 20 |
+
### Agent Incentives (v1.2)
|
| 21 |
|
| 22 |
- **Boredom Penalty**: Agents lose 10 tokens after 1+ consecutive do_nothing actions
|
| 23 |
- **Alliance Bonuses**: Mutual alliance proposals grant +15 tokens to both agents
|
| 24 |
+
- **Liquidity Rewards**: Providing liquidity grants +5 tokens bonus
|
| 25 |
+
- **Swap Rewards**: Active trading grants +2 tokens per swap
|
| 26 |
+
- **Coordinated Trading**: Trading during volatile markets (after market maker or price shock) grants +3 bonus tokens
|
| 27 |
- **Market Maker**: Creates volatility every 3 turns with 15% trades
|
| 28 |
- **Price Shocks**: Random +/-10% price events create trading opportunities
|
| 29 |
|
api/minimax_client.py
CHANGED
|
@@ -36,11 +36,14 @@ class MiniMaxClient:
|
|
| 36 |
messages.append({"role": "system", "content": system_prompt})
|
| 37 |
messages.append({"role": "user", "content": prompt})
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
# Extract thinking from reasoning_details
|
| 46 |
thinking_text = self._extract_thinking(response)
|
|
|
|
| 36 |
messages.append({"role": "system", "content": system_prompt})
|
| 37 |
messages.append({"role": "user", "content": prompt})
|
| 38 |
|
| 39 |
+
try:
|
| 40 |
+
response = self.client.chat.completions.create(
|
| 41 |
+
model=self.model,
|
| 42 |
+
messages=messages,
|
| 43 |
+
extra_body={"reasoning_split": self.reasoning_split}
|
| 44 |
+
)
|
| 45 |
+
except Exception as e:
|
| 46 |
+
raise RuntimeError(f"MiniMax API call failed: {str(e)}")
|
| 47 |
|
| 48 |
# Extract thinking from reasoning_details
|
| 49 |
thinking_text = self._extract_thinking(response)
|
config.py
CHANGED
|
@@ -19,7 +19,7 @@ SUPABASE_KEY = os.getenv("SUPABASE_KEY", "")
|
|
| 19 |
|
| 20 |
# Simulation Configuration
|
| 21 |
NUM_AGENTS = int(os.getenv("NUM_AGENTS", "5"))
|
| 22 |
-
TURNS_PER_RUN = int(os.getenv("TURNS_PER_RUN", "
|
| 23 |
TOTAL_RUNS = int(os.getenv("TOTAL_RUNS", "100"))
|
| 24 |
|
| 25 |
# Token Configuration
|
|
|
|
| 19 |
|
| 20 |
# Simulation Configuration
|
| 21 |
NUM_AGENTS = int(os.getenv("NUM_AGENTS", "5"))
|
| 22 |
+
TURNS_PER_RUN = int(os.getenv("TURNS_PER_RUN", "5"))
|
| 23 |
TOTAL_RUNS = int(os.getenv("TOTAL_RUNS", "100"))
|
| 24 |
|
| 25 |
# Token Configuration
|
web/app.py
CHANGED
|
@@ -165,7 +165,12 @@ def create_run(request: RunRequest):
|
|
| 165 |
except:
|
| 166 |
pass
|
| 167 |
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
|
| 171 |
@app.get("/api/runs")
|
|
|
|
| 165 |
except:
|
| 166 |
pass
|
| 167 |
|
| 168 |
+
# Include more detail in error for debugging
|
| 169 |
+
import traceback as tb
|
| 170 |
+
detail = f"Run failed: {error_msg}"
|
| 171 |
+
if "MiniMax" in error_msg or "API" in error_msg or "API key" in error_msg:
|
| 172 |
+
detail += " (MiniMax API error - check API key configuration)"
|
| 173 |
+
raise HTTPException(status_code=500, detail=detail)
|
| 174 |
|
| 175 |
|
| 176 |
@app.get("/api/runs")
|