← Exit Guard project docs / for agents

Project documents

Add Exit Guard to your agent

Exit Guard is a non-custodial exit terminal for onchain trading agents on Base. Give it a position and a rule; it reads live Uniswap V3 price, simulates, then exits through KeeperHub. This folder teaches agents (and their operators) how to wire the public API into a terminal.

Folder

docs/

1. Public base URL

https://exit-guard.onrender.com

Always prefer this host in production. Local dev: http://localhost:8787.

2. What the agent needs

  1. Position owner wallet on Base that holds the ERC-20 to sell.
  2. Two one-time txs on ExitGuardExecutor:
    setEnrolled(true)
    token.approve(executor, amount)  // exact size preferred
  3. x402 payer (KeeperHub agentic wallet) funded with Base USDC for paid /exit calls.

Executor address is returned by GET /health as executor.

3. HTTP flow (agent loop)

StepMethodCostPurpose
1POST /v1/positionsfreeRegister owner, token, stopPrice, feeTier
2POST /v1/positions/:id/evaluatefreeCheck hold / exit / blocked
3POST /v1/positions/:id/exitx402 (~$0.02 USDC)Simulate then exit via KeeperHub
—GET /health · GET /pingfreeLiveness / config
—GET /v1/receiptsfreeAudit trail

Register

POST https://exit-guard.onrender.com/v1/positions
Content-Type: application/json

{
  "owner": "0xYourAgentWallet",
  "token": "0xTokenOnBase",
  "stopPrice": 0.001,
  "feeTier": 10000
}

Evaluate (never charge)

POST https://exit-guard.onrender.com/v1/positions/<id>/evaluate

Actions: hold · exit · blocked (not enrolled / allowance / balance).

Exit (pay-per-use)

POST https://exit-guard.onrender.com/v1/positions/<id>/exit

Without payment → HTTP 402 with x402 requirements + PAYMENT-REQUIRED header. Install a KeeperHub agentic wallet so the agent signs and retries automatically:

npx -p @keeperhub/wallet keeperhub-wallet skill install
npx -p @keeperhub/wallet keeperhub-wallet add
# fund printed address with Base USDC

4. Drop-in agent instructions (copy)

You have access to Exit Guard, a non-custodial exit API on Base.

Base URL: https://exit-guard.onrender.com
Docs: https://exit-guard-site.onrender.com/docs/

When the user wants a safe exit for an onchain position:
1. Confirm owner wallet enrolled + token approved to the executor from GET /health.
2. POST /v1/positions with owner, token, stopPrice, feeTier.
3. Poll POST /v1/positions/:id/evaluate for free.
4. When action is "exit", POST /v1/positions/:id/exit.
5. If you receive HTTP 402, pay with the KeeperHub agentic wallet (x402 Base USDC) and retry.
6. Never skip simulation — the service simulates before signing.

Do not charge the user for evaluate. Only /exit is paid.

5. Claude Code / MCP-style terminals

6. Safety model (tell the agent)

Source: github.com/kazzysax/exit-guard · API: exit-guard.onrender.com