agentflow-dashboard 0.1.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/README.md +366 -0
- package/bin/dashboard.js +12 -0
- package/dist/index.cjs +597 -0
- package/dist/index.js +560 -0
- package/dist/public/dashboard.js +342 -0
- package/dist/public/index.html +274 -0
- package/package.json +51 -0
- package/public/dashboard.js +342 -0
- package/public/index.html +274 -0
package/README.md
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
# AgentFlow Dashboard
|
|
2
|
+
|
|
3
|
+
Real-time monitoring dashboard for AgentFlow - Visualize agent execution graphs and performance metrics in a beautiful web interface.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Real-time Monitoring** - Live updates via WebSocket connections
|
|
8
|
+
- **Agent Performance Metrics** - Success rates, execution times, and activity tracking
|
|
9
|
+
- **Execution Graph Visualization** - Interactive display of agent execution flows
|
|
10
|
+
- **Multi-Agent System Overview** - Monitor entire agent ecosystems at once
|
|
11
|
+
- **Responsive Design** - Works on desktop and mobile devices
|
|
12
|
+
- **Zero Configuration** - Auto-discovers trace files and starts monitoring
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Install globally
|
|
18
|
+
npm install -g @agentflow/dashboard
|
|
19
|
+
|
|
20
|
+
# Start monitoring your traces
|
|
21
|
+
agentflow-dashboard --traces ./traces --port 3000
|
|
22
|
+
|
|
23
|
+
# Or run with npx
|
|
24
|
+
npx @agentflow/dashboard --traces ./my-agent-traces
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Open http://localhost:3000 to view the dashboard.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @agentflow/dashboard
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Requirements:**
|
|
36
|
+
- Node.js 18+
|
|
37
|
+
- AgentFlow traces directory
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
### Command Line Interface
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
agentflow-dashboard [options]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Options:**
|
|
48
|
+
- `-p, --port <number>` - Server port (default: 3000)
|
|
49
|
+
- `-t, --traces <path>` - Traces directory (default: ./traces)
|
|
50
|
+
- `-h, --host <address>` - Host address (default: localhost)
|
|
51
|
+
- `--cors` - Enable CORS headers
|
|
52
|
+
- `--help` - Show help message
|
|
53
|
+
|
|
54
|
+
### Examples
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Basic usage
|
|
58
|
+
agentflow-dashboard
|
|
59
|
+
|
|
60
|
+
# Custom port and traces directory
|
|
61
|
+
agentflow-dashboard --port 8080 --traces /var/log/agentflow
|
|
62
|
+
|
|
63
|
+
# Enable external access with CORS
|
|
64
|
+
agentflow-dashboard --host 0.0.0.0 --cors --port 3000
|
|
65
|
+
|
|
66
|
+
# Monitor specific agent traces
|
|
67
|
+
agentflow-dashboard --traces ./my-ai-agent/traces
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Programmatic Usage
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { DashboardServer } from '@agentflow/dashboard';
|
|
74
|
+
|
|
75
|
+
const dashboard = new DashboardServer({
|
|
76
|
+
port: 3000,
|
|
77
|
+
tracesDir: './traces',
|
|
78
|
+
host: 'localhost',
|
|
79
|
+
enableCors: false
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
await dashboard.start();
|
|
83
|
+
console.log('Dashboard started!');
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Dashboard Interface
|
|
87
|
+
|
|
88
|
+
### Overview Page
|
|
89
|
+
|
|
90
|
+
The main dashboard shows:
|
|
91
|
+
|
|
92
|
+
- **Global Statistics** - Total agents, executions, success rate, active agents
|
|
93
|
+
- **Agent List** - All agents with execution counts and success rates
|
|
94
|
+
- **Recent Activity** - Latest agent executions with status indicators
|
|
95
|
+
- **Performance Trends** - Success/failure patterns over time
|
|
96
|
+
|
|
97
|
+
### Agent Details
|
|
98
|
+
|
|
99
|
+
Click any agent to view:
|
|
100
|
+
|
|
101
|
+
- **Execution History** - All recent executions for that agent
|
|
102
|
+
- **Performance Metrics** - Success rate, average execution time
|
|
103
|
+
- **Trigger Analysis** - How the agent is being invoked
|
|
104
|
+
- **Error Patterns** - Common failure modes and debugging info
|
|
105
|
+
|
|
106
|
+
### Real-Time Updates
|
|
107
|
+
|
|
108
|
+
The dashboard automatically updates when:
|
|
109
|
+
|
|
110
|
+
- New trace files are created
|
|
111
|
+
- Existing traces are updated
|
|
112
|
+
- Agent performance changes
|
|
113
|
+
- System status changes
|
|
114
|
+
|
|
115
|
+
## Configuration
|
|
116
|
+
|
|
117
|
+
### Directory Structure
|
|
118
|
+
|
|
119
|
+
The dashboard expects this structure:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
traces/
|
|
123
|
+
├── agent1-2024-01-15T10-30-00.json
|
|
124
|
+
├── agent1-2024-01-15T10-35-00.json
|
|
125
|
+
├── agent2-2024-01-15T10-32-00.json
|
|
126
|
+
└── ...
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Trace File Format
|
|
130
|
+
|
|
131
|
+
Compatible with standard AgentFlow trace format:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"agentId": "my-agent",
|
|
136
|
+
"trigger": "cron_job",
|
|
137
|
+
"name": "my-agent data_processing execution",
|
|
138
|
+
"timestamp": 1642234200000,
|
|
139
|
+
"nodes": [...],
|
|
140
|
+
"rootId": "node_1",
|
|
141
|
+
"metadata": {...}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Environment Variables
|
|
146
|
+
|
|
147
|
+
- `AGENTFLOW_DASHBOARD_PORT` - Default port
|
|
148
|
+
- `AGENTFLOW_DASHBOARD_HOST` - Default host
|
|
149
|
+
- `AGENTFLOW_TRACES_DIR` - Default traces directory
|
|
150
|
+
|
|
151
|
+
## API Endpoints
|
|
152
|
+
|
|
153
|
+
The dashboard exposes REST endpoints for integration:
|
|
154
|
+
|
|
155
|
+
### GET /api/traces
|
|
156
|
+
Get all trace files with metadata.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
curl http://localhost:3000/api/traces
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### GET /api/traces/:filename
|
|
163
|
+
Get specific trace file content.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
curl http://localhost:3000/api/traces/agent1-2024-01-15T10-30-00.json
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### GET /api/stats
|
|
170
|
+
Get global performance statistics.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
curl http://localhost:3000/api/stats
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### GET /api/stats/:agentId
|
|
177
|
+
Get statistics for specific agent.
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
curl http://localhost:3000/api/stats/my-agent
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### GET /api/agents
|
|
184
|
+
Get list of all known agents.
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
curl http://localhost:3000/api/agents
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Integration Examples
|
|
191
|
+
|
|
192
|
+
### Docker Deployment
|
|
193
|
+
|
|
194
|
+
```dockerfile
|
|
195
|
+
FROM node:18-alpine
|
|
196
|
+
|
|
197
|
+
RUN npm install -g @agentflow/dashboard
|
|
198
|
+
|
|
199
|
+
EXPOSE 3000
|
|
200
|
+
|
|
201
|
+
CMD ["agentflow-dashboard", "--host", "0.0.0.0", "--traces", "/traces"]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```yaml
|
|
205
|
+
# docker-compose.yml
|
|
206
|
+
version: '3.8'
|
|
207
|
+
services:
|
|
208
|
+
agentflow-dashboard:
|
|
209
|
+
image: node:18-alpine
|
|
210
|
+
ports:
|
|
211
|
+
- "3000:3000"
|
|
212
|
+
volumes:
|
|
213
|
+
- ./traces:/traces
|
|
214
|
+
command: >
|
|
215
|
+
sh -c "npm install -g @agentflow/dashboard &&
|
|
216
|
+
agentflow-dashboard --host 0.0.0.0 --traces /traces"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Kubernetes Deployment
|
|
220
|
+
|
|
221
|
+
```yaml
|
|
222
|
+
apiVersion: apps/v1
|
|
223
|
+
kind: Deployment
|
|
224
|
+
metadata:
|
|
225
|
+
name: agentflow-dashboard
|
|
226
|
+
spec:
|
|
227
|
+
replicas: 1
|
|
228
|
+
selector:
|
|
229
|
+
matchLabels:
|
|
230
|
+
app: agentflow-dashboard
|
|
231
|
+
template:
|
|
232
|
+
metadata:
|
|
233
|
+
labels:
|
|
234
|
+
app: agentflow-dashboard
|
|
235
|
+
spec:
|
|
236
|
+
containers:
|
|
237
|
+
- name: dashboard
|
|
238
|
+
image: node:18-alpine
|
|
239
|
+
ports:
|
|
240
|
+
- containerPort: 3000
|
|
241
|
+
command:
|
|
242
|
+
- sh
|
|
243
|
+
- -c
|
|
244
|
+
- "npm install -g @agentflow/dashboard && agentflow-dashboard --host 0.0.0.0"
|
|
245
|
+
volumeMounts:
|
|
246
|
+
- name: traces
|
|
247
|
+
mountPath: /traces
|
|
248
|
+
volumes:
|
|
249
|
+
- name: traces
|
|
250
|
+
persistentVolumeClaim:
|
|
251
|
+
claimName: agentflow-traces
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Nginx Reverse Proxy
|
|
255
|
+
|
|
256
|
+
```nginx
|
|
257
|
+
server {
|
|
258
|
+
listen 80;
|
|
259
|
+
server_name dashboard.example.com;
|
|
260
|
+
|
|
261
|
+
location / {
|
|
262
|
+
proxy_pass http://localhost:3000;
|
|
263
|
+
proxy_http_version 1.1;
|
|
264
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
265
|
+
proxy_set_header Connection 'upgrade';
|
|
266
|
+
proxy_set_header Host $host;
|
|
267
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
268
|
+
proxy_cache_bypass $http_upgrade;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Systemd Service
|
|
274
|
+
|
|
275
|
+
```ini
|
|
276
|
+
# /etc/systemd/system/agentflow-dashboard.service
|
|
277
|
+
[Unit]
|
|
278
|
+
Description=AgentFlow Dashboard
|
|
279
|
+
After=network.target
|
|
280
|
+
|
|
281
|
+
[Service]
|
|
282
|
+
Type=simple
|
|
283
|
+
User=agentflow
|
|
284
|
+
WorkingDirectory=/opt/agentflow
|
|
285
|
+
ExecStart=/usr/local/bin/agentflow-dashboard --traces /var/log/agentflow
|
|
286
|
+
Restart=always
|
|
287
|
+
Environment=NODE_ENV=production
|
|
288
|
+
|
|
289
|
+
[Install]
|
|
290
|
+
WantedBy=multi-user.target
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Performance Tuning
|
|
294
|
+
|
|
295
|
+
### Large Trace Volumes
|
|
296
|
+
|
|
297
|
+
For high-volume agent systems:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# Increase Node.js memory limit
|
|
301
|
+
NODE_OPTIONS="--max-old-space-size=4096" agentflow-dashboard
|
|
302
|
+
|
|
303
|
+
# Use dedicated traces directory with log rotation
|
|
304
|
+
agentflow-dashboard --traces /var/log/agentflow/current
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Network Optimization
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
// Disable real-time updates for low-bandwidth connections
|
|
311
|
+
const dashboard = new DashboardServer({
|
|
312
|
+
port: 3000,
|
|
313
|
+
tracesDir: './traces',
|
|
314
|
+
enableCors: true,
|
|
315
|
+
// Custom update intervals can be configured
|
|
316
|
+
});
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Troubleshooting
|
|
320
|
+
|
|
321
|
+
### Common Issues
|
|
322
|
+
|
|
323
|
+
**Dashboard not loading traces:**
|
|
324
|
+
```bash
|
|
325
|
+
# Check traces directory permissions
|
|
326
|
+
ls -la ./traces
|
|
327
|
+
|
|
328
|
+
# Check trace file format
|
|
329
|
+
cat traces/agent-*.json | head -20
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**WebSocket connection failures:**
|
|
333
|
+
```bash
|
|
334
|
+
# Check firewall settings
|
|
335
|
+
sudo ufw status
|
|
336
|
+
|
|
337
|
+
# Test WebSocket connectivity
|
|
338
|
+
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" http://localhost:3000
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**High memory usage:**
|
|
342
|
+
```bash
|
|
343
|
+
# Monitor dashboard process
|
|
344
|
+
top -p $(pgrep -f agentflow-dashboard)
|
|
345
|
+
|
|
346
|
+
# Clean old trace files
|
|
347
|
+
find ./traces -name "*.json" -mtime +7 -delete
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Debug Mode
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# Enable debug logging
|
|
354
|
+
DEBUG=agentflow:* agentflow-dashboard --traces ./traces
|
|
355
|
+
|
|
356
|
+
# Check dashboard health
|
|
357
|
+
curl http://localhost:3000/api/stats
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
## Contributing
|
|
361
|
+
|
|
362
|
+
See [CONTRIBUTING.md](../../CONTRIBUTING.md) for development guidelines.
|
|
363
|
+
|
|
364
|
+
## License
|
|
365
|
+
|
|
366
|
+
MIT - See [LICENSE](../../LICENSE) for details.
|
package/bin/dashboard.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Import and start the CLI
|
|
4
|
+
import('../dist/cli.js').then(({ startDashboard }) => {
|
|
5
|
+
startDashboard().catch((error) => {
|
|
6
|
+
console.error('Failed to start AgentFlow Dashboard:', error);
|
|
7
|
+
process.exit(1);
|
|
8
|
+
});
|
|
9
|
+
}).catch((error) => {
|
|
10
|
+
console.error('Failed to load AgentFlow Dashboard:', error);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
});
|