-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_agent_endpoints.sh
More file actions
executable file
·70 lines (58 loc) · 2.15 KB
/
test_agent_endpoints.sh
File metadata and controls
executable file
·70 lines (58 loc) · 2.15 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
#!/bin/bash
# Test script for Agent API endpoints
# Tests the REST API endpoints exposed by the DTN Bundle System
# Note: Don't use 'set -e' - we want to show errors but not exit the terminal
API_URL="http://localhost:8000"
AGENT_API="$API_URL/agents"
echo "=========================================="
echo "Testing Agent API Endpoints"
echo "=========================================="
echo ""
# Check if server is running
if ! curl -s "$API_URL/health" > /dev/null 2>&1; then
echo "❌ Server is not running at $API_URL"
echo "Start the server with: python -m uvicorn app.main:app --reload"
return
fi
echo "✓ Server is running"
echo ""
# Test 1: List available agents
echo "=== Test 1: GET /agents ==="
echo "List all available agents"
response=$(curl -s "$AGENT_API")
echo "$response" | python -m json.tool
echo ""
# Test 2: Run mutual-aid-matchmaker agent
echo "=== Test 2: POST /agents/mutual-aid-matchmaker/run ==="
echo "Execute the mutual aid matchmaker agent"
response=$(curl -s -X POST "$AGENT_API/mutual-aid-matchmaker/run" \
-H "Content-Type: application/json" \
-d '{}')
echo "$response" | python -m json.tool
# Extract proposal count
proposal_count=$(echo "$response" | python -c "import sys, json; data=json.load(sys.stdin); print(len(data.get('proposals', [])))")
echo ""
echo "✓ Agent executed successfully"
echo "✓ Generated $proposal_count proposals"
echo ""
# Test 3: Get proposals list
echo "=== Test 3: GET /agents/proposals ==="
echo "List all proposals"
response=$(curl -s "$AGENT_API/proposals")
echo "$response" | python -m json.tool
echo ""
# Test 4: Get agent settings
echo "=== Test 4: GET /agents/settings/mutual-aid-matchmaker ==="
echo "Get agent configuration"
response=$(curl -s "$AGENT_API/settings/mutual-aid-matchmaker")
echo "$response" | python -m json.tool
echo ""
# Test 5: Get agent stats
echo "=== Test 5: GET /agents/stats/mutual-aid-matchmaker ==="
echo "Get agent statistics"
response=$(curl -s "$AGENT_API/stats/mutual-aid-matchmaker")
echo "$response" | python -m json.tool
echo ""
echo "=========================================="
echo "✅ All API tests passed!"
echo "=========================================="