sardis-langchain
LangChain integration for Sardis -- the Payment OS for the Agent Economy.
Gives your LangChain agents the ability to make real, policy-enforced stablecoin payments through Sardis MPC wallets.
Installation
pip install sardis-langchain
Quick Start
from sardis import SardisClient
from sardis_langchain import SardisToolkit
# 1. Initialize Sardis
client = SardisClient(api_key="sk_...")
wallet = client.wallets.create(
name="procurement-agent",
chain="base",
policy="Max $100 per transaction, daily limit $500",
)
# 2. Create LangChain tools
toolkit = SardisToolkit(client=client, wallet_id=wallet.id)
tools = toolkit.get_tools()
# 3. Attach to any LangChain agent
from langchain.agents import AgentExecutor, create_react_agent
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o", temperature=0)
agent = create_react_agent(llm, tools, your_prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
result = executor.invoke({
"input": "Pay $30 to Anthropic for API credits and $15 to GitHub for Copilot"
})
Available Tools
| Tool | Name | Description |
|---|---|---|
SardisPayTool |
sardis_pay |
Execute a policy-enforced payment |
SardisCheckBalanceTool |
sardis_check_balance |
Check wallet balance and limits |
SardisCheckPolicyTool |
sardis_check_policy |
Dry-run a payment against policy |
SardisSetPolicyTool |
sardis_set_policy |
Set spending policy from natural language |
SardisListTransactionsTool |
sardis_list_transactions |
View recent transaction history |
Toolkit Options
Full toolkit (all 5 tools)
toolkit = SardisToolkit(client=client, wallet_id=wallet.id)
tools = toolkit.get_tools()
Payment-only tools (3 tools)
tools = toolkit.get_payment_tools() # pay + balance + policy check
Individual tools
from sardis_langchain import SardisPayTool, SardisCheckBalanceTool
pay_tool = SardisPayTool(client=client, wallet_id=wallet.id)
balance_tool = SardisCheckBalanceTool(client=client, wallet_id=wallet.id)
Callback Handler
Track Sardis operations with the built-in callback handler:
from sardis_langchain import SardisCallbackHandler
handler = SardisCallbackHandler()
executor = AgentExecutor(agent=agent, tools=tools, callbacks=[handler])
# After execution, inspect the audit trail
for record in handler.get_payment_records():
print(record)
How Policy Enforcement Works
Every payment goes through Sardis's policy engine before execution:
Agent calls sardis_pay(to="openai.com", amount="25.00")
|
v
Policy Engine checks:
1. Per-transaction limit -> Is $25 under the cap?
2. Balance check -> Enough funds?
3. Total spending limit -> Under lifetime cap?
4. Wallet active -> Is the wallet enabled?
|
v
PASS -> Execute payment, return tx_hash
FAIL -> Return rejection reason (no funds move)
Simulation Mode
By default, SardisClient runs in simulation mode -- all operations execute locally without network calls. This is ideal for prototyping and testing agent payment flows.
# No API key needed for simulation
client = SardisClient()
wallet = client.wallets.create(name="test-agent", chain="base", policy="Max $50/tx")
toolkit = SardisToolkit(client=client, wallet_id=wallet.id)
# All tools work locally -- no real money moves
Links
Metadata
Release files for sardis-langchain 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sardis_langchain-1.0.0.tar.gz | 10.5 kB | Without provenance | Details for sardis_langchain-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sardis_langchain-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for sardis_langchain-1.0.0-py3-none-any.whl |
Total release size: 21.2 kB
Release files / sardis_langchain-1.0.0.tar.gz
| Download URL | sardis_langchain-1.0.0.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5fe029218bb1e73828fcaa3aff94a7f434b3bfc9f2cfda0c1f6a336c490ea75
|
|
BLAKE2b-256 checksum How to use checksums |
299dda258750fc38e4ae3504fb38d5d12f143c343191edf7db678aae929af7af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / sardis_langchain-1.0.0-py3-none-any.whl
| Download URL | sardis_langchain-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5632fd488949e641af90470b455350b60e811c6a14f2b90dce4142291cab2550
|
|
BLAKE2b-256 checksum How to use checksums |
715b7c7a7e0adea1088573e8930c4cba72701dd9054ec7c4c878182b4d6717a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for sardis-langchain 1.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.