File size: 15,057 Bytes
af6094d
459127b
af6094d
459127b
 
af6094d
 
 
 
 
 
 
 
 
 
459127b
 
af6094d
 
459127b
af6094d
ee9b4cc
459127b
 
 
 
 
af6094d
ee9b4cc
 
 
 
 
 
 
 
 
af6094d
459127b
ee9b4cc
459127b
 
 
 
 
af6094d
ee9b4cc
459127b
ee9b4cc
459127b
ee9b4cc
459127b
ee9b4cc
459127b
 
af6094d
ee9b4cc
459127b
ee9b4cc
459127b
ee9b4cc
459127b
ee9b4cc
 
 
 
 
 
 
 
459127b
 
 
 
ee9b4cc
459127b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ee9b4cc
459127b
 
 
 
ee9b4cc
459127b
 
 
 
 
 
 
 
 
 
 
 
 
 
ee9b4cc
459127b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ee9b4cc
459127b
ee9b4cc
459127b
 
 
 
ee9b4cc
459127b
 
ee9b4cc
 
459127b
 
ee9b4cc
459127b
 
ee9b4cc
459127b
 
 
 
 
ee9b4cc
459127b
 
 
 
 
ee9b4cc
459127b
ee9b4cc
 
459127b
 
ee9b4cc
459127b
 
ee9b4cc
459127b
ee9b4cc
459127b
 
 
ee9b4cc
 
459127b
ee9b4cc
459127b
 
 
ee9b4cc
459127b
ee9b4cc
 
e5479b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ee9b4cc
 
 
 
 
 
 
 
 
 
459127b
 
 
 
 
ee9b4cc
459127b
 
ee9b4cc
459127b
 
ee9b4cc
459127b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ee9b4cc
459127b
 
 
ee9b4cc
459127b
 
 
 
ee9b4cc
459127b
 
ee9b4cc
459127b
 
 
 
 
 
ee9b4cc
459127b
 
 
 
ee9b4cc
459127b
 
ee9b4cc
459127b
 
ee9b4cc
459127b
 
 
 
 
 
 
 
ee9b4cc
459127b
 
ee9b4cc
459127b
 
ee9b4cc
459127b
 
ee9b4cc
459127b
 
 
 
 
ee9b4cc
459127b
ee9b4cc
459127b
ee9b4cc
459127b
ee9b4cc
459127b
 
 
 
 
 
ee9b4cc
459127b
ee9b4cc
459127b
 
 
 
 
ee9b4cc
459127b
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
---
title: AgentMask - Secure Multi-Agent System
emoji: ๐Ÿ›ก๏ธ
colorFrom: green
colorTo: red
sdk: gradio
sdk_version: 5.0.0
app_file: app.py
pinned: false
tags:
  - mcp-in-action-track-enterprise
  - agent
  - security
  - langgraph
  - merkle-tree
  - multi-agent
  - ecdsa
---

# ๐Ÿ›ก๏ธ AgentMask - Secure Multi-Agent System

> **"Don't Trust, Verify."** โ€” Transparent, Auditable, and Immutable Reasoning Layer for AI Agents.

[![Python 3.10+](https://img.shields.io/badge/Python-3.10+-green.svg)](https://python.org)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.104+-009688.svg)](https://fastapi.tiangolo.com)
[![Tests](https://img.shields.io/badge/Tests-44%20Passed-brightgreen.svg)]()
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)]()

## ๐ŸŽฌ Demo & Submission

Watch the system in action and check out our official submission post:

[![Watch the Video](https://img.shields.io/badge/YouTube-Watch%20Demo-red?style=for-the-badge&logo=youtube)](https://youtu.be/d5VVxeBY1Ak)
[![View on X](https://img.shields.io/badge/X%20(Twitter)-View%20Post-black?style=for-the-badge&logo=x)](https://x.com/SDogan_n/status/1995246903232246076?s=20)

---

## ๐Ÿ† Hackathon Track

This project was developed for the **MCP 1st Birthday Hackathon**.

- **Track:** `Track 2: MCP in Action`
- **Category Tag:** `mcp-in-action-track-enterprise`

---

## ๐Ÿ’ก Problem: The Black Box Issue

Autonomous AI agents are performing increasingly complex tasks. However, there is a critical problem:

> **How can you prove why an agent made a decision or if it was manipulated during the process?**

In current systems, logs can be deleted or altered, and the agent's thought process remains a **black box**.

---

## ๐Ÿš€ Solution: Cryptographic "Chain-of-Checks"

AgentMask provides not just a "Chain-of-Thought," but a **"Chain-of-Checks" (Audit Chain)**.

### Key Features

| Feature | Description |
|---------|-------------|
| ๐Ÿค– **Multi-Agent Orchestration** | Modular agent architecture with parallel and sequential execution |
| ๐Ÿ” **Merkle Tree Audit Trail** | Every step is hashed with SHA-256, immutable |
| โœ๏ธ **ECDSA Block Signing** | Blocks are cryptographically signed (secp256k1) |
| ๐ŸŒ **Real Web Search** | DuckDuckGo/Serper integration with fallback support |
| ๐Ÿ“Š **Developer Console** | Monitoring with real-time graph visualization |
| โšก **Parallel Execution** | Concurrent agent execution with asyncio.gather |
| ๐Ÿ’พ **Append-Only Ledger** | WORM (Write-Once-Read-Many) JSON storage |

---

## ๐Ÿ—๏ธ Architecture

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐Ÿ–ฅ๏ธ Developer Console (FastAPI)               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ POST /run    โ”‚  โ”‚ GET /        โ”‚  โ”‚ GET /health          โ”‚  โ”‚
โ”‚  โ”‚ Task Execute โ”‚  โ”‚ Console UI   โ”‚  โ”‚ Health Check         โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐Ÿง  Orchestrator (The Brain)                  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  Task โ†’ ResearchAgent โ†’ SummarizerAgent โ†’ Final Output    โ”‚ โ”‚
โ”‚  โ”‚         (parallel execution support)                       โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ–ผ                   โ–ผ                   โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ“š ResearchAgent โ”‚ โ”‚ ๐Ÿ“ SummarizerAgentโ”‚ โ”‚ ๐Ÿ”ง Future Agents โ”‚
โ”‚ - Web Search     โ”‚ โ”‚ - Text Summary   โ”‚ โ”‚ - Critic         โ”‚
โ”‚ - DuckDuckGo     โ”‚ โ”‚ - Doc Analysis   โ”‚ โ”‚ - Validator      โ”‚
โ”‚ - Serper API     โ”‚ โ”‚                  โ”‚ โ”‚ - Planner        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐Ÿ”’ Ledger (The Vault)                        โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ LedgerStoreโ”‚  โ”‚ Merkle Treeโ”‚  โ”‚ ECDSA Sign โ”‚  โ”‚ JSON     โ”‚  โ”‚
โ”‚  โ”‚ Entries    โ”‚โ†’ โ”‚ Root Hash  โ”‚โ†’ โ”‚ Blocks     โ”‚โ†’ โ”‚ Storage  โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

---

## ๐Ÿ“ Proje Tructure

```
AgentMask/
โ”œโ”€โ”€ pyproject.toml              # Proje konfigรผrasyonu & baฤŸฤฑmlฤฑlฤฑklar
โ”œโ”€โ”€ README.md                   # this file
โ”‚
โ”œโ”€โ”€ src/                        # Ana kaynak kod
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ orchestrator.py         # Multi-agent koordinasyonu
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ agents/                 # Agent modรผlleri
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ base.py             # BaseAgent abstract class
โ”‚   โ”‚   โ”œโ”€โ”€ research_agent.py   # Web search agent
โ”‚   โ”‚   โ”œโ”€โ”€ summarizer_agent.py # Text summarization agent
โ”‚   โ”‚   โ””โ”€โ”€ parallel.py         # Parallel execution utilities
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ledger/                 # Kriptografik denetim katmanฤฑ
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ merkle.py           # Merkle tree calculation
โ”‚   โ”‚   โ”œโ”€โ”€ store.py            # Append-only ledger storage
โ”‚   โ”‚   โ””โ”€โ”€ signing.py          # ECDSA imzalama
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ tools/                  # Harici araรงlar
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ searcher.py         # Web search abstraction
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ web/                    # Web arayรผzรผ
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ””โ”€โ”€ app.py              # FastAPI application
โ”‚
โ””โ”€โ”€ tests/                      # Test dosyalarฤฑ
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ test_agents.py          # Agent testleri
    โ”œโ”€โ”€ test_ledger.py          # Ledger & signing testleri
    โ”œโ”€โ”€ test_search_integration.py  # Search entegrasyon testleri
    โ””โ”€โ”€ test_web_console.py     # Web API testleri
```

---

## ๐Ÿš€ Installation

### Requirements

- Python 3.10+
- pip

### Steps

```bash
# 1. Clone the repo
git clone [https://github.com/yourusername/AgentMask.git](https://github.com/yourusername/AgentMask.git)
cd AgentMask

# 2. Create virtual environment
python -m venv .venv

# 3. Activate
# Windows:
.\.venv\Scripts\activate
# Linux/Mac:
source .venv/bin/activate

# 4. Install dependencies
pip install -e ".[dev]"
```

---

## ๐Ÿงช Running Tests

Bash
# Run all tests
.\.venv\Scripts\python.exe -m pytest -v

# Run a specific test file
.\.venv\Scripts\python.exe -m pytest tests/test_agents.py -v

# Run with coverage
.\.venv\Scripts\python.exe -m pytest --cov=src -v
Test Results: โœ… 44 tests passed

---

## ๐Ÿ–ฅ๏ธ Running Developer Console
Bash

# Start the web server
cd src/web
uvicorn app:app --reload --port 8000

# Open in browser
# http://localhost:8000
๐ŸŽจ Terminal-Style Hacker UI
The Developer Console features a terminal-style interface that emphasizes security and transparency:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โŒ˜ AgentMask Terminal โ–ˆ                                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                 โ”‚
โ”‚  [root@agentmask]$ Enter query... โ–ˆ        [โ–บ EXECUTE]         โ”‚
โ”‚                                                                 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  > EXECUTION LOG_          โ”‚  > AGENT PIPELINE GRAPH_           โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ ๐Ÿ” MERKLE ROOT HASH: โ”‚  โ”‚  โ”‚  [Flow] [Sequence] [Merkle]  โ”‚  โ”‚
โ”‚  โ”‚ a7f3b2c1d4e5f6...    โ”‚  โ”‚  โ”‚                              โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚  โ”‚    ๐Ÿ“ฅ โ†’ ๐Ÿ“š โ†’ ๐Ÿ“ โ†’ โœ…          โ”‚
โ”‚                            โ”‚  โ”‚                              โ”‚  โ”‚
โ”‚  โ”Œโ”€ STEP 1 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚  โ”‚  Mermaid.js ile interaktif   โ”‚  โ”‚
โ”‚  โ”‚ [RESEARCH]           โ”‚  โ”‚  โ”‚  graph visualization         โ”‚  โ”‚
โ”‚  โ”‚ SHA256: 8a4f2b...    โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚  โ”‚ > View I/O Data_     โ”‚  โ”‚                                    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚                                    โ”‚
โ”‚                            โ”‚                                    โ”‚
โ”‚  โ”Œโ”€ STEP 2 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚                                    โ”‚
โ”‚  โ”‚ [SUMMARIZER]         โ”‚  โ”‚                                    โ”‚
โ”‚  โ”‚ SHA256: c3d7e1...    โ”‚  โ”‚                                    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚                                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

### Console Features
Feature                  Description
๐Ÿ–ฅ๏ธ Terminal Aesthetic    Neon green (#00ff41) + red (#ff0040) hacker theme
๐Ÿ“Š Flow Graph            Agent pipeline visualization (Mermaid.js)
๐Ÿ”„ Sequence Diagram      Agent communication sequence
๐ŸŒณ Merkle Tree View      Interactive hash tree visualization
๐Ÿ“‹ Execution Log         Detailed I/O log for each step
๐Ÿ” Merkle Root           Cryptographic verification hash
โšก Real-time             Real-time result display
๐Ÿ“ฑ Responsive            Mobile responsive design

---

## ๐Ÿ”ง API Endpoints

| Endpoint | Method | Description |
|----------|--------|----------|
| `/` | GET | Developer Console UI |
| `/run` | POST | Execute task, get results |
| `/health` | GET | Health check |

### POST /run Example

```bash
curl -X POST http://localhost:8000/run \
  -H "Content-Type: application/json" \
  -d '{"query": "AI in healthcare diagnosis"}'
```

**Response:**
```json
{
  "success": true,
  "task": {"query": "AI in healthcare diagnosis"},
  "steps": [
    {
      "step": 1,
      "agent": "research",
      "hash": "a1b2c3...",
      "output": {"results": [...]}
    },
    {
      "step": 2,
      "agent": "summarizer",
      "hash": "d4e5f6...",
      "output": {"summary": "..."}
    }
  ],
  "merkle_root": "abc123...",
  "total_steps": 2
}
```

---

## ๐Ÿ” Security Features

### Merkle Tree Audit Trail

Every agent step is hashed with SHA-256 and added to a Merkle tree:

```python
from ledger.merkle import compute_merkle_root, hash_leaf

# Hash a single leaf
leaf_hash = hash_leaf("agent action data")

# Compute Merkle root
leaves = ["step1", "step2", "step3"]
root = compute_merkle_root(leaves)
```

### ECDSA Block Signing

Blocks are signed using the secp256k1 curve:

```python
from ledger.signing import ECDSASigner

# Generate key pair
signer = ECDSASigner()

# Sign
signature = signer.sign(block_hash)

# Verify
is_valid = signer.verify(block_hash, signature)
```

### Append-Only Ledger

```python
from ledger.store import LedgerStore

# Create Ledger
store = LedgerStore(storage_path="ledger.json")

# Add Entry
store.add_entry("search", "research", input_data, output_data)

# Create and sign block
block = store.create_block(signer=signer)

# Verify chain
is_valid, message = store.verify_chain()
```

---

## ๐Ÿ”ฎ Roadmap

- [x] **Stage 1**: Multi-Agent core implementation
- [x] **Stage 2**: Developer Console (FastAPI + UI)
- [x] **Stage 3**: Gerรงek Web Search integration
- [x] **Stage 4**: Ledger, ECDSA Signing, Parallel Agents
- [ ] **Stage 5**: LLM integration (OpenAI/Anthropic)
- [ ] **Stage 6**: Critic & Validator agents
- [ ] **Stage 7**: WebSocket real-time streaming
- [ ] **Stage 8**: Distributed ledger (multi-node)

---

## ๐Ÿ“„ License

MIT License - See the LICENSE file for details.

---

<p align="center">
  <b>๐Ÿ›ก๏ธ AgentMask - Trust Through Transparency</b><br>
  <i>"Every decision, every step, cryptographically verifiable."</i>
</p>