Skip to content

Commit f3afcb4

Browse files
author
TrustIn Coder
committed
docs: add AI agent layer — self-registration, MCP tool def, Python example
1 parent 50b1aa3 commit f3afcb4

5 files changed

Lines changed: 132 additions & 5 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ export default defineConfig({
1717
text: 'Getting Started',
1818
items: [
1919
{ text: 'Introduction', link: '/' },
20-
{ text: '🌐 Use TrustIn Explorer', link: '/guide/layer1-product' },
21-
{ text: '💻 Run Demo Locally', link: '/guide/layer2-demo' },
22-
{ text: '🛠 Build Your Own', link: '/guide/layer3-component' },
20+
{ text: '🌐 Layer 1: Use Explorer', link: '/guide/layer1-product' },
21+
{ text: '🤖 Layer 2: AI Agent API', link: '/guide/layer2-agent' },
22+
{ text: '💻 Layer 3: Local Demo', link: '/guide/layer3-demo' },
23+
{ text: '🛠 Layer 4: Build Your Own', link: '/guide/layer4-component' },
2324
],
2425
},
2526
{

docs/guide/layer2-agent.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# 🤖 AI Agent Access
2+
3+
Use TrustIn's transaction tracing API directly from your AI agent — no account or manual API key setup required.
4+
5+
## How It Works
6+
7+
1. **Register** — call `POST /api/v1/agent/register` with no credentials
8+
2. **Receive** — get an API key instantly
9+
3. **Query** — use the key to call `graph_explore` and trace any address
10+
11+
Your agent key is active immediately with a **200 requests/day** quota.
12+
13+
## Register Your Agent
14+
15+
```bash
16+
curl -X POST https://api.trustin.info/api/v1/agent/register \
17+
-H "Content-Type: application/json" \
18+
-d '{ "name": "my-aml-agent" }'
19+
```
20+
21+
Response:
22+
23+
```json
24+
{
25+
"code": 200,
26+
"data": {
27+
"agent_id": "...",
28+
"api_key": "your-api-key-here",
29+
"name": "my-aml-agent",
30+
"daily_quota": 200,
31+
"note": "Save this api_key — it will not be shown again"
32+
}
33+
}
34+
```
35+
36+
> **Important**: Save the `api_key` — it won't be shown again.
37+
38+
## Trace a Transaction
39+
40+
```bash
41+
curl -X POST https://api.trustin.info/api/v1/graph_explore \
42+
-H "Content-Type: application/json" \
43+
-H "X-Api-Key: your-api-key-here" \
44+
-d '{
45+
"address": "0xYourAddress",
46+
"chain": "Ethereum",
47+
"direction": "out",
48+
"max_depth": 3
49+
}'
50+
```
51+
52+
## MCP Tool Definition
53+
54+
For Claude, GPT, or any MCP-compatible agent:
55+
56+
```json
57+
{
58+
"name": "trace_transactions",
59+
"description": "Trace blockchain transaction flows from an address. Returns connected addresses with amounts, timestamps, and risk levels.",
60+
"inputSchema": {
61+
"type": "object",
62+
"properties": {
63+
"address": {
64+
"type": "string",
65+
"description": "Blockchain address to trace"
66+
},
67+
"chain": {
68+
"type": "string",
69+
"enum": ["Ethereum", "Tron"]
70+
},
71+
"direction": {
72+
"type": "string",
73+
"enum": ["in", "out", "all"],
74+
"default": "out"
75+
},
76+
"max_depth": {
77+
"type": "integer",
78+
"default": 3,
79+
"maximum": 5
80+
},
81+
"from_date": {
82+
"type": "string",
83+
"format": "date"
84+
},
85+
"to_date": {
86+
"type": "string",
87+
"format": "date"
88+
}
89+
},
90+
"required": ["address", "chain"]
91+
}
92+
}
93+
```
94+
95+
## Python Example
96+
97+
```python
98+
import requests
99+
100+
# Register once, store the key
101+
def register_agent(name="my-agent"):
102+
res = requests.post(
103+
"https://api.trustin.info/api/v1/agent/register",
104+
json={"name": name}
105+
)
106+
return res.json()["data"]["api_key"]
107+
108+
# Trace transactions
109+
def trace(api_key, address, chain="Ethereum"):
110+
res = requests.post(
111+
"https://api.trustin.info/api/v1/graph_explore",
112+
headers={"X-Api-Key": api_key},
113+
json={"address": address, "chain": chain, "direction": "out", "max_depth": 3}
114+
)
115+
return res.json()["data"]
116+
117+
# Usage
118+
api_key = register_agent("my-aml-agent")
119+
graph = trace(api_key, "0xYourAddress")
120+
print(f"Found {graph['stats']['total_nodes']} nodes")
121+
```
File renamed without changes.
File renamed without changes.

docs/index.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,19 @@ features:
1818
details: Instantly trace transactions at v2.trustin.info — no setup required. Full-featured AML investigation tool.
1919
link: /guide/layer1-product
2020
linkText: Open Explorer
21+
- icon: 🤖
22+
title: AI Agent API
23+
details: Self-register your AI agent in one request and start tracing addresses immediately. No account needed — 200 requests/day free quota. MCP-compatible.
24+
link: /guide/layer2-agent
25+
linkText: Agent Setup
2126
- icon: 💻
2227
title: Run Demo Locally
2328
details: Clone the example project and connect to TrustIn API with your API key. Full control over data and UI.
24-
link: /guide/layer2-demo
29+
link: /guide/layer3-demo
2530
linkText: Setup Guide
2631
- icon: 🛠
2732
title: Build Your Own
2833
details: Install @trustin/txgraph and integrate the graph components into your own app with your own data source.
29-
link: /guide/layer3-component
34+
link: /guide/layer4-component
3035
linkText: Component Docs
3136
---

0 commit comments

Comments
 (0)