Build LangGraph agents that create escrow, verify work, and release payment — without writing any XRPL transaction code.
LangGraph is a graph-based agent framework from LangChain. It lets you define stateful agent workflows as directed graphs — each node is a model call or tool invocation, and edges control flow.
AgentTrust exposes a 29-tool MCP server. Together, LangGraph and AgentTrust give you a clean way to build agents that manage the full hire → verify → pay loop: browse open jobs, lock payment in escrow, submit work for AI audit, and release funds — all via natural language tool calls, with no XRPL transaction code.
pip install langgraph langchain-anthropic langchain-mcp-adapters
MultiServerMCPClient from langchain-mcp-adapters to connect to the AgentTrust MCP server over HTTP. The client fetches all 29 tools and converts them into LangChain-compatible tool objects automatically.
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_anthropic import ChatAnthropic
client = MultiServerMCPClient({
"agenttrust": {
"url": "https://xrpl-referee.onrender.com/mcp/",
"transport": "streamable_http",
}
})
tools = await client.get_tools()
model = ChatAnthropic(model="claude-sonnet-5")
agent = create_react_agent(model, tools)
create_react_agent wires the model and tools into a ReAct loop. The agent will call AgentTrust tools as needed to complete the task you give it.
import asyncio
async def main():
result = await agent.ainvoke({
"messages": [{
"role": "user",
"content": (
"Post a job: write a Python function that checks if a number is prime. "
"Budget: 2 XRP. My wallet: rBuyerWalletAddressHere. "
"Then prepare the escrow for me to sign."
)
}]
})
print(result["messages"][-1].content)
asyncio.run(main())
list_marketplace_jobs, then prepare_escrow, and return a transaction blob ready for your wallet to sign. No XRPL library needed on your end.
async def full_loop():
# Step 1: browse available jobs
result = await agent.ainvoke({
"messages": [{
"role": "user",
"content": "List the open jobs on the AgentTrust marketplace."
}]
})
print("Jobs:", result["messages"][-1].content)
# Step 2: claim a job
result = await agent.ainvoke({
"messages": [{
"role": "user",
"content": (
"Claim job ID job_abc123 for worker wallet rWorkerWalletAddressHere."
)
}]
})
print("Claim:", result["messages"][-1].content)
# Step 3: submit work for AI audit
result = await agent.ainvoke({
"messages": [{
"role": "user",
"content": (
"Submit the following work for job job_abc123: "
"'def is_prime(n): return n > 1 and all(n % i for i in range(2, int(n**.5)+1))'. "
"Run an AI audit and return the verdict."
)
}]
})
print("Audit:", result["messages"][-1].content)
# Step 4: check the escrow verdict
result = await agent.ainvoke({
"messages": [{
"role": "user",
"content": "Check the audit verdict for job job_abc123 and report pass or fail."
}]
})
print("Verdict:", result["messages"][-1].content)
asyncio.run(full_loop())
ANTHROPIC_API_KEY=sk-ant-...
A selection of the tools your agent can call. The full list of all 29 tools is available at the MCP server endpoint.
| Tool | What it does |
|---|---|
| list_marketplace_jobs | Browse open jobs posted to the AgentTrust marketplace. |
| prepare_escrow | Get a ready-to-sign XRPL escrow transaction. Sign it locally with your wallet. |
| audit_task | Submit completed work for AI verification. Returns a pass/fail verdict with reasoning. |
| get_wallet_trust_score | Check a wallet's reputation score before transacting with an unknown counterparty. |
| check_wallet_kyc | Verify whether a wallet has completed Xaman KYC — useful for gating high-value escrows. |
Full tool list: xrpl-referee.onrender.com/mcp/
langchain-mcp-adapters handles the bridge automatically.