Python SDK for Routon Protocol — the open execution layer for AI agents in DeFi.
Project description
routon-sdk (Python)
Python SDK for Routon Protocol — the open execution layer for AI agents in DeFi.
Status: v0.1.0 — first usable API. Schemas regenerated mechanically from the frozen agent-brain/openapi.json via datamodel-codegen. Four audit-grade parity helpers ship byte-equivalent with TypeScript (@routon/sdk) and Solidity (contracts/src/). Live integration tests against deployed brain land in PR-A.5 (Wave 2.5 follow-up).
Install
uv add routon-sdk
# or
pip install routon-sdk
Quickstart
import asyncio
from routon import RoutonAgent, RoutonAgentConfig, Intent
async def main() -> None:
cfg = RoutonAgentConfig(
default_chain="base",
builder_code="0x" + "ab" * 32, # required for free-tier endpoints
)
async with RoutonAgent(cfg) as agent:
intent = Intent(
asset="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", # USDC
amount="10000000000", # 10,000 USDC (6 decimals)
userAddress="0xUSER...",
builderCode="0x" + "ab" * 32,
chain="base",
)
best = await agent.find_best(intent)
print(best.id, best.expectedApy.total)
asyncio.run(main())
Parity helpers (audit-grade)
Four byte-equivalent helpers mirror the on-chain + agent-brain implementations:
from routon import (
compute_strategy_id, # 5-tuple keccak vs StrategyRegistry.sol:334
compute_attestation_typehash, # EIP-712 vs ValidationRegistry.sol:60-61
canonical_factors_hash, # RFC 8785 JCS via jcs library
encode_execute_params, # 9-field ExecuteParams vs PrimitiveExecutor.sol:36-46
EXECUTE_SELECTOR, # 0x918fafc5
EXECUTE_BATCH_SELECTOR, # 0x062f75e9
)
sid = compute_strategy_id(
chain_id=8453,
protocol="aave-v3",
asset="0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
output_asset="0x4200000000000000000000000000000000000006",
strategy_version="0.1",
)
Each helper has a pinned hex regression-gate test mirroring agent-brain/tests/. Drift on any anchor surfaces as HIGH — surface and HALT.
What this SDK does
- Wraps the Routon Brain API (
brain.routon.xyz) — 11 endpoints fromagent-brain/openapi.json. - Validates all input/output via Pydantic v2 schemas regenerated from the frozen OpenAPI 3.1 spec.
- Ships parity helpers for cross-language byte-equivalence with TypeScript (
canonicalize) + Solidity (cast). - Python 3.12+. Async-first (
asyncio+httpx). - Fully typed,
mypy --strictclean,py.typedmarker shipped.
What it does not do
- Custody. Routon is non-custodial. The SDK never holds keys; calldata is returned for the caller to sign.
- Send transactions on your behalf. The caller signs and broadcasts via
web3.py/ wallet of choice.
Build & test
uv sync --extra dev
uv run pytest # 39 tests (9 smoke + 30 parity)
uv run mypy --strict routon
uv run ruff check
bash scripts/regen-schemas.sh # committed output; CI verifies stability
Versioning
0.0.x— placeholder + scaffolding (Wave 0).0.1.x— first usable API; tracks Routon Standard v0.1 (Wave 3, current).1.0.0— mainnet-ready, audited contracts deployed, schema frozen.
License
MIT — see ../../LICENSE-MIT.txt.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file routon_sdk-0.1.0.tar.gz.
File metadata
- Download URL: routon_sdk-0.1.0.tar.gz
- Upload date:
- Size: 148.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1821a50794e34f3293f3957bd893b1554e390bba0c5b918779d9f7e35f659d20
|
|
| MD5 |
4c232385d395ca329e31f746eec66ea9
|
|
| BLAKE2b-256 |
b5675ad024420683a0872e872116b98d3b3461b7dbd95fa516da71f82f661178
|
Provenance
The following attestation bundles were made for routon_sdk-0.1.0.tar.gz:
Publisher:
sdk-publish.yml on Dmitrze/routon-protocol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
routon_sdk-0.1.0.tar.gz -
Subject digest:
1821a50794e34f3293f3957bd893b1554e390bba0c5b918779d9f7e35f659d20 - Sigstore transparency entry: 1497868471
- Sigstore integration time:
-
Permalink:
Dmitrze/routon-protocol@affa06c55b99c402ace8caa1354948531673588b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Dmitrze
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-publish.yml@affa06c55b99c402ace8caa1354948531673588b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file routon_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: routon_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9555ca21adbd7068b06529a4048e8e9300ef5c29816c28ff1232817e529400c7
|
|
| MD5 |
c9a86144b9fa39ca27483cf0b0de16d5
|
|
| BLAKE2b-256 |
1e2c9e24e2d836ab93ff67716b78c3e4988651e32e5d86d4d789dd619c73cd1b
|
Provenance
The following attestation bundles were made for routon_sdk-0.1.0-py3-none-any.whl:
Publisher:
sdk-publish.yml on Dmitrze/routon-protocol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
routon_sdk-0.1.0-py3-none-any.whl -
Subject digest:
9555ca21adbd7068b06529a4048e8e9300ef5c29816c28ff1232817e529400c7 - Sigstore transparency entry: 1497868602
- Sigstore integration time:
-
Permalink:
Dmitrze/routon-protocol@affa06c55b99c402ace8caa1354948531673588b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Dmitrze
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-publish.yml@affa06c55b99c402ace8caa1354948531673588b -
Trigger Event:
workflow_dispatch
-
Statement type: