agent-sdk

August 6, 2026 · View on GitHub

e89e95aa8ed6a99833394682c6632cb7

agent-sdk

Off-chain SDKs (TypeScript, Python, Go, Rust) for the ERCs defined in trustless-ai/agent-ercs.

What this is

agent-sdk is the off-chain half of the trustless-ai stack — agent-ercs defines the on-chain Solidity interfaces, and this repo provides the client libraries that talk to them. It does two things:

  • Call contracts — typed clients that read and write deployed ERC contracts, wrapping viem (TypeScript) / web3.py (Python) / ethclient (Go) / alloy (Rust) with the exact types and method names from each ERC interface.
  • Recompute claims — pure stateless functions that reproduce ERC-defined cryptographic operations (hashing, padding, encoding, arithmetic) from public inputs, without touching a chain. Every recompute function is tested against golden conformance vectors so you can verify a claim locally, offline, or in a browser.

This SDK is AI-generated, not hand-written. Every ERC's client code, tests, and documentation is produced by an AI coding agent following the /add-erc skill — not typed by a human line by line. See Adding a new ERC.


Supported ERCs

ERCCategoryContract CallsRecompute
ERC-8263 — OnChain Proof AnchoranchorOnChainProofClient
ERC-8004 — Identity RegistryidentityIdentityRegistryClientcomputeAgentId
ERC-8323 — Source-Token Agent BindingidentitySourceBindingClient
ERC-8274 — AI Inference ProofverifyProofVerifierClient, AgentVerifierClient, getTrustedVerifier
ERC-8281 — Observation Commitment Protocol (OCP)verifyObservationCommitmentClientcomputeObservationDigest
ERC-8299 — WYRIWE Input ProvenanceverifyWyriweAttestationClient, JudgmentExecutionClientcomputeRawInputHash, computeSanitizationPipelineHash
ERC-8301 — Agent ExecutionexecutionAgentWorkflowClientcomputeTaskHash, computeReplyHash
ERC-8203 — Consult EscrowsettlementConsultEscrowClientcomputeVerdictHash
ERC-8275 — Agent ReputationreputationAgentReputationClientcomputeWinRate
ERC-8312 — Bounded Agent ActionsmeteringBoundedAgentActionClient, BudgetSubstrateClient, ContestableEnvelopeClientcheckStatefulBound, checkCursorHeadroom

Contract Calls are typed clients that call deployed contracts. Recompute functions are pure, stateless, and run without an RPC endpoint — they reproduce the same deterministic computation the contract performs, verified against golden conformance vectors.


Using the SDKs

TypeScript

npm install @trustless-ai/agent-sdk
// Contract call — talk to a deployed ERC contract
import { SomeClient } from '@trustless-ai/agent-sdk/<category>/<ERCXXXX>'

const client = new SomeClient({ rpcUrl, address: deployedAddress }, account)
const result = await client.someMethod(...)

// Recompute — verify a claim without touching the chain
import { someHash } from '@trustless-ai/agent-sdk/<category>/<ERCXXXX>/recompute'

const hash = someHash(publicInput)

Python

cd python
python3 -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'
# Contract call
from agent_sdk.<category>.<ercxxxx>.client import SomeClient

client = SomeClient(rpc_url, deployed_address, account)
result = client.some_method(...)

# Recompute
from agent_sdk.<category>.<ercxxxx>.recompute import some_hash

hash = some_hash(public_input)

Go

go get github.com/trustless-ai/agent-sdk/go
// Contract call — talk to a deployed ERC contract
import "github.com/trustless-ai/agent-sdk/go/<category>/<erc_lowercase>"

client := ercxxxx.NewXxxClient(rpcClient, contractAddress)
result, err := client.SomeMethod(...)

// Recompute — verify a claim without touching the chain
hash, err := ercxxxx.ComputeSomeHash(publicInput)

Rust

# See rust/ directory — Cargo workspace with core + providers crates
// Contract call — via DataProvider trait (host or guest context)
use agent_sdk_core::erc8281::ObservationCommitmentClient;

let client = ObservationCommitmentClient::new(provider);
let recorded = client.check_recorded(digest)?;

// Recompute — pure stateless function
use agent_sdk_core::erc8275::compute_win_rate;

let rate = compute_win_rate(16, 15); // Some(5161)

Each ERC's own README.md documents the full method list, types, and whether verify() is available for that ERC.


Adding a new ERC

Open this repo in Claude Code and run:

/add-erc

Tell it which ERC number, or let it ask. It will:

  1. Read the ERC's interface and README from the agent-ercs submodule.
  2. Judge which capability applies — contract calls, recompute, or both — with stated reasoning.
  3. Propose the client API for your approval before writing any code.
  4. Write the TypeScript and Python clients, recompute functions (where applicable), test contracts, and tests.
  5. Run every test to green.

If agent-ercs changes an ERC you already support, run /update-erc instead — it diffs against what's implemented and only re-does the classification if the change affects it.

Both skills are defined in .claude/skills/add-erc/SKILL.md and .claude/skills/update-erc/SKILL.md. This is also how you contribute to this repo — the skills are the contribution pipeline.


License

Apache 2.0 — see LICENSE.