Spaces:
Running

File size: 2,458 Bytes
4d76b14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Libratio Fleet - Agent Instructions

## Quick Start

```bash
# Start the server
uvicorn server.app:app --host 0.0.0.0 --port 7860

# Run fleet inference (requires HF_TOKEN)
python fleet_inference.py

# Run training (direct mode, no server needed)
python train_fleet.py --task fleet_precision --episodes 100
```

## Project Structure

```
libratio-fleet/
β”œβ”€β”€ environment/           # Core RL environment
β”‚   β”œβ”€β”€ fleet_env.py       # Multi-agent fleet (main)
β”‚   β”œβ”€β”€ physics_model.py  # Reward constants
β”‚   └── mixed_precision_env.py  # Legacy single-agent
β”œβ”€β”€ scenarios/             # Task scenarios
β”‚   β”œβ”€β”€ fleet_scenarios.py
β”‚   └── task*_scenarios.py
β”œβ”€β”€ server/                # FastAPI API
β”‚   β”œβ”€β”€ app.py
β”‚   └── models.py
β”œβ”€β”€ scripts/               # Helper scripts
β”‚   β”œβ”€β”€ inference.py       # Legacy
β”‚   └── manual_play.py
β”œβ”€β”€ notebooks/            # Colab notebooks
β”œβ”€β”€ results/               # Training outputs
β”œβ”€β”€ fleet_inference.py    # Multi-agent LLM inference
β”œβ”€β”€ train_fleet.py         # Training script
β”œβ”€β”€ test_fleet.py          # Smoke tests
β”œβ”€β”€ openenv.yaml           # OpenEnv spec
└── AGENTS.md
```

## Running Tasks

```bash
# Run specific task
TASK_ID=fleet_precision python fleet_inference.py
TASK_ID=fleet_oversight python fleet_inference.py
TASK_ID=fleet_resource python fleet_inference.py
TASK_ID=fleet_recovery python fleet_inference.py
```

## Environment Variables

- `HF_TOKEN` - Required for LLM inference (Groq or OpenAI)
- `API_BASE_URL` - LLM API endpoint (default: Groq)
- `MODEL_NAME` - Model to use (default: llama-3.3-70b-versatile)
- `ENV_URL` - Fleet env URL (default: http://localhost:7860)

## Fleet Tasks

| Task | Description | Key Action Fields |
|------|-------------|-------------------|
| `fleet_precision` | Assign precision to models under shared memory | `precision_strategy` |
| `fleet_oversight` | Monitor all runs, detect crashes | `action_type`, `flagged_model` |
| `fleet_resource` | Allocate GPUs across competing models | `allocations` |
| `fleet_recovery` | Diagnose crash, reallocate, verify | Phase-dependent |

## Known Quirks

- Scores clamped to (0.01, 0.99) - never exactly 0 or 1
- Oversight task: false alarm = 0.10, missed crash = 0.10
- Resource task: invalid allocation = 0.01 immediately
- Fleet precision: memory overflow triggers -0.3 penalty