limina-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- limina_sdk-0.1.0/PKG-INFO +92 -0
- limina_sdk-0.1.0/README.md +77 -0
- limina_sdk-0.1.0/pyproject.toml +27 -0
- limina_sdk-0.1.0/setup.cfg +4 -0
- limina_sdk-0.1.0/src/limina_sdk.egg-info/PKG-INFO +92 -0
- limina_sdk-0.1.0/src/limina_sdk.egg-info/SOURCES.txt +10 -0
- limina_sdk-0.1.0/src/limina_sdk.egg-info/dependency_links.txt +1 -0
- limina_sdk-0.1.0/src/limina_sdk.egg-info/entry_points.txt +2 -0
- limina_sdk-0.1.0/src/limina_sdk.egg-info/requires.txt +2 -0
- limina_sdk-0.1.0/src/limina_sdk.egg-info/top_level.txt +2 -0
- limina_sdk-0.1.0/tests/test_guardrails.py +36 -0
- limina_sdk-0.1.0/tests/test_new_features.py +61 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: limina-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Liminal Layer for Agentic Strategies on Robinhood Chain
|
|
5
|
+
Author-email: Limina <dev@limina.fi>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://x.com/liminafi
|
|
8
|
+
Project-URL: Documentation, http://localhost:5173
|
|
9
|
+
Project-URL: Repository, https://github.com/liminafi/limina-sdk
|
|
10
|
+
Keywords: ai-agents,robinhood-chain,web3,arbitrum-orbit,guardrails,evm-simulation
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: web3>=6.0.0
|
|
14
|
+
Requires-Dist: pydantic>=2.0.0
|
|
15
|
+
|
|
16
|
+
# 🌿 Limina SDK (`limina-sdk`)
|
|
17
|
+
> **The Liminal Layer for Agentic Strategies on Robinhood Chain**
|
|
18
|
+
|
|
19
|
+
[](https://www.python.org)
|
|
20
|
+
[](https://x.com/liminafi)
|
|
21
|
+
[](LICENSE)
|
|
22
|
+
|
|
23
|
+
`limina-sdk` is an open-source Python framework designed to bridge non-deterministic AI decisions (LLM outputs) with deterministic EVM execution on **Robinhood Chain**.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## ⚡ Key Features
|
|
28
|
+
|
|
29
|
+
* 🛡️ **Deterministic Guardrails:** Hard caps on daily USD spend, max slippage tolerance, stop-loss triggers, and contract whitelists.
|
|
30
|
+
* ⚡ **Anvil Microsecond EVM Dry-Run:** Local state fork test before broadcasting transactions to Robinhood L2.
|
|
31
|
+
* 🔌 **Framework Adapters:** Pre-built adapters for ElizaOS, LangChain, CrewAI, AutoGen, and custom Python LLM loops.
|
|
32
|
+
* 🚀 **Zero-Gas Intent Relays:** Intent aggregation & batching optimized for Robinhood Chain liquidity.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 🚀 Quickstart
|
|
37
|
+
|
|
38
|
+
### 1. Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install limina-sdk
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. Basic Example
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from limina import LiminaAgent, Guardrails, RobinhoodChain
|
|
48
|
+
|
|
49
|
+
# Define dynamic guardrails
|
|
50
|
+
guard = Guardrails(
|
|
51
|
+
max_daily_spend_usd=250.0,
|
|
52
|
+
max_slippage_pct=0.5,
|
|
53
|
+
anvil_simulation=True
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# Instantiate safe agent
|
|
57
|
+
agent = LiminaAgent(chain=RobinhoodChain.MAINNET, guardrails=guard)
|
|
58
|
+
|
|
59
|
+
# Execute safe swap on Robinhood L2
|
|
60
|
+
result = agent.swap(from_token="USDC", to_token="WETH", amount_usd=50.0)
|
|
61
|
+
|
|
62
|
+
print("Status:", result["status"])
|
|
63
|
+
print("Tx Hash:", result["tx_hash"])
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 🛠️ Architecture
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
[ AI Agent Output (LangChain/ElizaOS) ]
|
|
72
|
+
│
|
|
73
|
+
▼
|
|
74
|
+
┌────────────────────────────────────────────────────────┐
|
|
75
|
+
│ LIMINA GUARDRAIL ENGINE (Python) │
|
|
76
|
+
│ ├─ 1. Daily Spend Check ($ Limit) │
|
|
77
|
+
│ ├─ 2. Slippage Tolerance Check (%) │
|
|
78
|
+
│ ├─ 3. Contract Whitelist Verification │
|
|
79
|
+
│ └─ 4. Anvil EVM State Fork Dry-Run (20ms) │
|
|
80
|
+
└────────────────────────────────────────────────────────┘
|
|
81
|
+
│ (Signed Attestation Payload)
|
|
82
|
+
▼
|
|
83
|
+
[ Robinhood Chain L2 (Arbitrum Orbit) ]
|
|
84
|
+
└─ ERC-4337 Smart Account Settlement
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 💬 Community & Support
|
|
90
|
+
|
|
91
|
+
* **X (Twitter):** [@liminafi](https://x.com/liminafi)
|
|
92
|
+
* **Website & Simulator:** [http://localhost:5173](http://localhost:5173)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# 🌿 Limina SDK (`limina-sdk`)
|
|
2
|
+
> **The Liminal Layer for Agentic Strategies on Robinhood Chain**
|
|
3
|
+
|
|
4
|
+
[](https://www.python.org)
|
|
5
|
+
[](https://x.com/liminafi)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
`limina-sdk` is an open-source Python framework designed to bridge non-deterministic AI decisions (LLM outputs) with deterministic EVM execution on **Robinhood Chain**.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ⚡ Key Features
|
|
13
|
+
|
|
14
|
+
* 🛡️ **Deterministic Guardrails:** Hard caps on daily USD spend, max slippage tolerance, stop-loss triggers, and contract whitelists.
|
|
15
|
+
* ⚡ **Anvil Microsecond EVM Dry-Run:** Local state fork test before broadcasting transactions to Robinhood L2.
|
|
16
|
+
* 🔌 **Framework Adapters:** Pre-built adapters for ElizaOS, LangChain, CrewAI, AutoGen, and custom Python LLM loops.
|
|
17
|
+
* 🚀 **Zero-Gas Intent Relays:** Intent aggregation & batching optimized for Robinhood Chain liquidity.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🚀 Quickstart
|
|
22
|
+
|
|
23
|
+
### 1. Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install limina-sdk
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Basic Example
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from limina import LiminaAgent, Guardrails, RobinhoodChain
|
|
33
|
+
|
|
34
|
+
# Define dynamic guardrails
|
|
35
|
+
guard = Guardrails(
|
|
36
|
+
max_daily_spend_usd=250.0,
|
|
37
|
+
max_slippage_pct=0.5,
|
|
38
|
+
anvil_simulation=True
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Instantiate safe agent
|
|
42
|
+
agent = LiminaAgent(chain=RobinhoodChain.MAINNET, guardrails=guard)
|
|
43
|
+
|
|
44
|
+
# Execute safe swap on Robinhood L2
|
|
45
|
+
result = agent.swap(from_token="USDC", to_token="WETH", amount_usd=50.0)
|
|
46
|
+
|
|
47
|
+
print("Status:", result["status"])
|
|
48
|
+
print("Tx Hash:", result["tx_hash"])
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 🛠️ Architecture
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
[ AI Agent Output (LangChain/ElizaOS) ]
|
|
57
|
+
│
|
|
58
|
+
▼
|
|
59
|
+
┌────────────────────────────────────────────────────────┐
|
|
60
|
+
│ LIMINA GUARDRAIL ENGINE (Python) │
|
|
61
|
+
│ ├─ 1. Daily Spend Check ($ Limit) │
|
|
62
|
+
│ ├─ 2. Slippage Tolerance Check (%) │
|
|
63
|
+
│ ├─ 3. Contract Whitelist Verification │
|
|
64
|
+
│ └─ 4. Anvil EVM State Fork Dry-Run (20ms) │
|
|
65
|
+
└────────────────────────────────────────────────────────┘
|
|
66
|
+
│ (Signed Attestation Payload)
|
|
67
|
+
▼
|
|
68
|
+
[ Robinhood Chain L2 (Arbitrum Orbit) ]
|
|
69
|
+
└─ ERC-4337 Smart Account Settlement
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 💬 Community & Support
|
|
75
|
+
|
|
76
|
+
* **X (Twitter):** [@liminafi](https://x.com/liminafi)
|
|
77
|
+
* **Website & Simulator:** [http://localhost:5173](http://localhost:5173)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "limina-sdk"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "The Liminal Layer for Agentic Strategies on Robinhood Chain"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Limina", email = "dev@limina.fi"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["ai-agents", "robinhood-chain", "web3", "arbitrum-orbit", "guardrails", "evm-simulation"]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"web3>=6.0.0",
|
|
18
|
+
"pydantic>=2.0.0"
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.scripts]
|
|
22
|
+
limina = "limina.cli:main"
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://x.com/liminafi"
|
|
26
|
+
Documentation = "http://localhost:5173"
|
|
27
|
+
Repository = "https://github.com/liminafi/limina-sdk"
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: limina-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Liminal Layer for Agentic Strategies on Robinhood Chain
|
|
5
|
+
Author-email: Limina <dev@limina.fi>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://x.com/liminafi
|
|
8
|
+
Project-URL: Documentation, http://localhost:5173
|
|
9
|
+
Project-URL: Repository, https://github.com/liminafi/limina-sdk
|
|
10
|
+
Keywords: ai-agents,robinhood-chain,web3,arbitrum-orbit,guardrails,evm-simulation
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: web3>=6.0.0
|
|
14
|
+
Requires-Dist: pydantic>=2.0.0
|
|
15
|
+
|
|
16
|
+
# 🌿 Limina SDK (`limina-sdk`)
|
|
17
|
+
> **The Liminal Layer for Agentic Strategies on Robinhood Chain**
|
|
18
|
+
|
|
19
|
+
[](https://www.python.org)
|
|
20
|
+
[](https://x.com/liminafi)
|
|
21
|
+
[](LICENSE)
|
|
22
|
+
|
|
23
|
+
`limina-sdk` is an open-source Python framework designed to bridge non-deterministic AI decisions (LLM outputs) with deterministic EVM execution on **Robinhood Chain**.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## ⚡ Key Features
|
|
28
|
+
|
|
29
|
+
* 🛡️ **Deterministic Guardrails:** Hard caps on daily USD spend, max slippage tolerance, stop-loss triggers, and contract whitelists.
|
|
30
|
+
* ⚡ **Anvil Microsecond EVM Dry-Run:** Local state fork test before broadcasting transactions to Robinhood L2.
|
|
31
|
+
* 🔌 **Framework Adapters:** Pre-built adapters for ElizaOS, LangChain, CrewAI, AutoGen, and custom Python LLM loops.
|
|
32
|
+
* 🚀 **Zero-Gas Intent Relays:** Intent aggregation & batching optimized for Robinhood Chain liquidity.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 🚀 Quickstart
|
|
37
|
+
|
|
38
|
+
### 1. Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install limina-sdk
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. Basic Example
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from limina import LiminaAgent, Guardrails, RobinhoodChain
|
|
48
|
+
|
|
49
|
+
# Define dynamic guardrails
|
|
50
|
+
guard = Guardrails(
|
|
51
|
+
max_daily_spend_usd=250.0,
|
|
52
|
+
max_slippage_pct=0.5,
|
|
53
|
+
anvil_simulation=True
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# Instantiate safe agent
|
|
57
|
+
agent = LiminaAgent(chain=RobinhoodChain.MAINNET, guardrails=guard)
|
|
58
|
+
|
|
59
|
+
# Execute safe swap on Robinhood L2
|
|
60
|
+
result = agent.swap(from_token="USDC", to_token="WETH", amount_usd=50.0)
|
|
61
|
+
|
|
62
|
+
print("Status:", result["status"])
|
|
63
|
+
print("Tx Hash:", result["tx_hash"])
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 🛠️ Architecture
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
[ AI Agent Output (LangChain/ElizaOS) ]
|
|
72
|
+
│
|
|
73
|
+
▼
|
|
74
|
+
┌────────────────────────────────────────────────────────┐
|
|
75
|
+
│ LIMINA GUARDRAIL ENGINE (Python) │
|
|
76
|
+
│ ├─ 1. Daily Spend Check ($ Limit) │
|
|
77
|
+
│ ├─ 2. Slippage Tolerance Check (%) │
|
|
78
|
+
│ ├─ 3. Contract Whitelist Verification │
|
|
79
|
+
│ └─ 4. Anvil EVM State Fork Dry-Run (20ms) │
|
|
80
|
+
└────────────────────────────────────────────────────────┘
|
|
81
|
+
│ (Signed Attestation Payload)
|
|
82
|
+
▼
|
|
83
|
+
[ Robinhood Chain L2 (Arbitrum Orbit) ]
|
|
84
|
+
└─ ERC-4337 Smart Account Settlement
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 💬 Community & Support
|
|
90
|
+
|
|
91
|
+
* **X (Twitter):** [@liminafi](https://x.com/liminafi)
|
|
92
|
+
* **Website & Simulator:** [http://localhost:5173](http://localhost:5173)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/limina_sdk.egg-info/PKG-INFO
|
|
4
|
+
src/limina_sdk.egg-info/SOURCES.txt
|
|
5
|
+
src/limina_sdk.egg-info/dependency_links.txt
|
|
6
|
+
src/limina_sdk.egg-info/entry_points.txt
|
|
7
|
+
src/limina_sdk.egg-info/requires.txt
|
|
8
|
+
src/limina_sdk.egg-info/top_level.txt
|
|
9
|
+
tests/test_guardrails.py
|
|
10
|
+
tests/test_new_features.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Unit tests for Limina Guardrails & Agent Execution
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import unittest
|
|
6
|
+
import sys
|
|
7
|
+
import os
|
|
8
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
|
9
|
+
|
|
10
|
+
from limina import LiminaAgent, Guardrails, RobinhoodChain, LiminaGuardrailException
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TestLiminaGuardrails(unittest.TestCase):
|
|
14
|
+
def test_guardrail_spend_limit(self):
|
|
15
|
+
guard = Guardrails(max_daily_spend_usd=100.0)
|
|
16
|
+
agent = LiminaAgent(chain=RobinhoodChain.MAINNET, guardrails=guard)
|
|
17
|
+
|
|
18
|
+
# Valid spend
|
|
19
|
+
res = agent.swap("USDC", "WETH", 50.0)
|
|
20
|
+
self.assertEqual(res["status"], "APPROVED")
|
|
21
|
+
|
|
22
|
+
# Exceeding spend limit raises exception
|
|
23
|
+
with self.assertRaises(LiminaGuardrailException):
|
|
24
|
+
agent.swap("USDC", "WETH", 60.0)
|
|
25
|
+
|
|
26
|
+
def test_guardrail_slippage_limit(self):
|
|
27
|
+
guard = Guardrails(max_slippage_pct=0.5)
|
|
28
|
+
agent = LiminaAgent(chain=RobinhoodChain.MAINNET, guardrails=guard)
|
|
29
|
+
|
|
30
|
+
# Exceeding slippage limit raises exception
|
|
31
|
+
with self.assertRaises(LiminaGuardrailException):
|
|
32
|
+
agent.execute_strategy(action="SWAP", amount_usd=10.0, expected_slippage_pct=1.5)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
unittest.main()
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Unit tests for Limina Strategies, Attestation Ledger & Contract Helpers
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import unittest
|
|
6
|
+
import sys
|
|
7
|
+
import os
|
|
8
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
|
9
|
+
|
|
10
|
+
from limina import (
|
|
11
|
+
LiminaAgent,
|
|
12
|
+
Guardrails,
|
|
13
|
+
RobinhoodChain,
|
|
14
|
+
DCAVolatilityStrategy,
|
|
15
|
+
YieldRebalanceStrategy,
|
|
16
|
+
AttestationLedger,
|
|
17
|
+
ERC20ContractHelper,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TestLiminaNewFeatures(unittest.TestCase):
|
|
22
|
+
def setUp(self):
|
|
23
|
+
self.guard = Guardrails(max_daily_spend_usd=500.0)
|
|
24
|
+
self.agent = LiminaAgent(chain=RobinhoodChain.MAINNET, guardrails=self.guard)
|
|
25
|
+
|
|
26
|
+
def test_dca_strategy(self):
|
|
27
|
+
strategy = DCAVolatilityStrategy(self.agent, amount_usd=50.0, volatility_threshold=0.05)
|
|
28
|
+
# Volatility <= 0.05 triggers execution
|
|
29
|
+
res = strategy.evaluate_and_execute(current_market_volatility=0.03)
|
|
30
|
+
self.assertIsNotNone(res)
|
|
31
|
+
self.assertEqual(res["status"], "APPROVED")
|
|
32
|
+
|
|
33
|
+
# Volatility > 0.05 does not trigger
|
|
34
|
+
res_none = strategy.evaluate_and_execute(current_market_volatility=0.08)
|
|
35
|
+
self.assertIsNone(res_none)
|
|
36
|
+
|
|
37
|
+
def test_yield_rebalance_strategy(self):
|
|
38
|
+
strategy = YieldRebalanceStrategy(self.agent, "0x1111111111111111111111111111111111111111", "0x2222222222222222222222222222222222222222")
|
|
39
|
+
res = strategy.rebalance(yield_a_apy=3.0, yield_b_apy=6.5, amount_usd=100.0)
|
|
40
|
+
self.assertIsNotNone(res)
|
|
41
|
+
self.assertEqual(res["status"], "APPROVED")
|
|
42
|
+
|
|
43
|
+
def test_attestation_ledger(self):
|
|
44
|
+
ledger = AttestationLedger()
|
|
45
|
+
att = ledger.create_attestation(
|
|
46
|
+
agent_wallet=self.agent.wallet_address,
|
|
47
|
+
action="SWAP_USDC_WETH",
|
|
48
|
+
amount_usd=50.0,
|
|
49
|
+
target_contract="0x3a82e91a0c8b919e0000000000000000000019e0",
|
|
50
|
+
payload_data={"slippage": 0.15},
|
|
51
|
+
)
|
|
52
|
+
self.assertTrue(att.attestation_id.startswith("attest_"))
|
|
53
|
+
self.assertEqual(len(ledger.export_ledger()), 1)
|
|
54
|
+
|
|
55
|
+
def test_erc20_contract_helper(self):
|
|
56
|
+
calldata = ERC20ContractHelper.encode_approve("0x3a82e91a0c8b919e0000000000000000000019e0", 1000000)
|
|
57
|
+
self.assertTrue(calldata.startswith("0x095ea7b3")) # approve function selector
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if __name__ == "__main__":
|
|
61
|
+
unittest.main()
|