-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-agents.js
More file actions
181 lines (162 loc) · 8.96 KB
/
setup-agents.js
File metadata and controls
181 lines (162 loc) · 8.96 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
171
172
173
174
175
176
177
178
179
180
181
const http = require('http');
const COMPANY_ID = 'd2fff383-45fa-4d42-9d4f-70d73f467d9c';
function api(method, path, body) {
return new Promise((resolve, reject) => {
const data = body ? JSON.stringify(body) : '';
const opts = {
hostname: 'localhost',
port: 3101,
path: path,
method,
headers: {
'Content-Type': 'application/json',
}
};
const req = http.request(opts, (res) => {
let b = '';
res.on('data', (chunk) => { b += chunk; });
res.on('end', () => {
try { resolve({ status: res.statusCode, body: JSON.parse(b) }); }
catch (e) { resolve({ status: res.statusCode, body: b }); }
});
});
req.on('error', reject);
if (data) req.write(data);
req.end();
});
}
async function main() {
// Valid roles: ceo, cto, cmo, cfo, engineer, designer, pm, qa, devops, researcher, general
// Create CEO first (no reportsTo needed for CEO root)
// Then C-suite (reports to CEO)
// Then dept leads (reports to C-suite)
const agents = [
// 1. CEO (no reportsTo - root)
{ name: 'Antigravity CEO', role: 'ceo', capabilities: 'Antigravity Company CEO - oversees all 10 departments with 1,329 skills from antigravity-awesome-skills repo. Reports to The Hive board.', title: 'Chief Executive Officer' },
// 2-4. C-Suite (will update reportsTo after CEO is created)
{ name: 'CTO', role: 'cto', capabilities: 'CTO - technology strategy, architecture, engineering oversight. Manages Agent Engineering, Full-Stack Dev, Python/Backend, Frontend/UI departments. Access to 300+ engineering skills.', title: 'Chief Technology Officer' },
{ name: 'CPO', role: 'pm', capabilities: 'CPO - product quality, QA oversight, game development. Manages QA Testing and Game Development departments.', title: 'Chief Product Officer' },
{ name: 'COO', role: 'devops', capabilities: 'COO - operations, infrastructure, data architecture, marketing. Manages DevOps, Data/AI Architecture, Marketing departments.', title: 'Chief Operations Officer' },
// Dept leads (will update reportsTo after C-suite)
{ name: 'Agent Engineering Lead', role: 'engineer', capabilities: 'Agent/LLM Engineering: AI agent design, RAG systems, prompt engineering, MCP tool building, LangGraph, Langfuse, agent evaluation, orchestration. 70+ skills.', title: 'Lead - Agent/LLM Engineering' },
{ name: 'Full-Stack Development Lead', role: 'engineer', capabilities: 'Full-Stack Dev: React 19, Next.js 15, Node.js, TypeScript, Rust, Go, fullstack patterns, API design, database architecture. 200+ skills.', title: 'Lead - Full-Stack Development' },
{ name: 'Python Backend Lead', role: 'engineer', capabilities: 'Python/Backend: Python 3.12+, FastAPI, Django, async Python, PostgreSQL, SQL, database design and optimization. 55+ skills.', title: 'Lead - Python/Backend Engineering' },
{ name: 'Frontend UI Design Lead', role: 'designer', capabilities: 'Frontend/UI: UI/UX design systems, 3D web (Three.js), canvas design, mobile development, React Native, Flutter, iOS, Apple HIG. 75+ skills.', title: 'Lead - Frontend/UI Design' },
{ name: 'Security Engineering Lead', role: 'engineer', capabilities: 'Security: ethical hacking, pentesting, Burp Suite, OWASP, auth security, cloud pentest, vulnerability scanning, AD attacks. 75+ skills.', title: 'Lead - Security Engineering' },
{ name: 'QA Testing Lead', role: 'qa', capabilities: 'QA & Testing: TDD, browser automation with Playwright, E2E testing, systematic debugging, code review checklists. 30+ skills.', title: 'Lead - QA & Testing' },
{ name: 'Game Development Lead', role: 'engineer', capabilities: 'Game Dev: game design, 2D/3D game development, Unity 6, Godot 4/GDScript, algorithmic art generation. 16 skills.', title: 'Lead - Game Development' },
{ name: 'DevOps Infrastructure Lead', role: 'devops', capabilities: 'DevOps/Infra: Docker, AWS serverless, Kubernetes, Terraform, CI/CD, observability, SLO, incident response, performance engineering. 175+ skills.', title: 'Lead - DevOps & Infrastructure' },
{ name: 'Data AI Architecture Lead', role: 'engineer', capabilities: 'Data/AI Architecture: data engineering, vector databases, RAG, DDD, architecture patterns, microservices, CQRS, event sourcing, business analysis. 150+ skills.', title: 'Lead - Data/AI Architecture' },
{ name: 'Marketing Growth Lead', role: 'engineer', capabilities: 'Marketing & Growth: SEO, content creation, email campaigns, analytics, HubSpot CRM, Stripe commerce, programmatic SEO, conversion optimization. 120+ skills.', title: 'Lead - Marketing & Growth' },
];
const created = [];
// Phase 1: Create CEO first (no reportsTo)
console.log('=== Phase 1: Creating CEO ===');
const ceoData = agents[0];
const ceoPayload = {
name: ceoData.name,
role: ceoData.role,
title: ceoData.title,
capabilities: ceoData.capabilities,
adapterType: 'openclaw_gateway',
adapterConfig: {}
};
const ceoRes = await api('POST', '/api/companies/' + COMPANY_ID + '/agents', ceoPayload);
if (ceoRes.status === 201 || ceoRes.status === 200) {
const ceoId = ceoRes.body.agent.id;
console.log('CEO CREATED: ' + ceoData.name + ' (id: ' + ceoId + ')');
created.push({ name: ceoData.name, id: ceoId, role: ceoData.role, idx: 0 });
} else {
console.log('CEO FAILED (' + ceoRes.status + '): ' + JSON.stringify(ceoRes.body));
console.log('Cannot proceed without CEO. Exiting.');
return;
}
const ceoId = created[0].id;
// Phase 2: Create C-suite (reports to CEO)
console.log('\n=== Phase 2: Creating C-Suite ===');
const cSuiteIndices = [1, 2, 3]; // CTO, CPO, COO
const cSuiteIds = [];
for (const i of cSuiteIndices) {
const agent = agents[i];
const payload = {
name: agent.name,
role: agent.role,
title: agent.title,
capabilities: agent.capabilities,
reportsTo: ceoId,
adapterType: 'openclaw_gateway',
adapterConfig: {}
};
const res = await api('POST', '/api/companies/' + COMPANY_ID + '/agents', payload);
if (res.status === 201 || res.status === 200) {
const aId = res.body.agent.id;
console.log('CREATED: ' + agent.name + ' (id: ' + aId + ')');
created.push({ name: agent.name, id: aId, role: agent.role, idx: i });
cSuiteIds[aId] = agent.name;
} else {
console.log('FAILED (' + res.status + '): ' + agent.name + ' - ' + JSON.stringify(res.body).substring(0, 200));
}
}
// Map department leads to their bosses
const deptToBoss = {
'Agent Engineering Lead': agents[1].name, // CTO
'Full-Stack Development Lead': agents[1].name, // CTO
'Python Backend Lead': agents[1].name, // CTO
'Frontend UI Design Lead': agents[1].name, // CTO
'Security Engineering Lead': agents[1].name, // CTO
'QA Testing Lead': agents[2].name, // CPO
'Game Development Lead': agents[2].name, // CPO
'DevOps Infrastructure Lead': agents[3].name, // COO
'Data AI Architecture Lead': agents[3].name, // COO
'Marketing Growth Lead': agents[3].name, // COO
};
// Phase 3: Create department leads (reports to C-suite)
console.log('\n=== Phase 3: Creating Department Leads ===');
const deptIndices = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
// Build lookup of created C-suite names to IDs
const nameToId = {};
created.forEach(c => { nameToId[c.name] = c.id; });
for (const i of deptIndices) {
const agent = agents[i];
const bossName = deptToBoss[agent.name];
const bossId = nameToId[bossName];
if (!bossId) {
console.log('SKIP: ' + agent.name + ' - boss ' + bossName + ' not found');
continue;
}
const payload = {
name: agent.name,
role: agent.role,
title: agent.title,
capabilities: agent.capabilities,
reportsTo: bossId,
adapterType: 'openclaw_gateway',
adapterConfig: {}
};
const res = await api('POST', '/api/companies/' + COMPANY_ID + '/agents', payload);
if (res.status === 201 || res.status === 200) {
const aId = res.body.agent.id;
console.log('CREATED: ' + agent.name + ' (id: ' + aId + ', boss: ' + bossName + ')');
created.push({ name: agent.name, id: aId, role: agent.role, idx: i, bossName });
} else {
console.log('FAILED (' + res.status + '): ' + agent.name + ' - ' + JSON.stringify(res.body).substring(0, 200));
}
}
// Phase 4: Verify all agents
console.log('\n=== Phase 4: Verification ===');
const verifyRes = await api('GET', '/api/companies/' + COMPANY_ID + '/agents');
if (verifyRes.status === 200 && Array.isArray(verifyRes.body)) {
console.log('Total agents in company: ' + verifyRes.body.length);
verifyRes.body.forEach(a => {
console.log(' - ' + a.name + ' [' + a.role + '] reportsTo: ' + (a.reportsTo || 'null'));
});
}
// Summary
console.log('\n=== Setup Summary ===');
console.log('Created: ' + created.length + ' agents');
created.forEach(a => {
const boss = a.bossName ? ' (reports to ' + a.bossName + ')' : '';
console.log(' [' + a.role + '] ' + a.name + ': ' + a.id + boss);
});
}
main().catch(console.error);