> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ameo.agiwithai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run locally

> Worker modes, RPC configuration, and identity setup beyond Quickstart.

This guide expands on the [Quickstart](/quickstart) with operational detail.

## Worker modes

Set `WORKER_MODE` in `.env`:

| Mode           | Behavior                                 |
| -------------- | ---------------------------------------- |
| `dry_run`      | Full cognition loop; no broadcast txs    |
| `live_limited` | Live execution with notional caps        |
| `live`         | Full live (requires `LIVE_ENABLED=true`) |

Also set `LIVE_ENABLED=true` only when you intend to spend real testnet gas.

## RPC configuration

| Variable          | Notes                     |
| ----------------- | ------------------------- |
| `MANTLE_RPC_URL`  | Primary Sepolia RPC       |
| `MANTLE_CHAIN_ID` | `5003` for Mantle Sepolia |

The web app mirrors RPC via `VITE_MANTLE_RPC_URL` and optional `VITE_MANTLE_RPC_URL_FALLBACK`.

Test connectivity:

```bash theme={null}
curl -s -X POST "$MANTLE_RPC_URL" \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
```

## DEX adapter

`EXECUTION_ADAPTER=fusionx_v2` uses the FusionX V2 router configured in `.env`:

* `FUSIONX_V2_ROUTER`, `FUSIONX_V2_FACTORY`
* `DEX_SLIPPAGE_BPS`, `DEX_SWAP_DEADLINE_SEC`

Smoke test:

```bash theme={null}
cd apps/worker && uv run python ../../scripts/exec-smoke.py
```

## Agent identity (use live deployment or mint your own)

**Live deployment:** use the canonical Sepolia contract — no redeploy needed:

* `AGENT_IDENTITY_ADDRESS=0xB86dC64573089D8DD89C5686010295bB4412D652`
* `AGENT_EOA=0x59ffc8907beaA275F29B466BCB1D9BbfeaDAd165` (must match `AGENT_PRIVATE_KEY`)
* `AGENT_TOKEN_ID=0` · confirm with `GET /v1/identity/status` → `ready: true`

**Private fork:** deploy + `cast send $CONTRACT "mintAgent(address)" $YOUR_EOA ...` — see [Contracts](/api/contracts).

## Docker alternative

```bash theme={null}
docker compose up --build
```

Web: `:5173` · Worker: `:8000`

## Logs and replay

* JSONL events: `apps/worker/logs/events/events_YYYYMMDD.jsonl`
* Replay API: `GET /api/cycles/{cycle_id}`
* Live tail: `GET /api/events/tail` (SSE)

## One-command local script

```bash theme={null}
./scripts/deploy_local.sh
```

Starts worker + web together (requires uv, npm, free ports 8000/5173).
