How to test that AEA is working correctly
This guide provides step-by-step tests to verify your AEA installation and functionality.
- Quick Health Check
- Installation Verification
- Test Scenario 1: Send & Receive
- Test Scenario 2: Auto-Processing
- Test Scenario 3: Hook Integration
- Test Scenario 4: Registry
- Test Scenario 5: Message Validation
- Automated Test Suite
- Troubleshooting Failed Tests
Run this 30-second health check:
# 1. Check AEA is installed
test -d .aea && echo "✅ AEA directory exists" || echo "❌ AEA not installed"
# 2. Check jq is available
which jq >/dev/null && echo "✅ jq is installed" || echo "❌ jq not found"
# 3. Check scripts are executable
test -x .aea/scripts/aea-check.sh && echo "✅ Scripts executable" || echo "❌ Scripts not executable"
# 4. Check registry exists
test -f ~/.config/aea/agents.yaml && echo "✅ Registry exists" || echo "❌ Registry not found"
# 5. Check hooks configured
grep -q "aea" .claude/settings.json 2>/dev/null && echo "✅ Hooks configured" || echo "⚠️ Hooks not found"Expected output:
✅ AEA directory exists
✅ jq is installed
✅ Scripts executable
✅ Registry exists
✅ Hooks configured
If any fail, see Troubleshooting.
# Check all required files exist
echo "Checking directory structure..."
FILES=(
".aea/aea.sh"
".aea/agent-config.yaml"
".aea/CLAUDE.md"
".aea/PROTOCOL.md"
".aea/scripts/aea-check.sh"
".aea/scripts/aea-send.sh"
".aea/scripts/aea-registry.sh"
".aea/.processed"
)
for file in "${FILES[@]}"; do
if [ -e "$file" ]; then
echo "✅ $file"
else
echo "❌ $file MISSING"
fi
doneExpected: All ✅
# Check agent-config.yaml is valid
echo "Testing configuration..."
# Extract agent ID
AGENT_ID=$(grep "^ id:" .aea/agent-config.yaml | sed 's/.*"\(.*\)".*/\1/')
echo "Agent ID: $AGENT_ID"
# Check policies exist
grep -q "policies:" .aea/agent-config.yaml && echo "✅ Policies configured" || echo "❌ Policies missing"
# Check auto_respond setting
grep -q "auto_respond:" .aea/agent-config.yaml && echo "✅ Auto-respond configured" || echo "❌ Auto-respond missing"Expected output:
Agent ID: claude-your-repo-name
✅ Policies configured
✅ Auto-respond configured
# Test registry read/write
echo "Testing registry..."
# List agents
bash .aea/scripts/aea-registry.sh list
# Test adding/removing
bash .aea/scripts/aea-registry.sh register test-agent /tmp/test "Test" && echo "✅ Can write to registry" || echo "❌ Cannot write"
bash .aea/scripts/aea-registry.sh unregister test-agent && echo "✅ Can modify registry" || echo "❌ Cannot modify"Expected: Successfully register and unregister test agent
Goal: Verify basic message sending and receiving
# Create two test directories
mkdir -p /tmp/aea-test-sender
mkdir -p /tmp/aea-test-receiver
# Install AEA in both
cd /tmp/aea-test-sender
bash /path/to/aea/scripts/install-aea.sh
cd /tmp/aea-test-receiver
bash /path/to/aea/scripts/install-aea.sh# From sender, register receiver
cd /tmp/aea-test-sender
bash .aea/scripts/aea-registry.sh register receiver /tmp/aea-test-receiver "Test Receiver"
# From receiver, register sender
cd /tmp/aea-test-receiver
bash .aea/scripts/aea-registry.sh register sender /tmp/aea-test-sender "Test Sender"Verify:
bash .aea/scripts/aea-registry.sh list | grep -q "receiver" && echo "✅ Receiver registered"cd /tmp/aea-test-sender
bash .aea/scripts/aea-send.sh \
--to receiver \
--type question \
--priority normal \
--subject "Test Message" \
--message "This is a test. Please acknowledge."Expected output:
✅ Message sent: .aea/message-TIMESTAMP-from-sender.json
Verify message created:
ls -la /tmp/aea-test-receiver/.aea/message-*.jsonExpected: Should show 1 message file
cd /tmp/aea-test-receiver
bash .aea/scripts/aea-check.shExpected output:
📬 Found 1 unprocessed message(s):
• message-TIMESTAMP-from-sender.json
Type: question | Priority: normal | From: sender
Subject: Test Message
bash .aea/scripts/aea-validate-message.sh .aea/message-*.jsonExpected: No errors (exit code 0)
MESSAGE_FILE=$(ls .aea/message-*.json | head -1)
BASENAME=$(basename "$MESSAGE_FILE")
touch .aea/.processed/$BASENAMEVerify:
bash .aea/scripts/aea-check.shExpected output:
✅ No unprocessed messages
- Message file created in receiver directory
- Message appears in check output
- Message validates successfully
- After marking processed, doesn't appear in check
Goal: Verify automatic message processing based on policies
cd /tmp/aea-test-receiver
# Edit .aea/agent-config.yaml
cat >> .aea/agent-config.yaml << 'EOF'
policies:
auto_respond:
enabled: true
message_types: [question, update]
max_priority: normal
EOFcd /tmp/aea-test-sender
bash .aea/scripts/aea-send.sh \
--to receiver \
--type question \
--priority normal \
--subject "Auto-process test" \
--message "What is 2+2?"cd /tmp/aea-test-receiver
# This would normally be done by Claude, but we can test the detection
MESSAGE=$(ls .aea/message-*-from-sender.json | tail -1)
# Extract message details
TYPE=$(jq -r '.message_type' "$MESSAGE")
PRIORITY=$(jq -r '.routing.priority' "$MESSAGE")
echo "Type: $TYPE"
echo "Priority: $PRIORITY"
# Check if auto-processable
if [ "$TYPE" = "question" ] && [ "$PRIORITY" = "normal" ]; then
echo "✅ Message should be auto-processed"
else
echo "❌ Message should require approval"
fiExpected:
Type: question
Priority: normal
✅ Message should be auto-processed
cd /tmp/aea-test-sender
bash .aea/scripts/aea-send.sh \
--to receiver \
--type handoff \
--priority high \
--subject "Requires approval" \
--message "Complex handoff requiring review"Verify:
cd /tmp/aea-test-receiver
MESSAGE=$(ls .aea/message-*-from-sender.json | tail -1)
TYPE=$(jq -r '.message_type' "$MESSAGE")
if [ "$TYPE" = "handoff" ]; then
echo "✅ Handoff type requires user approval (correct)"
else
echo "❌ Unexpected type"
fi- Question with normal priority identified as auto-processable
- Handoff identified as requiring approval
- Policy configuration loaded correctly
Goal: Verify Claude Code hooks trigger correctly
cat .claude/settings.json | jq '.hooks'Expected output:
{
"SessionStart": {
"command": "bash .aea/scripts/aea-auto-processor.sh",
"description": "Auto-process AEA messages on session start",
"enabled": true
},
"UserPromptSubmit": "bash .aea/scripts/aea-check.sh",
"Stop": {
"command": "bash .aea/scripts/aea-auto-processor.sh",
"description": "Auto-process AEA messages after task completion",
"enabled": true
}
}# Manually run each hook script
echo "Testing SessionStart hook..."
bash .aea/scripts/aea-auto-processor.sh 2>&1 | head -5
echo "Testing UserPromptSubmit hook..."
bash .aea/scripts/aea-check.sh 2>&1 | head -5
echo "Testing Stop hook..."
bash .aea/scripts/aea-auto-processor.sh 2>&1 | head -5Expected: All scripts run without errors
# Check that hook executions are logged
tail -20 .aea/agent.log | grep -i "check\|process"Expected: See log entries from recent checks/processing
- Hooks configured in .claude/settings.json
- Hook scripts exist and are executable
- Scripts run without errors
- Actions logged to agent.log
Goal: Verify agent registry functions correctly
bash .aea/scripts/aea-registry.sh register \
test-repo \
/tmp/test \
"Test Repository"Verify:
bash .aea/scripts/aea-registry.sh lookup test-repoExpected output:
/tmp/test
bash .aea/scripts/aea-registry.sh listExpected: Shows all registered agents including test-repo
bash .aea/scripts/aea-registry.sh register \
test-repo \
/tmp/test-updated \
"Updated Description"Verify:
bash .aea/scripts/aea-registry.sh lookup test-repoExpected:
/tmp/test-updated
bash .aea/scripts/aea-registry.sh unregister test-repoVerify:
bash .aea/scripts/aea-registry.sh lookup test-repoExpected: Empty output or "not found"
- Can register new agent
- Lookup returns correct path
- Can update existing agent
- Can unregister agent
- Registry persists across commands
Goal: Verify message validation catches errors
cat > /tmp/valid-message.json << 'EOF'
{
"protocol_version": "0.1.0",
"message_id": "test-123",
"message_type": "question",
"timestamp": "2025-10-25T12:00:00Z",
"sender": {
"agent_id": "test-sender"
},
"recipient": {
"agent_id": "test-receiver"
},
"routing": {
"priority": "normal",
"requires_response": true
},
"content": {
"subject": "Test",
"body": "Test message"
},
"metadata": {
"tags": ["test"]
}
}
EOF
bash .aea/scripts/aea-validate-message.sh /tmp/valid-message.json
echo "Exit code: $?"Expected: Exit code 0 (success)
cat > /tmp/invalid-message.json << 'EOF'
{
"protocol_version": "0.1.0",
"message_type": "question"
}
EOF
bash .aea/scripts/aea-validate-message.sh /tmp/invalid-message.jsonExpected: Error message about missing .message_id
echo "{ invalid json" > /tmp/bad-json.json
bash .aea/scripts/aea-validate-message.sh /tmp/bad-json.jsonExpected: JSON parse error
cat > /tmp/wrong-version.json << 'EOF'
{
"protocol_version": "99.99.99",
"message_id": "test",
"message_type": "question",
"timestamp": "2025-10-25T12:00:00Z",
"sender": {"agent_id": "test"},
"recipient": {"agent_id": "test"},
"routing": {"priority": "normal"},
"content": {"subject": "test", "body": "test"}
}
EOF
bash .aea/scripts/aea-validate-message.sh /tmp/wrong-version.jsonExpected: Warning about version mismatch (but may still validate)
- Valid message passes validation
- Missing required field caught
- Invalid JSON caught
- Version mismatch detected
AEA includes an automated test suite for protocol features:
# Run all tests
bash .aea/aea.sh test
# Run specific test category
bash .aea/aea.sh test request-response
bash .aea/aea.sh test adaptive-retry
bash .aea/aea.sh test webhooks
bash .aea/aea.sh test partial-messages
bash .aea/aea.sh test multi-hopExpected output:
╔════════════════════════════════════════╗
║ AEA v2.2 Feature Test Suite ║
╚════════════════════════════════════════╝
═══ Test 1: Request/Response Correlation ═══
✓ 1.1: Register request
✓ 1.2: Match response to request
✓ 1.3: Prevent duplicate processing
✓ 1.4: Timeout detection
...
Tests Passed: 17/17
✓ All tests passed!
The automated suite tests:
- ✅ Request/Response correlation
- ✅ Adaptive retry backoff
- ✅ Webhook integration
- ✅ Partial message processing
- ✅ Multi-hop messaging
Problem: AEA not installed
Solution:
bash /path/to/aea/scripts/install-aea.shProblem: jq not installed
Solution:
# Debian/Ubuntu
sudo apt-get install jq
# macOS
brew install jqProblem: Registry not initialized
Solution:
mkdir -p ~/.config/aea
cat > ~/.config/aea/agents.yaml << 'EOF'
agents: {}
EOFProblem: Message doesn't conform to protocol v0.1.0
Solution: Check PROTOCOL.md for correct schema. Common issues:
- Using
frominstead ofsender - Using
toinstead ofrecipient - Missing
routingobject - Using
messageinstead ofcontent
Problem: Claude Code not executing hooks
Solution:
- Check
.claude/settings.jsonexists and has hooks - Restart Claude Code session
- Test hook scripts manually:
bash .aea/scripts/aea-check.sh
# Remove test directories
rm -rf /tmp/aea-test-sender /tmp/aea-test-receiver
# Remove test messages
rm -f /tmp/valid-message.json /tmp/invalid-message.json /tmp/bad-json.json /tmp/wrong-version.json
# Unregister test agents
bash .aea/scripts/aea-registry.sh unregister receiver
bash .aea/scripts/aea-registry.sh unregister sender
bash .aea/scripts/aea-registry.sh unregister test-repoConsider adding to CI/CD:
# GitHub Actions example
name: Test AEA
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install jq
run: sudo apt-get install -y jq
- name: Install AEA
run: bash scripts/install-aea.sh
- name: Run test suite
run: bash .aea/aea.sh testAfter running all tests, you should have verified:
- Installation complete with all files
- Configuration valid
- Registry read/write works
- Can send messages
- Can receive messages
- Message validation works
- Hooks configured
- Auto-processing policies work
- Automated test suite passes (17/17)
If all checkboxes checked → AEA is fully operational! ✅
- Troubleshooting - Detailed problem solving
- FAQ - Common questions
- Agent Guide - How to use AEA as an agent
- Examples - Real-world scenarios
If tests are failing or you've found a bug:
🐛 Report Bug - Use our bug report template
❓ Ask Question - Get help with testing
📖 FAQ - Check frequently asked questions first