Skip to main content

routon-sdk (Python)

Python SDK for Routon Protocol — the open execution layer for AI agents in DeFi.

PyPI License: MIT

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 from agent-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 --strict clean, py.typed marker 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.

Metadata

Release files for routon-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for routon-sdk 0.1.0
File Size Uploaded Provenance Actions
routon_sdk-0.1.0.tar.gz 148.6 kB With provenance Details for routon_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for routon-sdk 0.1.0
File Interpreter ABI Platform Actions
routon_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for routon_sdk-0.1.0-py3-none-any.whl

Total release size: 165.6 kB

Release files / routon_sdk-0.1.0.tar.gz

Download URL routon_sdk-0.1.0.tar.gz
Size 148.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1821a50794e34f3293f3957bd893b1554e390bba0c5b918779d9f7e35f659d20
BLAKE2b-256 checksum
How to use checksums
b5675ad024420683a0872e872116b98d3b3461b7dbd95fa516da71f82f661178
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / routon_sdk-0.1.0-py3-none-any.whl

Download URL routon_sdk-0.1.0-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9555ca21adbd7068b06529a4048e8e9300ef5c29816c28ff1232817e529400c7
BLAKE2b-256 checksum
How to use checksums
1e2c9e24e2d836ab93ff67716b78c3e4988651e32e5d86d4d789dd619c73cd1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Security for routon-sdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for routon_sdk-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page