-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathMultiAgentDashboard.jsx
More file actions
170 lines (153 loc) · 4.61 KB
/
MultiAgentDashboard.jsx
File metadata and controls
170 lines (153 loc) · 4.61 KB
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
import React, { useState } from "react";
/**
* Multi-Agent Configuration Dashboard
* Allows users to manage up to 7 AI agents
*/
const DEFAULT_AGENTS = [
{ id: 1, name: "Planner Agent", role: "Planner", active: true, priority: 1, systemPrompt: "", task: "" },
{ id: 2, name: "Research Agent", role: "Researcher", active: true, priority: 2 },
{ id: 3, name: "Reasoning Agent", role: "Reasoner", active: true, priority: 3 },
{ id: 4, name: "Execution Agent", role: "Executor", active: true, priority: 4 },
{ id: 5, name: "Validation Agent", role: "Validator", active: true, priority: 5 },
{ id: 6, name: "Memory Agent", role: "Memory", active: false, priority: 6 },
{ id: 7, name: "Observer Agent", role: "Observer", active: false, priority: 7 },
];
const ROLES = [
"Planner",
"Researcher",
"Reasoner",
"Executor",
"Validator",
"Memory",
"Observer",
];
export default function MultiAgentDashboard() {
const [agents, setAgents] = useState(DEFAULT_AGENTS);
const updateAgent = (id, updates) => {
setAgents((prev) =>
prev.map((agent) =>
agent.id === id ? { ...agent, ...updates } : agent
)
);
};
const addAgent = () => {
if (agents.length >= 7) return;
setAgents((prev) => [
...prev,
{
id: Date.now(),
name: "New Agent",
role: "Planner",
systemPrompt: "",
task: "",
active: true,
priority: prev.length + 1,
},
]);
};
const removeAgent = (id) => {
setAgents((prev) => prev.filter((agent) => agent.id !== id));
};
return (
<div style={{ padding: "24px" }}>
<h1>🧠 Multi-Agent Task Configuration</h1>
<p>
Configure how multiple AI agents collaborate to achieve a single goal.
</p>
<div
style={{
display: "grid",
gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
gap: "16px",
}}
>
{agents.map((agent) => (
<div
key={agent.id}
style={{
background: "#121212",
padding: "16px",
borderRadius: "12px",
border: "1px solid #2a2a2a",
opacity: agent.active ? 1 : 0.5,
}}
>
<input
value={agent.name}
onChange={(e) =>
updateAgent(agent.id, { name: e.target.value })
}
placeholder="Agent Name"
style={{ width: "100%", marginBottom: "8px" }}
/>
<select
value={agent.role}
onChange={(e) =>
updateAgent(agent.id, { role: e.target.value })
}
style={{ width: "100%", marginBottom: "8px" }}
>
{ROLES.map((role) => (
<option key={role}>{role}</option>
))}
</select>
<textarea
value={agent.systemPrompt || ""}
placeholder="System Prompt"
onChange={(e) =>
updateAgent(agent.id, { systemPrompt: e.target.value })
}
style={{ width: "100%", marginBottom: "8px" }}
/>
<textarea
placeholder="Task / Instruction"
onChange={(e) =>
updateAgent(agent.id, { task: e.target.value })
}
style={{ width: "100%", marginBottom: "8px" }}
/>
<input
type="number"
value={agent.priority}
onChange={(e) =>
updateAgent(agent.id, { priority: parseInt(e.target.value, 10) || agent.priority })
}
style={{ width: "100%", marginBottom: "8px" }}
/>
<label>
<input
type="checkbox"
checked={agent.active}
onChange={() =>
updateAgent(agent.id, { active: !agent.active })
}
/>{" "}
Active
</label>
{agents.length > 1 && (
<button
onClick={() => removeAgent(agent.id)}
style={{
marginTop: "8px",
background: "#ff4d4d",
border: "none",
padding: "6px",
width: "100%",
}}
>
Remove Agent
</button>
)}
</div>
))}
</div>
<button
onClick={addAgent}
disabled={agents.length >= 7}
style={{ marginTop: "20px" }}
>
➕ Add Agent
</button>
</div>
);
}