Mangrove Agent
mangrove-agent is a production-ready trading bot you clone and run. It turns natural-language goals (“momentum on ETH”) into backtested, ranked trading strategies via the MangroveAI API; runs them on APScheduler cron jobs; and executes live swaps through MangroveMarkets with client-side signing. SQLite audit trail for every evaluation and trade.
It is MIT-licensed (repo) and pairs with the mangroveai, mangrovemarkets, and mangrove-kb SDKs you already know.
What you get
- Single FastAPI process on port 9080 — REST API + MCP server share one service layer.
- 41 MCP tools spanning wallet ops, DEX swaps, market data, signals, strategy creation, backtesting, execution, logs, knowledge base, and DeFi. See the tools catalog.
- APScheduler in-process cron with SQLite jobstore — the same evaluator path serves paper and live, so what passes backtest is what runs in production.
- Local Fernet-encrypted wallets. Bare-metal install stores the master key in your OS keychain; Docker install stores it at
./agent-data/master.key(chmod 600, gitignored). - Claude Code hooks that block private-key pastes in the chat, so keys never enter the agent’s prompt context.
- Real mainnet evidence: an autonomous swap on Base,
0x5c126e...c5565(April 2026).
Who it’s for
- You want a working agent template, not 6 weeks of glue code.
- You already have or will get a MangroveAI API key.
- You want strategy logic, risk gates, and signal evaluation handled upstream by the platform — the agent orchestrates, it doesn’t re-implement.
Picking a deployment shape
| Path | When to use |
|---|---|
Bare-metal (./scripts/setup.sh) | Default. OS keychain holds the master key; iteration is fastest. |
Docker (./scripts/setup.sh --docker) | You can’t run Python on the host (corporate restrictions, reproducibility mandate). Master key lives in ./agent-data/master.key because containers can’t reach the OS keychain. |
| Workshop walkthrough | The full guided path is at tutorials/trading-app/ — 8 chapters, ~2 hours, chapters 01-05 are fund-free. |
Next
- Quickstart — install, paper-trade a strategy, optionally go live.
- MCP tools catalog — the 41 tools the agent exposes.
- Architecture — how requests flow and where each piece lives.
- Safety model — key custody, backup gate, hooks.
Source
- GitHub:
mangrove-agent(MIT) - Tutorials:
tutorials/trading-app/ - Architecture + spec docs:
docs/