Build AutonomousDeFi Agents

An open-source Python SDK for developing, testing, and deploying institutional-grade trading strategies with an intent-based architecture

Read the Docs

EVERYTHING YOU NEED TO BUILD DEFI AGENTS

Multi-Chain, Multi-Protocol

12 chains and 20+ protocol connectors including Uniswap, Aave, Morpho, GMX, Polymarket, and more.

Intent-Based Architecture

Express trading logic as high-level intents like Swap, LP, and Borrow. The framework handles compilation and execution.

Comprehensive Backtesting

PnL simulation, paper trading on Anvil forks, Monte Carlo analysis, and parameter sweeps - all from the CLI.

Production-Ready

Gateway security architecture, alerting, stuck detection, emergency management, and canary deployments built in.

GET STARTED IN 4 STEPS

FROM INSTALL TO PRODUCTION

Install icon

pip install almanak - Install the SDK from PyPI. Requires Python 3.12+.

Create icon

almanak strat new - Scaffold a new strategy from a template with config, tests, and environment setup.

Test icon

almanak strat run --network anvil --once - Run your strategy on a local Anvil fork with auto-started gateway. Add --dashboard for live monitoring.

Deploy icon

almanak strat run - Deploy to production with non-custodial Safe smart accounts. Gateway architecture keeps secrets isolated.

FROM IDEA TO PRODUCTION IN MINUTES

1class MyStrategy(Strategy):
2    """A simple rebalancing strategy."""
3
4    def configure(self):
5        self.token_a = self.config["token_a"]
6        self.token_b = self.config["token_b"]
7        self.threshold = self.config["rebalance_threshold"]
8
9    async def decide(self, state: StrategyState):
10        prices = state.prices
11        portfolio = state.portfolio
12
13        ratio = portfolio.value(self.token_a) / portfolio.total_value()
14
15        if abs(ratio - 0.5) > self.threshold:
16            return [
17                Swap(
18                    from_token=self.token_a if ratio > 0.5 else self.token_b,
19                    to_token=self.token_b if ratio > 0.5 else self.token_a,
20                    amount_pct=abs(ratio - 0.5) * 100,
21                )
22            ]
23        return []
$ almanak strat new
Created strategy in ./my-strategy/
$ almanak strat run --network anvil --once
Running on local Anvil fork... Done.
$ almanak strat backtest pnl
Backtesting 365 days... Sharpe: 2.4, MaxDD: -8.2%

Scaffold, test on a local fork, backtest, and deploy - all from your terminal. Add --dashboard for live monitoring.

INTEGRATE WITH 20+ PROTOCOLS

ACROSS 12 CHAINS

Connectors for DEXs, lending, perpetuals, prediction markets, liquid staking, and CEXs.

ALMANAK CODE

AI-POWERED DEVELOPMENT

Terminal-based AI coding agent that understands your strategies. Chat interactively, debug code, and get workspace-aware assistance - all from your terminal.

Multi-Provider AI

Works with Claude, GPT-4, and other models. Choose the best model for your task.

Persistent Sessions

Session history and context preserved across interactions. Pick up where you left off.

Built-in Tools

Bash execution, file read/write, grep, and glob - all available to the AI agent.

Custom Agents & Skills

Define reusable agents and skills tailored to your workflow and strategy patterns.

$ almanak code
Starting Almanak Code v1.0
you: Explain my rebalancing strategy and suggest improvements
almanak: I've analyzed your strategy in ./strategies/rebalancer.py. Here's what I found:
1. The rebalance threshold of 5% is conservative
2. Consider adding a cooldown period between rebalances
3. Gas cost estimation is missing from the decide() logic
you: Add gas cost estimation to the decide method
almanak: Done. I've added gas estimation using the state.gas_price feed and a profitability check before executing swaps.

MAXIMUM PRIVACY
AND CONTROL

PROTECTING CAPITAL
WITH INSTITUTIONAL GRADE SOLUTIONS

NON-CUSTODIAL

Full control over your funds through Safe smart accounts. No third party ever holds custody.

GATEWAY ARCHITECTURE

Strategy containers run with no secrets and no internet access. All external operations are mediated through a controlled gRPC gateway sidecar.

VERIFIABILITY

All strategy code is fully auditable. Backtest, paper trade, and stress test before deploying to production.

OUR INVESTORS

& PARTNERS

AppWorks
Artemis
BanklessVC
DELPHI LABS
HASHKEY CAPITAL
Matrix
Near
ROCKAWAY
SparkleVC