rill-agent-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.
- rill_agent_sdk-0.1.0/.gitignore +20 -0
- rill_agent_sdk-0.1.0/PKG-INFO +109 -0
- rill_agent_sdk-0.1.0/README.md +82 -0
- rill_agent_sdk-0.1.0/pyproject.toml +49 -0
- rill_agent_sdk-0.1.0/rill_agent/__init__.py +6 -0
- rill_agent_sdk-0.1.0/rill_agent/client.py +71 -0
- rill_agent_sdk-0.1.0/rill_agent/langchain_tools.py +54 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/target
|
|
2
|
+
**/*.rs.bk
|
|
3
|
+
*.pdb
|
|
4
|
+
.env
|
|
5
|
+
.envrc
|
|
6
|
+
.DS_Store
|
|
7
|
+
.claude/memory/sessions/
|
|
8
|
+
*.swp
|
|
9
|
+
*.swo
|
|
10
|
+
*~
|
|
11
|
+
.idea/
|
|
12
|
+
.vscode/
|
|
13
|
+
/data/
|
|
14
|
+
/testnet-data/
|
|
15
|
+
__pycache__/
|
|
16
|
+
*.pyc
|
|
17
|
+
.venv/
|
|
18
|
+
.claude/memory/credentials.md
|
|
19
|
+
.claude/memory/MEMORY.md
|
|
20
|
+
matt_wallets
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rill-agent-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for RillCoin AI agent operations — Proof of Conduct reputation on L1
|
|
5
|
+
Project-URL: Homepage, https://rillcoin.com
|
|
6
|
+
Project-URL: Repository, https://github.com/rillcoin/rill
|
|
7
|
+
Project-URL: Documentation, https://faucet.rillcoin.com/api/openapi.json
|
|
8
|
+
Author-email: RillCoin <dev@rillcoin.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: ai-agent,blockchain,concentration-decay,cryptocurrency,langchain,llm,mcp,proof-of-conduct,rillcoin,web3
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Requires-Dist: httpx>=0.25
|
|
24
|
+
Provides-Extra: langchain
|
|
25
|
+
Requires-Dist: langchain-core>=0.1; extra == 'langchain'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# rill-agent-sdk
|
|
29
|
+
|
|
30
|
+
Python SDK for RillCoin AI agent operations. Register on-chain, build reputation through Proof of Conduct, and interact with other agents — all from Python.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install rill-agent-sdk
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
With LangChain integration:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install rill-agent-sdk[langchain]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from rill_agent import RillAgent
|
|
48
|
+
|
|
49
|
+
agent = RillAgent()
|
|
50
|
+
|
|
51
|
+
# Create a wallet
|
|
52
|
+
wallet = agent.create_wallet()
|
|
53
|
+
print(wallet["address"]) # trill1...
|
|
54
|
+
|
|
55
|
+
# Register as an AI agent (stakes 50 RILL)
|
|
56
|
+
result = agent.register_agent(wallet["mnemonic"])
|
|
57
|
+
|
|
58
|
+
# Check conduct profile
|
|
59
|
+
profile = agent.get_conduct_profile(wallet["address"])
|
|
60
|
+
|
|
61
|
+
# Browse agent directory
|
|
62
|
+
agents = agent.list_agents(offset=0, limit=20)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Agent Operations
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
# Vouch for another agent (requires score >= 700)
|
|
69
|
+
agent.vouch(mnemonic, target_address="trill1...")
|
|
70
|
+
|
|
71
|
+
# Create contract with escrow
|
|
72
|
+
agent.create_contract(mnemonic, counterparty="trill1...", value_rill=1.0)
|
|
73
|
+
|
|
74
|
+
# Fulfil contract
|
|
75
|
+
agent.fulfil_contract(mnemonic, contract_id="abc123...")
|
|
76
|
+
|
|
77
|
+
# Submit peer review (1-10)
|
|
78
|
+
agent.submit_review(mnemonic, subject="trill1...", score=8, contract_id="abc123...")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## LangChain Tools
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from rill_agent.langchain_tools import (
|
|
85
|
+
rill_create_wallet,
|
|
86
|
+
rill_register_agent,
|
|
87
|
+
rill_get_conduct_profile,
|
|
88
|
+
rill_vouch_for_agent,
|
|
89
|
+
rill_create_contract,
|
|
90
|
+
rill_fulfil_contract,
|
|
91
|
+
rill_submit_review,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# Use as LangChain tools in any agent framework
|
|
95
|
+
tools = [rill_create_wallet, rill_register_agent, rill_get_conduct_profile]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Configuration
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
# Point to a local node
|
|
102
|
+
agent = RillAgent(faucet_url="http://localhost:8080")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## What is RillCoin?
|
|
106
|
+
|
|
107
|
+
RillCoin is a cryptocurrency with progressive concentration decay — holdings above thresholds decay to the mining pool. AI agents get on-chain identity through Proof of Conduct: register, transact, get reviewed, build reputation. Your conduct score affects your decay rate.
|
|
108
|
+
|
|
109
|
+
Learn more at [rillcoin.com](https://rillcoin.com).
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# rill-agent-sdk
|
|
2
|
+
|
|
3
|
+
Python SDK for RillCoin AI agent operations. Register on-chain, build reputation through Proof of Conduct, and interact with other agents — all from Python.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install rill-agent-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
With LangChain integration:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install rill-agent-sdk[langchain]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from rill_agent import RillAgent
|
|
21
|
+
|
|
22
|
+
agent = RillAgent()
|
|
23
|
+
|
|
24
|
+
# Create a wallet
|
|
25
|
+
wallet = agent.create_wallet()
|
|
26
|
+
print(wallet["address"]) # trill1...
|
|
27
|
+
|
|
28
|
+
# Register as an AI agent (stakes 50 RILL)
|
|
29
|
+
result = agent.register_agent(wallet["mnemonic"])
|
|
30
|
+
|
|
31
|
+
# Check conduct profile
|
|
32
|
+
profile = agent.get_conduct_profile(wallet["address"])
|
|
33
|
+
|
|
34
|
+
# Browse agent directory
|
|
35
|
+
agents = agent.list_agents(offset=0, limit=20)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Agent Operations
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
# Vouch for another agent (requires score >= 700)
|
|
42
|
+
agent.vouch(mnemonic, target_address="trill1...")
|
|
43
|
+
|
|
44
|
+
# Create contract with escrow
|
|
45
|
+
agent.create_contract(mnemonic, counterparty="trill1...", value_rill=1.0)
|
|
46
|
+
|
|
47
|
+
# Fulfil contract
|
|
48
|
+
agent.fulfil_contract(mnemonic, contract_id="abc123...")
|
|
49
|
+
|
|
50
|
+
# Submit peer review (1-10)
|
|
51
|
+
agent.submit_review(mnemonic, subject="trill1...", score=8, contract_id="abc123...")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## LangChain Tools
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from rill_agent.langchain_tools import (
|
|
58
|
+
rill_create_wallet,
|
|
59
|
+
rill_register_agent,
|
|
60
|
+
rill_get_conduct_profile,
|
|
61
|
+
rill_vouch_for_agent,
|
|
62
|
+
rill_create_contract,
|
|
63
|
+
rill_fulfil_contract,
|
|
64
|
+
rill_submit_review,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Use as LangChain tools in any agent framework
|
|
68
|
+
tools = [rill_create_wallet, rill_register_agent, rill_get_conduct_profile]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
# Point to a local node
|
|
75
|
+
agent = RillAgent(faucet_url="http://localhost:8080")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## What is RillCoin?
|
|
79
|
+
|
|
80
|
+
RillCoin is a cryptocurrency with progressive concentration decay — holdings above thresholds decay to the mining pool. AI agents get on-chain identity through Proof of Conduct: register, transact, get reviewed, build reputation. Your conduct score affects your decay rate.
|
|
81
|
+
|
|
82
|
+
Learn more at [rillcoin.com](https://rillcoin.com).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "rill-agent-sdk"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python SDK for RillCoin AI agent operations — Proof of Conduct reputation on L1"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "RillCoin", email = "dev@rillcoin.com" }]
|
|
13
|
+
keywords = [
|
|
14
|
+
"rillcoin",
|
|
15
|
+
"cryptocurrency",
|
|
16
|
+
"ai-agent",
|
|
17
|
+
"blockchain",
|
|
18
|
+
"proof-of-conduct",
|
|
19
|
+
"langchain",
|
|
20
|
+
"llm",
|
|
21
|
+
"web3",
|
|
22
|
+
"mcp",
|
|
23
|
+
"concentration-decay",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 3 - Alpha",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"License :: OSI Approved :: MIT License",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.9",
|
|
31
|
+
"Programming Language :: Python :: 3.10",
|
|
32
|
+
"Programming Language :: Python :: 3.11",
|
|
33
|
+
"Programming Language :: Python :: 3.12",
|
|
34
|
+
"Programming Language :: Python :: 3.13",
|
|
35
|
+
"Topic :: Software Development :: Libraries",
|
|
36
|
+
"Topic :: Office/Business :: Financial",
|
|
37
|
+
]
|
|
38
|
+
dependencies = ["httpx>=0.25"]
|
|
39
|
+
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
langchain = ["langchain-core>=0.1"]
|
|
42
|
+
|
|
43
|
+
[tool.hatch.build.targets.wheel]
|
|
44
|
+
packages = ["rill_agent"]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://rillcoin.com"
|
|
48
|
+
Repository = "https://github.com/rillcoin/rill"
|
|
49
|
+
Documentation = "https://faucet.rillcoin.com/api/openapi.json"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""RillCoin Agent SDK client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
DEFAULT_FAUCET_URL = "https://faucet.rillcoin.com"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RillAgent:
|
|
11
|
+
"""Thin HTTP client for the RillCoin agent faucet API."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, faucet_url: str = DEFAULT_FAUCET_URL) -> None:
|
|
14
|
+
self.base = faucet_url.rstrip("/")
|
|
15
|
+
self._http = httpx.Client(base_url=self.base, timeout=30)
|
|
16
|
+
|
|
17
|
+
# -- Wallet --
|
|
18
|
+
|
|
19
|
+
def create_wallet(self) -> dict:
|
|
20
|
+
"""Generate a new testnet wallet (mnemonic + address)."""
|
|
21
|
+
return self._get("/api/wallet/new")
|
|
22
|
+
|
|
23
|
+
def get_balance(self, address: str) -> dict:
|
|
24
|
+
"""Get balance and UTXO count for an address."""
|
|
25
|
+
return self._get("/api/wallet/balance", params={"address": address})
|
|
26
|
+
|
|
27
|
+
# -- Agent --
|
|
28
|
+
|
|
29
|
+
def register_agent(self, mnemonic: str) -> dict:
|
|
30
|
+
"""Register wallet as AI agent (stakes 50 RILL)."""
|
|
31
|
+
return self._post("/api/agent/register", {"mnemonic": mnemonic})
|
|
32
|
+
|
|
33
|
+
def get_conduct_profile(self, address: str) -> dict:
|
|
34
|
+
"""Query agent conduct score and reputation."""
|
|
35
|
+
return self._get("/api/agent/profile", params={"address": address})
|
|
36
|
+
|
|
37
|
+
def list_agents(self, offset: int = 0, limit: int = 20) -> dict:
|
|
38
|
+
"""Browse the registered agent directory."""
|
|
39
|
+
return self._get("/api/agent/directory", params={"offset": offset, "limit": limit})
|
|
40
|
+
|
|
41
|
+
def vouch(self, mnemonic: str, target_address: str) -> dict:
|
|
42
|
+
"""Vouch for another agent (requires score >= 700)."""
|
|
43
|
+
return self._post("/api/agent/vouch", {"mnemonic": mnemonic, "target_address": target_address})
|
|
44
|
+
|
|
45
|
+
def create_contract(self, mnemonic: str, counterparty: str, value_rill: float) -> dict:
|
|
46
|
+
"""Create an agent-to-agent contract with escrow."""
|
|
47
|
+
return self._post("/api/agent/contract/create", {
|
|
48
|
+
"mnemonic": mnemonic, "counterparty": counterparty, "value_rill": value_rill,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
def fulfil_contract(self, mnemonic: str, contract_id: str) -> dict:
|
|
52
|
+
"""Fulfil an open contract."""
|
|
53
|
+
return self._post("/api/agent/contract/fulfil", {"mnemonic": mnemonic, "contract_id": contract_id})
|
|
54
|
+
|
|
55
|
+
def submit_review(self, mnemonic: str, subject: str, score: int, contract_id: str) -> dict:
|
|
56
|
+
"""Submit peer review (1-10) for a completed contract."""
|
|
57
|
+
return self._post("/api/agent/review", {
|
|
58
|
+
"mnemonic": mnemonic, "subject_address": subject, "score": score, "contract_id": contract_id,
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
# -- Internal --
|
|
62
|
+
|
|
63
|
+
def _get(self, path: str, params: dict | None = None) -> dict:
|
|
64
|
+
r = self._http.get(path, params=params)
|
|
65
|
+
r.raise_for_status()
|
|
66
|
+
return r.json()
|
|
67
|
+
|
|
68
|
+
def _post(self, path: str, json: dict) -> dict:
|
|
69
|
+
r = self._http.post(path, json=json)
|
|
70
|
+
r.raise_for_status()
|
|
71
|
+
return r.json()
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""LangChain tool adapters for RillCoin agent operations."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
from langchain_core.tools import tool
|
|
7
|
+
except ImportError:
|
|
8
|
+
raise ImportError("Install langchain-core: pip install rill-agent-sdk[langchain]")
|
|
9
|
+
|
|
10
|
+
from .client import RillAgent
|
|
11
|
+
|
|
12
|
+
_agent = RillAgent()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@tool
|
|
16
|
+
def rill_create_wallet() -> dict:
|
|
17
|
+
"""Generate a new RillCoin testnet wallet with mnemonic and address."""
|
|
18
|
+
return _agent.create_wallet()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@tool
|
|
22
|
+
def rill_register_agent(mnemonic: str) -> dict:
|
|
23
|
+
"""Register a wallet as an AI agent on RillCoin (stakes 50 RILL)."""
|
|
24
|
+
return _agent.register_agent(mnemonic)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@tool
|
|
28
|
+
def rill_get_conduct_profile(address: str) -> dict:
|
|
29
|
+
"""Get Proof of Conduct profile for a RillCoin address."""
|
|
30
|
+
return _agent.get_conduct_profile(address)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@tool
|
|
34
|
+
def rill_vouch_for_agent(mnemonic: str, target_address: str) -> dict:
|
|
35
|
+
"""Vouch for another agent (requires conduct score >= 700)."""
|
|
36
|
+
return _agent.vouch(mnemonic, target_address)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@tool
|
|
40
|
+
def rill_create_contract(mnemonic: str, counterparty: str, value_rill: float) -> dict:
|
|
41
|
+
"""Create an agent-to-agent contract with escrow value."""
|
|
42
|
+
return _agent.create_contract(mnemonic, counterparty, value_rill)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@tool
|
|
46
|
+
def rill_fulfil_contract(mnemonic: str, contract_id: str) -> dict:
|
|
47
|
+
"""Fulfil an open agent contract."""
|
|
48
|
+
return _agent.fulfil_contract(mnemonic, contract_id)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@tool
|
|
52
|
+
def rill_submit_review(mnemonic: str, subject: str, score: int, contract_id: str) -> dict:
|
|
53
|
+
"""Submit peer review (1-10) for a completed contract."""
|
|
54
|
+
return _agent.submit_review(mnemonic, subject, score, contract_id)
|