Skip to main content
The Nile CLI (nile) outputs structured JSON by default, making it a natural subprocess tool for AI agents. With 30+ commands covering reads, writes, and simulations, agents can drive the full protocol lifecycle through shell invocations.

Install

One-shot without installing — ideal for sandboxed agents (-y skips the prompt; @latest forces dist-tag re-resolution instead of reusing a stale npx cache):
Or via the installer script:
Or via Cargo:
Verify installation:
The installed binary embeds Sepolia contract addresses, a free public RPC endpoint, and the subgraph URL. No environment variables, config files, or API keys needed for read commands.

JSON Output

All commands output JSON by default. You can also set the format explicitly:
JSON responses follow a consistent envelope:
Pipe JSON output to jq for field extraction:

Command Groups

Agent Workflow Example

A typical agent-driven trade flow chains CLI commands as subprocess calls:
1

Check protocol mode

Verify the protocol is in NORMAL mode before suggesting trades.
2

Check balances

Read the trader’s USDC wallet balance and margin account state.
3

Simulate the trade

Preview margin requirements, fees, and entry strike before committing.
4

Execute the trade

Open the position. The CLI builds the transaction, delegates signing to OWS, and broadcasts.
5

Verify

Confirm the position was created and check real-time PnL.

OWS Wallet Signing

Read commands work immediately after install. Write commands (open/close positions, deposit/withdraw) require an OWS-compatible wallet for transaction signing.
The CLI never handles private keys directly. All signing is delegated to the OWS subprocess via ows sign tx. Wallet setup (key import, passphrase configuration) happens entirely outside the Nile workflow.
Write commands require Sepolia ETH for gas. Get testnet ETH from alchemy.com/faucets or sepoliafaucet.com.

Configuration

The CLI works zero-config for Sepolia. For advanced use cases, override settings persistently or per-command.

Persistent Config

Stored in ~/.nile/config.json:

Environment Variables

Resolution Order

For all configurable values: CLI flag > environment variable > ~/.nile/config.json > embedded default.

CLI vs MCP

Both surfaces expose the same protocol operations. Choose based on your agent’s architecture.
For agents running locally with shell access, the CLI is the fastest path to end-to-end trades — it handles signing and broadcasting in a single command. For hosted or multi-tenant agents, use the MCP Server which returns unsigned calldata for client-side signing.