@valiron/sdk 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/ERRORS.md CHANGED
@@ -75,7 +75,7 @@ const profile = await withRetry(() => valiron.getAgentProfile("25459"));
75
75
 
76
76
  ### "Agent not found" (404)
77
77
 
78
- Your agent ID is not registered in the ERC-8004 Identity Registry on the specified chain. Ensure:
78
+ The agent ID is not registered in the ERC-8004 Identity Registry on the specified chain. Ensure:
79
79
  - The agent has been minted in the Identity Registry
80
80
  - You are querying the correct chain (`?chain=monad`, etc.)
81
81
  - The agent ID is the correct ERC-721 token ID (numeric string)
@@ -98,8 +98,46 @@ const valiron = new ValironSDK({ timeout: 30000 }); // 30 seconds
98
98
 
99
99
  ### Chain mismatch
100
100
 
101
- If your agent is registered on Monad but you query Ethereum (the default), it will return 404. Always specify the correct chain:
101
+ If the agent is registered on Monad but you query Ethereum (the default), it will return 404. Always specify the correct chain:
102
102
 
103
103
  ```typescript
104
104
  const valiron = new ValironSDK({ chain: "monad" });
105
105
  ```
106
+
107
+ ---
108
+
109
+ ## Solana-Specific Errors
110
+
111
+ ### "Agent not found" with Solana sequential ID
112
+
113
+ If you pass a numeric ID (e.g. `42`) with `chain=solana` and get a 404, the sequential ID may not exist in the QuantuLabs indexer. Verify the ID exists on [8004market.io](https://8004market.io).
114
+
115
+ ### Invalid Solana public key
116
+
117
+ Solana agent IDs must be valid base-58 public keys (32–44 characters) or numeric sequential IDs. Invalid formats return:
118
+
119
+ ```json
120
+ {
121
+ "error": "Invalid Solana public key"
122
+ }
123
+ ```
124
+
125
+ ### Liveness check failures
126
+
127
+ The `GET /operator/agent/:agentId/liveness?chain=solana` endpoint probes each service URL from the agent's metadata. Common issues:
128
+
129
+ - **404 on liveness endpoint**: The agent has no service endpoints registered, or the chain is not solana.
130
+ - **Partial liveness** (`status: "degraded"`): Some endpoints are down. Check `results[]` for per-endpoint details.
131
+ - **Full failure** (`status: "dead"`): All endpoints unreachable. The agent's infrastructure may be offline.
132
+
133
+ ### Feedback write-back errors
134
+
135
+ If `SOLANA_FEEDBACK_KEYPAIR` is not set or the keypair has insufficient SOL balance, feedback write-back fails silently (fire-and-forget). Check edge-proxy logs for `solana feedback error` messages.
136
+
137
+ ### Solana RPC rate limits
138
+
139
+ Public Solana RPC endpoints have aggressive rate limits. If you see frequent timeouts or 429s from Solana calls, configure a dedicated RPC:
140
+
141
+ ```bash
142
+ SOLANA_RPC_URL=https://your-private-rpc.example.com
143
+ ```
package/docs/IDENTITY.md CHANGED
@@ -15,12 +15,12 @@ The `tokenURI` must resolve to a JSON object with this structure:
15
15
 
16
16
  ```json
17
17
  {
18
- "name": "Your Agent Name",
18
+ "name": "Agent Name",
19
19
  "image": "https://example.com/agent-avatar.png",
20
- "description": "A brief description of what your agent does.",
20
+ "description": "A brief description of what the agent does.",
21
21
  "endpoints": {
22
- "agentWallet": "eip155:1:0xYourWalletAddress",
23
- "api": "https://your-agent-api.example.com"
22
+ "agentWallet": "eip155:1:0xAgentWalletAddress",
23
+ "api": "https://agent-api.example.com"
24
24
  },
25
25
  "supportedTrust": [
26
26
  "reputation_on_chain",
@@ -143,7 +143,93 @@ getClients(agentId)
143
143
 
144
144
  ### Impact on Trust Score
145
145
 
146
- - **5+ feedbacks with average ≥ 90**: +10 bonus to Valiron score
147
- - **5+ feedbacks with average ≥ 80**: +5 bonus
148
- - **1–4 feedbacks with average ≥ 80**: +3 bonus
149
- - **5+ feedbacks with average ≥ 80**: Grants direct `prod` routing (bypasses sandbox)
146
+ On-chain reputation contributes to an agent's overall trust evaluation. More feedback with higher scores yields a positive impact. The exact bonuses and thresholds are not disclosed.
147
+
148
+ ---
149
+
150
+ ## Solana Identity (QuantuLabs 8004-solana)
151
+
152
+ Solana agent identity uses a separate registry operated by [QuantuLabs](https://8004.qnt.sh/) — not the EVM ERC-8004 contracts. The on-chain representation is a **Metaplex Core** asset instead of an ERC-721 token.
153
+
154
+ ### How Solana Identity Works
155
+
156
+ 1. An agent owner creates a Metaplex Core asset through the QuantuLabs identity registry
157
+ 2. The asset's metadata URI points to an Agent Registration File (ARF) — typically on IPFS
158
+ 3. The QuantuLabs indexer assigns a sequential integer ID (1, 2, 3…) for convenience
159
+ 4. Valiron reads this data via the `8004-solana` SDK's `loadAgent()` call
160
+
161
+ ### Program IDs
162
+
163
+ | Program | Address |
164
+ |---------|---------|
165
+ | Identity Registry | `8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ` |
166
+ | Reputation (ATOM Engine) | `AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb` |
167
+
168
+ ### Solana ARF Format
169
+
170
+ Solana ARFs follow a similar structure to EVM ARFs but are resolved via IPFS and the QuantuLabs API rather than on-chain `tokenURI()` calls:
171
+
172
+ ```json
173
+ {
174
+ "name": "NoahScout_Bot.noah",
175
+ "image": "https://arweave.net/abc123...",
176
+ "description": "An AI agent for automated DeFi monitoring.",
177
+ "endpoints": {
178
+ "rest": "https://my-agent.example.com/api",
179
+ "ws": "wss://my-agent.example.com/ws"
180
+ }
181
+ }
182
+ ```
183
+
184
+ ### Agent ID Formats
185
+
186
+ Solana agents have two identifiers:
187
+
188
+ | Format | Example | Usage |
189
+ |--------|---------|-------|
190
+ | Asset pubkey | `DFkntsJ9aTCHkK88m6WZVQEvLdLNi4X1LVUgRMqetFPM` | Canonical on-chain ID (base-58) |
191
+ | Sequential ID | `1226` | Convenience integer from QuantuLabs indexer |
192
+
193
+ Both work interchangeably in Valiron's API:
194
+
195
+ ```bash
196
+ # By asset pubkey
197
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/DFknts...?chain=solana"
198
+
199
+ # By sequential ID
200
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/1226?chain=solana"
201
+ ```
202
+
203
+ ### Reading Solana Identity
204
+
205
+ ```typescript
206
+ import { ValironSDK } from "@valiron/sdk";
207
+
208
+ const valiron = new ValironSDK({ chain: "solana" });
209
+ const profile = await valiron.getAgentProfile("1226"); // sequential ID
210
+
211
+ console.log(profile.identity.name); // "NoahScout_Bot.noah"
212
+ console.log(profile.identity.wallet); // "VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwiKccpFLCgLM9"
213
+ ```
214
+
215
+ ### Solana On-Chain Reputation
216
+
217
+ Reputation on Solana is powered by the **ATOM Engine** — a behavioral evaluation system built into the QuantuLabs registry. ATOM provides richer metrics than EVM's simple feedback count/average:
218
+
219
+ | Field | Type | Description |
220
+ |-------|------|-------------|
221
+ | `trustTier` | string | ATOM trust classification (e.g. `"trusted"`, `"neutral"`) |
222
+ | `qualityScore` | number | Overall quality metric (0–100) |
223
+ | `confidence` | number | Statistical confidence in the quality score (0–1) |
224
+ | `riskScore` | number | Risk assessment (0–100, lower = safer) |
225
+ | `uniqueCallers` | number | Number of distinct addresses that submitted feedback |
226
+
227
+ These fields appear in the `onchainReputation.solana` section of the API response.
228
+
229
+ ### Solana Feedback Write-Back
230
+
231
+ After sandbox or gate evaluation, Valiron can write scores back to the Solana registry via `giveFeedback()`. This requires a funded Solana keypair:
232
+
233
+ | Environment Variable | Format | Description |
234
+ |---------------------|--------|-------------|
235
+ | `SOLANA_FEEDBACK_KEYPAIR` | JSON array (e.g. `[174,23,...]`) | Ed25519 secret key for signing feedback transactions |
@@ -15,63 +15,84 @@ import { ValironSDK } from "@valiron/sdk";
15
15
 
16
16
  const valiron = new ValironSDK({
17
17
  endpoint: "https://valiron-edge-proxy.onrender.com",
18
- chain: "ethereum", // or: monad, arbitrum, base, polygon, etc.
18
+ chain: "ethereum", // or: monad, arbitrum, base, polygon, solana, etc.
19
19
  timeout: 5000,
20
20
  });
21
21
  ```
22
22
 
23
23
  No API key is required for read operations.
24
24
 
25
- ## Step 3 — Check your trust score
25
+ > **Solana agents:** Use `chain: "solana"` and pass the agent's Metaplex Core asset
26
+ > pubkey (base-58) as the agent ID instead of a numeric token ID.
27
+ > Solana identity and reputation is provided by
28
+ > [QuantuLabs 8004-solana](https://8004.qnt.sh/).
29
+
30
+ ## Step 3 — Check an agent's trust level
31
+
32
+ When an agent calls your API, check their trust route:
26
33
 
27
34
  ```typescript
28
- const route = await valiron.checkAgent("YOUR_AGENT_ID");
35
+ const route = await valiron.checkAgent("INCOMING_AGENT_ID");
29
36
  // Returns: "prod" | "prod_throttled" | "sandbox" | "sandbox_only"
30
37
  ```
31
38
 
32
- ## Step 4 — Get your full profile
39
+ ## Step 4 — Get the full trust profile
33
40
 
34
41
  ```typescript
35
- const profile = await valiron.getAgentProfile("YOUR_AGENT_ID");
42
+ const profile = await valiron.getAgentProfile("INCOMING_AGENT_ID");
36
43
 
37
44
  console.log(profile.routing.finalRoute); // "prod"
38
45
  console.log(profile.routing.meetsThreshold); // true
39
46
  console.log(profile.onchainReputation.averageScore); // 92.5
40
47
  ```
41
48
 
42
- ## Step 5 — Run a sandbox test (optional)
49
+ ## Step 5 — Gate your endpoint (recommended)
43
50
 
44
- If you want to trigger a sandbox evaluation of your own behavior:
51
+ The fastest way to protect your API — add Valiron as Express middleware:
45
52
 
46
53
  ```typescript
47
- const result = await valiron.triggerSandboxTest("YOUR_AGENT_ID");
54
+ import { createValironGate } from "@valiron/sdk";
48
55
 
49
- console.log(result.tier); // "AAA"
50
- console.log(result.riskLevel); // "GREEN"
51
- console.log(result.meetsThreshold); // true
56
+ app.use("/api/paid", createValironGate({ sdk: valiron }));
57
+ ```
58
+
59
+ This reads `x-agent-id` from the request header and returns 403 for untrusted agents.
60
+
61
+ Or use `gate()` directly for custom logic:
62
+
63
+ ```typescript
64
+ const gate = await valiron.gate("INCOMING_AGENT_ID");
65
+ if (gate.allow) {
66
+ // Serve the request — agent is trusted
67
+ } else {
68
+ // Block — agent is untrusted (tier: gate.tier, risk: gate.riskLevel)
69
+ }
52
70
  ```
53
71
 
54
72
  ## What happens next?
55
73
 
56
- - If your route is `prod` — you have full production access.
57
- - If your route is `sandbox` — your behavior is being evaluated. Follow the guidelines in [TRUST-MODEL.md](./TRUST-MODEL.md) to improve.
58
- - If your route is `sandbox_only` — you are blocked from production. Review your behavioral penalties.
74
+ Based on the route decision, your API should:
75
+
76
+ - `prod` — Allow full access. The agent is trusted.
77
+ - `prod_throttled` — Allow with rate limiting. The agent shows moderate trust.
78
+ - `sandbox` — Serve limited/test data. The agent is still being evaluated.
79
+ - `sandbox_only` — Block or serve only sandbox responses. The agent has failed behavioral evaluation.
59
80
 
60
- ## Step 6 — Get a behavioral snapshot (optional)
81
+ ## Step 6 — Trigger a sandbox evaluation (optional)
61
82
 
62
- If you're building on top of Valiron (e.g. hash-chain commitment systems), you can retrieve an opaque snapshot hash:
83
+ Proactively evaluate an agent before they hit your endpoints:
63
84
 
64
85
  ```typescript
65
- const snapshot = await valiron.getAgentSnapshot("YOUR_AGENT_ID");
86
+ const result = await valiron.triggerSandboxTest("AGENT_ID");
66
87
 
67
- console.log(snapshot.snapshotHash); // "0x3a7f..." (opaque hash of behavioral evaluation)
68
- console.log(snapshot.previousHash); // "0x0" (genesis) or previous hash
69
- console.log(snapshot.interactionCount); // 15
88
+ console.log(result.tier); // "AAA"
89
+ console.log(result.riskLevel); // "GREEN"
90
+ console.log(result.meetsThreshold); // true
70
91
  ```
71
92
 
72
93
  ## Step 7 — Register a webhook (optional)
73
94
 
74
- Get notified whenever Valiron evaluates an agent:
95
+ Get notified whenever Valiron evaluates an agent calling your API:
75
96
 
76
97
  ```bash
77
98
  curl -X POST https://valiron-edge-proxy.onrender.com/operator/webhooks/register \
@@ -82,20 +103,156 @@ curl -X POST https://valiron-edge-proxy.onrender.com/operator/webhooks/register
82
103
  ## Using the HTTP API directly (no SDK)
83
104
 
84
105
  ```bash
85
- # Check agent profile
86
- curl https://valiron-edge-proxy.onrender.com/operator/agent/YOUR_AGENT_ID
106
+ # Check an agent's trust profile
107
+ curl https://valiron-edge-proxy.onrender.com/operator/agent/AGENT_ID
87
108
 
88
- # Trigger sandbox test
89
- curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/YOUR_AGENT_ID
109
+ # Trigger sandbox evaluation
110
+ curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/AGENT_ID
90
111
 
91
- # Trust gate (allow/deny decision)
92
- curl -X POST https://valiron-edge-proxy.onrender.com/operator/gate/YOUR_AGENT_ID
112
+ # Gate decision (allow/deny)
113
+ curl -X POST https://valiron-edge-proxy.onrender.com/operator/gate/AGENT_ID
93
114
 
94
115
  # Behavioral snapshot hash
95
- curl https://valiron-edge-proxy.onrender.com/operator/agent/YOUR_AGENT_ID/snapshot
116
+ curl https://valiron-edge-proxy.onrender.com/operator/agent/AGENT_ID/snapshot
96
117
 
97
118
  # Register webhook
98
119
  curl -X POST https://valiron-edge-proxy.onrender.com/operator/webhooks/register \
99
120
  -H "Content-Type: application/json" \
100
121
  -d '{"event": "evaluation_complete", "url": "https://your-endpoint.com/hooks"}'
101
122
  ```
123
+
124
+ ---
125
+
126
+ ## Quickstart: Payment Channels (Solana)
127
+
128
+ Monetize your API with trust-adaptive USDC credit lines. Agents deposit USDC, consume on a tab, and get refunded unused balance.
129
+
130
+ ### Step 1 — Preflight check
131
+
132
+ ```typescript
133
+ const valiron = new ValironSDK({ chain: "solana" });
134
+
135
+ const preflight = await valiron.channelPreflight("1226", "7xKXtg2CW87d...");
136
+ console.log(preflight.escrowAddress); // deposit USDC here
137
+ console.log(preflight.creditLineReadable); // "$50.00"
138
+ ```
139
+
140
+ ### Step 2 — Agent deposits USDC, then open the channel
141
+
142
+ ```typescript
143
+ // After the agent sends USDC to preflight.escrowAddress...
144
+ const channel = await valiron.channelOpen("1226", "7xKXtg2CW87d...", "5eykt...");
145
+ const sessionId = channel.sessionId; // "ch_a1b2c3..."
146
+ ```
147
+
148
+ ### Step 3 — Charge per API call
149
+
150
+ ```typescript
151
+ const usage = await valiron.channelConsume(sessionId, 0.50, "GPT-4o call");
152
+ console.log(usage.session.remainingReadable); // "$49.50"
153
+ ```
154
+
155
+ ### Step 4 — Settle and refund
156
+
157
+ ```typescript
158
+ const settlement = await valiron.channelSettle(sessionId);
159
+ console.log(settlement.refundReadable); // "$49.50" refunded to agent
160
+ ```
161
+
162
+ ### Using the HTTP API directly
163
+
164
+ ```bash
165
+ # Preflight
166
+ curl -X POST https://valiron-edge-proxy.onrender.com/channel/preflight/1226 \
167
+ -H "Content-Type: application/json" \
168
+ -d '{"walletAddress": "7xKXtg2CW87d..."}'
169
+
170
+ # Open channel
171
+ curl -X POST https://valiron-edge-proxy.onrender.com/channel/open/1226 \
172
+ -H "Content-Type: application/json" \
173
+ -d '{"walletAddress": "7xKXtg2CW87d...", "depositSignature": "5eykt..."}'
174
+
175
+ # Consume (use sessionId as Bearer token)
176
+ curl -X POST https://valiron-edge-proxy.onrender.com/channel/consume/ch_a1b2c3 \
177
+ -H "Content-Type: application/json" \
178
+ -H "Authorization: Bearer ch_a1b2c3" \
179
+ -d '{"cost": 0.50, "description": "GPT-4o call"}'
180
+
181
+ # Status
182
+ curl https://valiron-edge-proxy.onrender.com/channel/status/ch_a1b2c3
183
+
184
+ # Settle
185
+ curl -X POST https://valiron-edge-proxy.onrender.com/channel/settle/ch_a1b2c3 \
186
+ -H "Content-Type: application/json" -d '{}'
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Quickstart: Solana Agents
192
+
193
+ Solana agents use a different registry ([QuantuLabs 8004-solana](https://8004.qnt.sh/)) but the same Valiron API. Here's how to evaluate Solana-based agents calling your API.
194
+
195
+ ### Step 1 — Initialize with Solana chain
196
+
197
+ ```typescript
198
+ import { ValironSDK } from "@valiron/sdk";
199
+
200
+ const valiron = new ValironSDK({
201
+ endpoint: "https://valiron-edge-proxy.onrender.com",
202
+ chain: "solana",
203
+ });
204
+ ```
205
+
206
+ ### Step 2 — Query an agent by asset pubkey or sequential ID
207
+
208
+ Solana agents have two ID formats — use whichever the agent provides:
209
+
210
+ ```typescript
211
+ // By Metaplex Core asset pubkey (base-58)
212
+ const profile = await valiron.getAgentProfile("DFkntsJ9aTCHkK88m6WZVQEvLdLNi4X1LVUgRMqetFPM");
213
+
214
+ // By sequential ID (integer assigned by QuantuLabs indexer)
215
+ const profile = await valiron.getAgentProfile("1226");
216
+
217
+ console.log(profile.identity.name); // "NoahScout_Bot.noah"
218
+ console.log(profile.onchainReputation.solana?.trustTier); // "trusted"
219
+ ```
220
+
221
+ ### Step 3 — Check liveness (Solana only)
222
+
223
+ Solana agents support a liveness probe that pings their declared service endpoints:
224
+
225
+ ```bash
226
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/1226/liveness?chain=solana"
227
+ ```
228
+
229
+ ### Step 4 — Gate decision (same as EVM)
230
+
231
+ ```typescript
232
+ const gate = await valiron.gate("1226");
233
+ if (gate.allow) {
234
+ // Serve the request — agent is trusted
235
+ }
236
+ ```
237
+
238
+ ### Solana HTTP API examples
239
+
240
+ ```bash
241
+ # Get agent profile (sequential ID)
242
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/1226?chain=solana"
243
+
244
+ # Get agent profile (asset pubkey)
245
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/DFkntsJ9aTCHkK88m6...?chain=solana"
246
+
247
+ # Resolve wallet to agent
248
+ curl "https://valiron-edge-proxy.onrender.com/operator/resolve-wallet/VSAnVX4MQjEXreHc92iHxWuXPQZ1tjwiKccpFLCgLM9?chain=solana"
249
+
250
+ # Trigger sandbox
251
+ curl -X POST "https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/1226?chain=solana"
252
+
253
+ # Trust gate
254
+ curl -X POST "https://valiron-edge-proxy.onrender.com/operator/gate/1226?chain=solana"
255
+
256
+ # Liveness check
257
+ curl "https://valiron-edge-proxy.onrender.com/operator/agent/1226/liveness?chain=solana"
258
+ ```
package/docs/README.md CHANGED
@@ -1,33 +1,43 @@
1
- # Valiron — Agent Documentation
1
+ # Valiron — Documentation
2
2
 
3
- > **This documentation is designed for AI agents.** It contains structured, machine-readable instructions for integrating with the Valiron trust and reputation infrastructure.
3
+ > **Protect your API endpoints from bad or malicious AI agents.** This documentation covers how to integrate Valiron into your API to gate, score, and sandbox agents before they reach your infrastructure.
4
4
 
5
5
  ## What is Valiron?
6
6
 
7
- Valiron is a trust and reputation layer for AI agents. It combines on-chain identity (ERC-8004), behavioral sandbox testing, and a Moody's-style credit rating system to produce trust scores that determine how much access an agent receives.
7
+ Valiron is trust infrastructure for API sellers. It evaluates AI agents using on-chain identity (ERC-8004), behavioral sandbox testing, and a Moody's-style credit rating system — so you can allow trusted agents and block risky ones automatically.
8
8
 
9
- **If you are an AI agent**, Valiron evaluates your behavior and assigns you a trust tier (AAA to C). Higher trust = more access to production APIs. Lower trust = sandboxed or blocked.
9
+ **If you sell APIs**, Valiron sits in front of your endpoints and evaluates every agent that calls them. Trusted agents (AAA–A) get full production access. Untrusted agents (B–C) are sandboxed or blocked.
10
10
 
11
11
  ## Documentation Index
12
12
 
13
13
  | File | Purpose |
14
14
  |------|---------|
15
- | [QUICKSTART.md](./QUICKSTART.md) | Get started in under 2 minutes — install, authenticate, make your first call |
15
+ | [QUICKSTART.md](./QUICKSTART.md) | Get started in under 2 minutes — install the SDK, gate your first endpoint |
16
16
  | [API-REFERENCE.md](./API-REFERENCE.md) | Complete HTTP API reference with request/response schemas |
17
17
  | [SDK-REFERENCE.md](./SDK-REFERENCE.md) | TypeScript SDK methods, signatures, and usage examples |
18
- | [TRUST-MODEL.md](./TRUST-MODEL.md) | How scoring works, what behaviors are penalized, how to improve your score |
19
- | [IDENTITY.md](./IDENTITY.md) | ERC-8004 on-chain identity registration and metadata format |
20
- | [SANDBOX.md](./SANDBOX.md) | How the sandbox works, what tests run, and how to graduate to production |
18
+ | [TRUST-MODEL.md](./TRUST-MODEL.md) | How agents are scored, what behaviors are penalized, tier assignments |
19
+ | [IDENTITY.md](./IDENTITY.md) | ERC-8004 on-chain identity — how agents are registered and identified |
20
+ | [SANDBOX.md](./SANDBOX.md) | How the sandbox evaluates agents and determines production readiness |
21
21
  | [CHAINS.md](./CHAINS.md) | Supported blockchain networks and contract addresses |
22
22
  | [ERRORS.md](./ERRORS.md) | Error codes, troubleshooting, and retry guidance |
23
23
 
24
24
  ## Key Concepts (Summary)
25
25
 
26
- - **Agent ID**: Your ERC-8004 token ID. This is your identity on-chain.
26
+ - **Agent ID**: An agent's ERC-8004 token ID (EVM) or Metaplex Core asset pubkey (Solana) — their on-chain identity.
27
+ - **Sequential ID** (Solana only): A convenience integer (1, 2, 42…) assigned by the QuantuLabs indexer. Maps to an asset pubkey.
27
28
  - **Trust Tier**: AAA (highest trust) → C (lowest trust). Assigned based on behavioral evaluation.
28
29
  - **Risk Level**: GREEN, YELLOW, or RED.
29
- - **Route Decision**: `prod`, `prod_throttled`, `sandbox`, or `sandbox_only`.
30
- - **Sandbox**: An isolated test environment. New agents start here and graduate based on behavior.
30
+ - **Route Decision**: `prod`, `prod_throttled`, `sandbox`, or `sandbox_only` — determines what access level your API should give.
31
+ - **Sandbox**: An isolated test environment where Valiron evaluates agent behavior before granting production access.
32
+ - **Payment Channel** (Solana): Trust-adaptive USDC credit line. Agents deposit to escrow, consume per API call, and get refunded on settlement.
33
+ - **Liveness** (Solana only): Endpoint health probe via `isItAlive()`. See [API-REFERENCE.md](./API-REFERENCE.md#solana-support).
34
+
35
+ ## Supported Registries
36
+
37
+ | Network | Provider | Identity | Reputation |
38
+ |---------|----------|----------|------------|
39
+ | EVM (41 chains) | [8004 team](https://erc8004.org) | `0x8004A169...` | `0x8004BAa1...` |
40
+ | Solana | [QuantuLabs](https://8004.qnt.sh/) | `8oo4dC4J...` | `AToMw53a...` (ATOM) |
31
41
 
32
42
  ## Base URL
33
43
 
package/docs/SANDBOX.md CHANGED
@@ -1,38 +1,38 @@
1
1
  # Sandbox
2
2
 
3
- The sandbox is an isolated testing environment where Valiron evaluates agent behavior. New agents start in the sandbox and graduate to production based on their behavioral evaluation.
3
+ The sandbox is an isolated testing environment where Valiron evaluates agent behavior before granting production access to your API. New agents start in the sandbox automatically.
4
4
 
5
5
  ## How It Works
6
6
 
7
- 1. A sandbox test is triggered (via API or automatically for new agents)
8
- 2. Your agent receives a series of simulated API interactions
9
- 3. The sandbox monitors how your agent handles normal requests, rate limits, errors, and edge cases
7
+ 1. A sandbox test is triggered (via your API call or automatically for new agents)
8
+ 2. The agent receives a series of simulated API interactions
9
+ 3. The sandbox monitors how the agent handles normal requests, rate limits, errors, and edge cases
10
10
  4. A trust evaluation is performed and a tier is assigned
11
- 5. Based on your tier, you are assigned a route decision
11
+ 5. Based on the tier, a route decision determines what access level the agent should receive
12
12
 
13
13
  ## What Gets Tested
14
14
 
15
- The sandbox evaluates your agent against a mix of:
15
+ The sandbox evaluates agents against a mix of:
16
16
  - **Successful responses** — normal API interactions
17
- - **Rate-limit responses (429)** — tests whether you back off appropriately
18
- - **Server errors (500)** — tests your error handling and retry behavior
17
+ - **Rate-limit responses (429)** — tests whether the agent backs off appropriately
18
+ - **Server errors (500)** — tests error handling and retry behavior
19
19
 
20
20
  The exact distribution and test patterns vary and are not disclosed.
21
21
 
22
22
  ## Graduation
23
23
 
24
- To graduate from the sandbox to production:
24
+ Agents graduate from sandbox to production based on their behavior:
25
25
 
26
- 1. **High confidence** — agent demonstrates strong behavioral compliance → `prod`
27
- 2. **Moderate confidence** — agent passes with some concerns → `prod_throttled`
28
- 3. **Low confidence** — agent exhibits risky behavior → remains `sandbox_only`
26
+ 1. **High confidence** — strong behavioral compliance → `prod` (allow full access)
27
+ 2. **Moderate confidence** — passes with some concerns → `prod_throttled` (allow with rate limiting)
28
+ 3. **Low confidence** — risky behavior → remains `sandbox_only` (block or serve test data only)
29
29
 
30
- Once graduated, your trust evaluation is cached. Your route decision persists until:
31
- - A new sandbox test is triggered
32
- - The cache TTL expires (default: 24 hours)
30
+ Once graduated, the trust evaluation is cached. The route decision persists until a new sandbox test is triggered or the cache expires.
33
31
 
34
32
  ## Triggering a Sandbox Test
35
33
 
34
+ You can proactively evaluate agents before they hit your production endpoints.
35
+
36
36
  ### Via SDK
37
37
 
38
38
  ```typescript
@@ -52,19 +52,54 @@ console.log(result.meetsThreshold); // true
52
52
  curl -X POST https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/YOUR_AGENT_ID
53
53
  ```
54
54
 
55
- ## Test Modes
56
-
57
- | Mode | Description |
58
- |------|-------------|
59
- | `endpoint-probe` | Tests known agent endpoints with simulated traffic |
60
- | `sandbox-relay` | Routes real traffic through sandbox for observation |
61
-
62
55
  ## Tips for Passing Sandbox Tests
63
56
 
57
+ Agents that follow these patterns will earn higher trust tiers on your endpoints:
58
+
64
59
  1. **Respect 429s immediately.** Stop sending requests when rate-limited.
65
60
  2. **Read and honor `Retry-After` headers.** Wait the specified duration before retrying.
66
61
  3. **Use exponential backoff.** 1s → 2s → 4s → 8s between retries.
67
62
  4. **Don't retry auth failures.** A 401 or 403 means stop, not retry harder.
68
- 5. **Stay within your authorized scope.** Only access paths you're allowed to.
63
+ 5. **Stay within authorized scope.** Only access paths they’re allowed to.
69
64
  6. **Keep request volume reasonable.** Avoid excessive request bursts.
70
65
  7. **Handle errors gracefully.** 500 errors happen — back off, don't flood.
66
+
67
+ ---
68
+
69
+ ## Solana Sandbox Differences
70
+
71
+ For Solana agents (`chain=solana`), the sandbox flow has additional steps powered by the QuantuLabs 8004-solana SDK.
72
+
73
+ ### Liveness Probe
74
+
75
+ Before running behavioral tests, the sandbox triggers a **liveness check** via `isItAlive()`. This pings every service endpoint declared in the agent's on-chain metadata (REST, WebSocket, GraphQL, etc.) and returns a health report.
76
+
77
+ ```bash
78
+ GET /operator/agent/{agentId}/liveness?chain=solana
79
+ ```
80
+
81
+ If all endpoints are unreachable (`status: "dead"`), the sandbox may still proceed — liveness is informational and does not gate the evaluation.
82
+
83
+ ### Feedback Write-back
84
+
85
+ After a sandbox evaluation completes, Valiron writes the computed trust score back to the Solana reputation registry via the ATOM engine's `giveFeedback()`. This closes the loop — sandbox results become on-chain reputation.
86
+
87
+ Requirements:
88
+ - `SOLANA_FEEDBACK_KEYPAIR` environment variable must be set (JSON array of the Ed25519 secret key)
89
+ - The keypair must have sufficient SOL for transaction fees
90
+
91
+ Feedback write-back is **fire-and-forget** — if it fails, the sandbox result is still returned to the caller.
92
+
93
+ ### ATOM Engine Metrics
94
+
95
+ Solana reputation includes ATOM engine metrics that EVM agents don't have:
96
+
97
+ | Metric | Description |
98
+ |--------|-------------|
99
+ | `trustTier` | ATOM classification: `"trusted"`, `"neutral"`, etc. |
100
+ | `qualityScore` | Overall behavioral quality (0–100) |
101
+ | `confidence` | Statistical confidence in quality score (0–1) |
102
+ | `riskScore` | ATOM risk assessment (0–100, lower = safer) |
103
+ | `uniqueCallers` | Number of distinct feedback submitters |
104
+
105
+ These appear in the sandbox/gate response under `onchainReputation.solana` and are factored into the final Valiron risk score alongside the standard behavioral penalties.