File size: 5,582 Bytes
cc26f5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# AgenThink Mesh β€” Protocol Specification
## NAN-RELAY/1.0 Β· NAN-HS/1.0 Β· Grounding Gate/1.0

**Status:** Draft v0.1  
**Authors:** AgenThink Engineering  
**Date:** March 2026

---

## 1. Overview

The **National Agentic Network (NAN) Protocol** defines how AI agents discover, authenticate, and communicate with each other via the AgenThink Mesh orchestration layer.

It answers three questions every multi-agent system must answer:

1. **Where is the right agent?** β†’ Universal Agent Directory (UAD)
2. **What does the next agent need to know?** β†’ State-Relay Protocol
3. **Is the agent's output trustworthy?** β†’ Grounding Gate

---

## 2. NAN Address Scheme

Every agent in the Mesh has a globally unique NAN address:

```
nan://<country>/<domain>/<name>/<version>

Examples:
  nan://kw/finance/etf-allocator/2.1
  nan://global/research/web-researcher/2.1
  nan://ae/legal/adgm-compliance/1.0
```

**Fields:**
- `country` β€” ISO 3166-1 alpha-2 country code, or `global`
- `domain` β€” functional category (`finance`, `legal`, `research`, `strategy`, `compliance`, `meta`)
- `name` β€” kebab-case agent identifier
- `version` β€” semantic version (major.minor)

---

## 3. State-Relay Protocol (NAN-RELAY/1.0)

### 3.1 State-Packet Structure

```json
{
  "packet_id":       "sp_8f3a92c1d",
  "mission_id":      "msn_001",
  "sequence":        2,
  "from_agent":      "nan://global/research/web-researcher/2.1",
  "to_agent":        "nan://kw/legal/contract-analyst/1.5",
  "context": {
    "Research Agent": {
      "output":    "...",
      "timestamp": "2026-03-01T09:14:22Z"
    },
    "_summary": "Rolling mission summary..."
  },
  "partial_output":  "Agent A output here",
  "confidence":      0.91,
  "grounding": {
    "result":            "passed",
    "sources_verified":  ["https://source1.com", "https://source2.com"],
    "confidence_delta":  0.02
  },
  "is_rerouted":     false,
  "expires_at":      "2026-03-01T09:19:22Z",
  "mesh_signature":  "NAN-SIG:sha256:7f2a...b4c9",
  "issued_by":       "nan://mesh/orchestrator/core/1.0"
}
```

### 3.2 Relay Flow

```
Agent A Output
      β”‚
      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Grounding Gate           β”‚  ← verifies claims via MCP web search
β”‚    (hallucination check)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚ PASS                  β”‚ FAIL β†’ Rerouter evaluates failover
      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    State-Packet Factory     β”‚  ← merges A's output into context
β”‚    create_packet(...)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚
      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Orchestrator Router      β”‚  ← selects next agent from pipeline
β”‚    relay_engine.relay(...)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚
      β–Ό
   Agent B receives full State-Packet
   (no context loss, no re-onboarding)
```

---

## 4. Grounding Gate (Grounding-Gate/1.0)

### 4.1 Trigger Conditions

The Grounding Gate activates on every agent output that contains:
- Numerical claims (years, percentages, financial figures)
- Recency signals (`"current"`, `"latest"`, `"as of"`)
- Attribution phrases (`"according to"`, `"reported by"`)
- Legal/regulatory references

### 4.2 Verification Method

Claims are verified via **MCP web search** (2026 standard):

```python
# MCP tool call
{
  "type": "web_search_20260101",
  "name": "web_search"
}
```

### 4.3 Pass/Fail Thresholds

| Condition | Action |
|---|---|
| ≀ 2 claims fail verification | PASS |
| > 2 claims fail verification | FAIL β†’ trigger Rerouter |
| No verifiable claims found | AUTO-PASS |
| `require_grounding=False` | SKIP |

---

## 5. Dynamic Rerouting

### 5.1 Reroute Triggers

| Trigger | Severity | Action |
|---|---|---|
| Agent unreachable | HIGH | Immediate reroute |
| Grounding Gate FAIL | CRITICAL | Immediate reroute |
| Confidence < 0.70 | MEDIUM | Reroute if alternative available |
| Latency > 2Γ— SLA | LOW | Log warning, continue |

### 5.2 Agent Scoring (for reroute selection)

```
score = (trust_tier_weight Γ— 0.40) +
        (trust_score Γ— 0.30) +
        (domain_match Γ— 0.20) +
        (latency_score Γ— 0.10)
```

### 5.3 Trust Score Updates

After every mission step, the Rerouter adjusts the agent's trust score:
- `+0.02` on success
- `+0.01` bonus for meeting latency SLA
- `βˆ’0.05` on failure
- `βˆ’0.03` additional penalty for severe latency breach (> 2Γ— SLA)

---

## 6. Authentication (NAN-HS/1.0)

All agent-to-mesh communication uses:
- **mTLS** β€” mutual TLS with 15-minute rotating certificates
- **JWT** β€” signed with Ed25519, 15-minute expiry
- **Packet Signature** β€” SHA-256 HMAC on packet payload

Production environments additionally require:
- ADGM Digital Asset registry anchoring for T1_SOVEREIGN agents
- PDPL-compliant data residency enforcement for Kuwait jurisdiction

---

## 7. Compatibility

| Standard | Version | Notes |
|---|---|---|
| LangGraph | β‰₯ 0.2.0 | State machine orchestration |
| PydanticAI | β‰₯ 0.0.14 | Schema validation |
| MCP | β‰₯ 1.0.0 | Web search + tool calls |
| FastAPI | β‰₯ 0.115.0 | Orchestrator API |
| Python | β‰₯ 3.11 | Type system requirements |

---

*AgenThink Β· Kuwait City Β· ADGM-Registered Β· MIT License*