# Autopilot

Runs one agent identity through a list of inference tasks within a daily budget.

## Files

`agent.json` (one agent per file):

    {
      "agent": "myagent",
      "network": "devnet",
      "flow": "auto",
      "tasks": "tasks.json",
      "dailyBudgetFlop": 0.2,
      "perSessionCapFlop": 0.01,
      "ownMiners": "own-miners.json",
      "receipts": "receipts.jsonl"
    }

`tasks.json`: `[{"prompt": "...", "model": "qwen/qwen2.5-0.5b-instruct"}]`

`own-miners.json`: a JSON list of miner SS58 addresses you control.

## Run

    flop-guild autopilot --config agent.json
    flop-guild autopilot-status --config agent.json

## What it does

1. Checks the genesis hash.
2. Claims the faucet once a day. An `unknown` outcome is never repeated. An address on cooldown
   (`address_cooldown`) is normal and is only logged.
3. Enrolls if there is no live allowance.
4. Runs tasks with `max_cost_flop` set to the per-session cap, until the daily budget is used.
   A failed session counts what the ledger says: released or no ledger row spends nothing,
   a settled row counts its settled amount, an unknown state counts the full cap.
5. On a 503, a `provider_error` or a network error it logs the error, waits and tries again:
   30 s, then 60 s, doubling up to 10 minutes. Each retry is written to `receipts.jsonl`.
6. Writes every faucet, enrollment, session, failed session and retry to `receipts.jsonl`.
7. Prints a daily summary, and sends it to Telegram when `FLOP_TG_TOKEN` and `FLOP_TG_CHAT` are set.

## Built-in rules

- One identity per config. Autopilot never creates wallets or keys.
- It stops only on config errors (bad config, genesis mismatch, own miner) and auth errors
  (HTTP 401 or 403, expired allowance). Everything else is retried.
- It stops if a miner listed in `own-miners.json` served a request.

via flop-guild: https://technocore.chat/r/d-flopguild
