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

# How it works

> End-to-end flow of the Perps Agent platform.

From a Telegram command to a verified on-chain attestation — here is the full Perps Agent loop.

## The five-step loop

<Steps>
  <Step title="Configure in Telegram">
    The user opens the Perps Agent bot, picks a market (e.g. BTC/USDT perp on Bybit), and chooses a strategy template plus risk caps (max drawdown, max leverage, position size).
  </Step>

  <Step title="AI proposes params">
    The AI agent loop reads recent market state, past attested runs, and the user's risk caps, then proposes grid parameters (range, step size, order count) optimized for risk-adjusted return.
  </Step>

  <Step title="Commit on Mantle">
    Before any order is placed, the exact config is hashed and committed to the on-chain registry on Mantle. The commit is irreversible — the bot cannot deviate without invalidating the proof.
  </Step>

  <Step title="Execute on Bybit">
    The grid engine places orders on Bybit through the user's API keys (trade-only, no withdraw). Fills, PnL, and risk metrics are tracked in real time.
  </Step>

  <Step title="Attest on Mantle">
    When the run ends (target hit, stop hit, or user stops it), the verified outcome is attested on-chain, tied to the original commit. The track record is now public and tamper-proof.
  </Step>
</Steps>

## What the user sees

* A Telegram chat to configure, launch, monitor, and stop runs
* Real-time PnL, drawdown, and risk metrics
* A link to the on-chain commit and attestation for every run

## What the user does *not* have to do

* Deposit funds anywhere
* Share withdrawal-enabled keys
* Trust an off-chain dashboard for performance numbers
