forked from aden-hive/hive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickstart.sh
More file actions
executable file
·345 lines (290 loc) · 10.7 KB
/
quickstart.sh
File metadata and controls
executable file
·345 lines (290 loc) · 10.7 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
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
#!/bin/bash
#
# quickstart.sh - Complete setup for Aden Agent Framework skills
#
# This script:
# 1. Installs Python dependencies (framework, aden_tools, MCP)
# 2. Installs Claude Code skills for building and testing agents
# 3. Verifies the setup is ready to use
#
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Get the directory where this script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Claude Code skills directory
CLAUDE_SKILLS_DIR="$HOME/.claude/skills"
echo ""
echo "=================================================="
echo " Aden Agent Framework - Complete Setup"
echo "=================================================="
echo ""
# ============================================================
# Step 1: Check Python Prerequisites
# ============================================================
echo -e "${BLUE}Step 1: Checking Python prerequisites...${NC}"
echo ""
# Check for Python
if ! command -v python &> /dev/null && ! command -v python3 &> /dev/null; then
echo -e "${RED}Error: Python is not installed.${NC}"
echo "Please install Python 3.11+ from https://python.org"
exit 1
fi
# Use python3 if available, otherwise python
PYTHON_CMD="python3"
if ! command -v python3 &> /dev/null; then
PYTHON_CMD="python"
fi
# Check Python version
PYTHON_VERSION=$($PYTHON_CMD -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
PYTHON_MAJOR=$($PYTHON_CMD -c 'import sys; print(sys.version_info.major)')
PYTHON_MINOR=$($PYTHON_CMD -c 'import sys; print(sys.version_info.minor)')
echo -e " Detected Python: ${GREEN}$PYTHON_VERSION${NC}"
if [ "$PYTHON_MAJOR" -lt 3 ] || ([ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -lt 11 ]); then
echo -e "${RED}Error: Python 3.11+ is required (found $PYTHON_VERSION)${NC}"
echo "Please upgrade your Python installation"
exit 1
fi
if [ "$PYTHON_MINOR" -lt 11 ]; then
echo -e "${YELLOW} Warning: Python 3.11+ is recommended for best compatibility${NC}"
fi
echo -e "${GREEN} ✓ Python version OK${NC}"
echo ""
# Check for pip
if ! $PYTHON_CMD -m pip --version &> /dev/null; then
echo -e "${RED}Error: pip is not installed${NC}"
echo "Please install pip for Python $PYTHON_VERSION"
exit 1
fi
echo -e "${GREEN} ✓ pip detected${NC}"
echo ""
# ============================================================
# Step 2: Install Python Packages
# ============================================================
echo -e "${BLUE}Step 2: Installing Python packages...${NC}"
echo ""
# Upgrade pip, setuptools, and wheel
echo " Upgrading pip, setuptools, wheel..."
$PYTHON_CMD -m pip install --upgrade pip setuptools wheel > /dev/null 2>&1
echo -e "${GREEN} ✓ Core tools upgraded${NC}"
# Install framework package from core/
echo " Installing framework package from core/..."
cd "$SCRIPT_DIR/core"
if [ -f "pyproject.toml" ]; then
$PYTHON_CMD -m pip install -e . > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo -e "${GREEN} ✓ framework package installed${NC}"
else
echo -e "${YELLOW} ⚠ framework installation had issues (may be OK)${NC}"
fi
else
echo -e "${RED} ✗ No pyproject.toml in core/${NC}"
exit 1
fi
# Install aden_tools package from tools/
echo " Installing aden_tools package from tools/..."
cd "$SCRIPT_DIR/tools"
if [ -f "pyproject.toml" ]; then
$PYTHON_CMD -m pip install -e . > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo -e "${GREEN} ✓ aden_tools package installed${NC}"
else
echo -e "${RED} ✗ aden_tools installation failed${NC}"
exit 1
fi
else
echo -e "${RED} ✗ No pyproject.toml in tools/${NC}"
exit 1
fi
# Install MCP dependencies
echo " Installing MCP dependencies..."
$PYTHON_CMD -m pip install mcp fastmcp > /dev/null 2>&1
echo -e "${GREEN} ✓ MCP dependencies installed${NC}"
# Fix openai version compatibility
OPENAI_VERSION=$($PYTHON_CMD -c "import openai; print(openai.__version__)" 2>/dev/null || echo "not_installed")
if [ "$OPENAI_VERSION" = "not_installed" ]; then
echo " Installing openai package..."
$PYTHON_CMD -m pip install "openai>=1.0.0" > /dev/null 2>&1
echo -e "${GREEN} ✓ openai installed${NC}"
elif [[ "$OPENAI_VERSION" =~ ^0\. ]]; then
echo " Upgrading openai to 1.x+ for litellm compatibility..."
$PYTHON_CMD -m pip install --upgrade "openai>=1.0.0" > /dev/null 2>&1
echo -e "${GREEN} ✓ openai upgraded${NC}"
else
echo -e "${GREEN} ✓ openai $OPENAI_VERSION is compatible${NC}"
fi
# Install click for CLI
$PYTHON_CMD -m pip install click > /dev/null 2>&1
echo -e "${GREEN} ✓ click installed${NC}"
cd "$SCRIPT_DIR"
echo ""
# ============================================================
# Step 3: Verify Python Imports
# ============================================================
echo -e "${BLUE}Step 3: Verifying Python imports...${NC}"
echo ""
IMPORT_ERRORS=0
# Test framework import
if $PYTHON_CMD -c "import framework" > /dev/null 2>&1; then
echo -e "${GREEN} ✓ framework imports OK${NC}"
else
echo -e "${RED} ✗ framework import failed${NC}"
IMPORT_ERRORS=$((IMPORT_ERRORS + 1))
fi
# Test aden_tools import
if $PYTHON_CMD -c "import aden_tools" > /dev/null 2>&1; then
echo -e "${GREEN} ✓ aden_tools imports OK${NC}"
else
echo -e "${RED} ✗ aden_tools import failed${NC}"
IMPORT_ERRORS=$((IMPORT_ERRORS + 1))
fi
# Test litellm import
if $PYTHON_CMD -c "import litellm" > /dev/null 2>&1; then
echo -e "${GREEN} ✓ litellm imports OK${NC}"
else
echo -e "${YELLOW} ⚠ litellm import issues (may be OK)${NC}"
fi
# Test MCP server module
if $PYTHON_CMD -c "from framework.mcp import agent_builder_server" > /dev/null 2>&1; then
echo -e "${GREEN} ✓ MCP server module OK${NC}"
else
echo -e "${RED} ✗ MCP server module failed${NC}"
IMPORT_ERRORS=$((IMPORT_ERRORS + 1))
fi
if [ $IMPORT_ERRORS -gt 0 ]; then
echo ""
echo -e "${RED}Error: $IMPORT_ERRORS import(s) failed. Please check the errors above.${NC}"
exit 1
fi
echo ""
# ============================================================
# Step 4: Install Claude Code Skills
# ============================================================
echo -e "${BLUE}Step 4: Installing Claude Code skills...${NC}"
echo ""
# Check if .claude/skills exists in this repo
if [ ! -d "$SCRIPT_DIR/.claude/skills" ]; then
echo -e "${RED}Error: Skills directory not found at $SCRIPT_DIR/.claude/skills${NC}"
exit 1
fi
# Create Claude skills directory if it doesn't exist
if [ ! -d "$CLAUDE_SKILLS_DIR" ]; then
echo " Creating Claude skills directory: $CLAUDE_SKILLS_DIR"
mkdir -p "$CLAUDE_SKILLS_DIR"
fi
# Function to install a skill
install_skill() {
local skill_name=$1
local source_dir="$SCRIPT_DIR/.claude/skills/$skill_name"
local target_dir="$CLAUDE_SKILLS_DIR/$skill_name"
if [ ! -d "$source_dir" ]; then
echo -e "${RED} ✗ Skill not found: $skill_name${NC}"
return 1
fi
# Check if skill already exists
if [ -d "$target_dir" ]; then
rm -rf "$target_dir"
fi
# Copy the skill
cp -r "$source_dir" "$target_dir"
echo -e "${GREEN} ✓ Installed: $skill_name${NC}"
}
# Install all 5 agent-related skills
install_skill "building-agents-core"
install_skill "building-agents-construction"
install_skill "building-agents-patterns"
install_skill "testing-agent"
install_skill "agent-workflow"
echo ""
# ============================================================
# Step 5: Verify MCP Configuration
# ============================================================
echo -e "${BLUE}Step 5: Verifying MCP configuration...${NC}"
echo ""
if [ -f "$SCRIPT_DIR/.mcp.json" ]; then
echo -e "${GREEN} ✓ .mcp.json found at project root${NC}"
echo ""
echo " MCP servers configured:"
$PYTHON_CMD -c "
import json
with open('$SCRIPT_DIR/.mcp.json') as f:
config = json.load(f)
for name in config.get('mcpServers', {}):
print(f' - {name}')
" 2>/dev/null || echo " (could not parse config)"
else
echo -e "${YELLOW} ⚠ No .mcp.json found at project root${NC}"
echo " Claude Code will not have access to MCP tools"
fi
echo ""
# ============================================================
# Step 6: Check API Key
# ============================================================
echo -e "${BLUE}Step 6: Checking API key...${NC}"
echo ""
# Check using CredentialManager (preferred)
API_KEY_AVAILABLE=$($PYTHON_CMD -c "
from aden_tools.credentials import CredentialManager
creds = CredentialManager()
print('yes' if creds.is_available('anthropic') else 'no')
" 2>/dev/null || echo "no")
if [ "$API_KEY_AVAILABLE" = "yes" ]; then
echo -e "${GREEN} ✓ ANTHROPIC_API_KEY is available${NC}"
elif [ -n "$ANTHROPIC_API_KEY" ]; then
echo -e "${GREEN} ✓ ANTHROPIC_API_KEY is set in environment${NC}"
else
echo -e "${YELLOW} ⚠ ANTHROPIC_API_KEY not found${NC}"
echo ""
echo " For real agent testing, you'll need to set your API key:"
echo " ${BLUE}export ANTHROPIC_API_KEY='your-key-here'${NC}"
echo ""
echo " Or add it to your .env file or credential manager."
fi
echo ""
# ============================================================
# Step 7: Success Summary
# ============================================================
echo "=================================================="
echo -e "${GREEN} ✓ Setup Complete!${NC}"
echo "=================================================="
echo ""
echo "Installed Python packages:"
echo " • framework (core agent runtime)"
echo " • aden_tools (tools and MCP servers)"
echo " • MCP dependencies (mcp, fastmcp)"
echo ""
echo "Installed Claude Code skills:"
echo " • /building-agents-core - Fundamental concepts"
echo " • /building-agents-construction - Step-by-step build guide"
echo " • /building-agents-patterns - Best practices"
echo " • /testing-agent - Test and validate agents"
echo " • /agent-workflow - Complete workflow"
echo ""
echo "Usage:"
echo " 1. Open Claude Code in this directory:"
echo " ${BLUE}cd $SCRIPT_DIR && claude${NC}"
echo ""
echo " 2. Build a new agent:"
echo " ${BLUE}/building-agents-construction${NC}"
echo ""
echo " 3. Test an existing agent:"
echo " ${BLUE}/testing-agent${NC}"
echo ""
echo " 4. Or use the complete workflow:"
echo " ${BLUE}/agent-workflow${NC}"
echo ""
echo "MCP Tools available (when running from this directory):"
echo " • mcp__agent-builder__create_session"
echo " • mcp__agent-builder__set_goal"
echo " • mcp__agent-builder__add_node"
echo " • mcp__agent-builder__run_tests"
echo " • ... and more"
echo ""
echo "Documentation:"
echo " • Skills: $CLAUDE_SKILLS_DIR/"
echo " • Examples: $SCRIPT_DIR/exports/"
echo ""