5.5 KiB
5.5 KiB
🚀 AgentDB CLI - Quick Testing Guide
⚠️ Important: Two Different AgentDB Versions
There are TWO different agentdb commands:
-
OLD AgentDB (v1.0.12) - The original vector database with ASCII banner
- Located:
npx agentdb(globally installed) - Shows: ASCII art banner
- Located:
-
NEW AgentDB CLI (v1.7.2) - Frontier features with 17 commands
- Located:
node dist/agentdb/cli/agentdb-cli.js - Shows: "AgentDB CLI - Frontier Memory Features"
- Located:
🎯 Testing the NEW CLI (Frontier Features)
Method 1: Direct Node Execution (Recommended)
# Make sure you're in the project directory
cd /workspaces/agentic-flow/agentic-flow
# Test help command
node dist/agentdb/cli/agentdb-cli.js --help
# Should show:
# AgentDB CLI - Frontier Memory Features
#
# USAGE:
# agentdb <command> <subcommand> [options]
#
# CAUSAL COMMANDS:
# ...
Method 2: Run the Test Suite
# Automated test of all 13 features
./scripts/test-agentdb.sh
Method 3: Link Locally to Override Global
# Unlink old version
npm unlink -g agentdb
# Link new version from this directory
npm link
# Now npx will use the new CLI
npx agentdb --help
🧪 Quick Manual Test
# Set test database
export AGENTDB_PATH=./my-test.db
# Store an episode
node dist/agentdb/cli/agentdb-cli.js reflexion store \
"session-1" \
"test_task" \
0.95 \
true \
"It worked!" \
"input" \
"output" \
1000 \
500
# Retrieve it
node dist/agentdb/cli/agentdb-cli.js reflexion retrieve \
"test_task" \
5 \
0.5
# Check stats
node dist/agentdb/cli/agentdb-cli.js db stats
📊 What's New in the CLI?
17 Commands Across 6 Controllers:
-
Reflexion Memory (4 commands) - Episodic replay with self-critique
reflexion store- Store episodes with critiquesreflexion retrieve- Retrieve relevant episodesreflexion critique-summary- Get failure lessonsreflexion prune- Clean up old episodes
-
Skill Library (4 commands) - Lifelong learning
skill create- Create reusable skillsskill search- Find applicable skillsskill consolidate- Auto-create from episodesskill prune- Remove underperforming skills
-
Causal Memory Graph (5 commands) - Intervention-based causality
causal add-edge- Add causal relationshipscausal experiment create- Create A/B experimentscausal experiment add-observation- Record observationscausal experiment calculate- Calculate upliftcausal query- Query causal edges
-
Causal Recall (1 command) - Utility-based reranking
recall with-certificate- Retrieve with provenance
-
Nightly Learner (2 commands) - Automated discovery
learner run- Discover causal patternslearner prune- Remove low-quality edges
-
Database (1 command) - Statistics
db stats- Show database info
🔍 Verify You're Using the New CLI
Wrong (Old CLI with ASCII art):
$ npx agentdb --help
█▀█ █▀▀ █▀▀ █▄░█ ▀█▀ █▀▄ █▄▄
█▀█ █▄█ ██▄ █░▀█ ░█░ █▄▀ █▄█
AgentDB v1.0.12 - Agent Memory & Vector Database
Correct (New CLI with Frontier Features):
$ node dist/agentdb/cli/agentdb-cli.js --help
AgentDB CLI - Frontier Memory Features
USAGE:
agentdb <command> <subcommand> [options]
CAUSAL COMMANDS:
agentdb causal add-edge <cause> <effect> <uplift> [confidence] [sample-size]
🎮 Interactive Examples
Example 1: Learn from Code Reviews
# Store a successful review
node dist/agentdb/cli/agentdb-cli.js reflexion store \
"review-1" "add_error_handling" 0.90 true \
"Used try-catch with specific error types" \
"Handle edge cases" "Robust error handling" 1500 4000
# Store a failed review
node dist/agentdb/cli/agentdb-cli.js reflexion store \
"review-1" "add_error_handling" 0.30 false \
"Caught generic errors without logging" \
"Handle edge cases" "Poor error handling" 800 2000
# Get critique summary
node dist/agentdb/cli/agentdb-cli.js reflexion critique-summary \
"error_handling" true
Example 2: Build a Skill Library
# Create a skill
node dist/agentdb/cli/agentdb-cli.js skill create \
"error_handling_pattern" \
"Robust error handling with logging and specific error types" \
"try { ... } catch (err) { logger.error(err); throw new CustomError(); }"
# Search for it
node dist/agentdb/cli/agentdb-cli.js skill search \
"error handling" 5
Example 3: Causal Analysis
# Add a causal edge
node dist/agentdb/cli/agentdb-cli.js causal add-edge \
"add_type_hints" "reduce_runtime_errors" 0.35 0.88 75
# Query causal effects
node dist/agentdb/cli/agentdb-cli.js causal query \
"type" "error" 0.7 0.2 10
🐛 Troubleshooting
"Cannot find module"
# Check you're in the right directory
pwd # Should show: /workspaces/agentic-flow/agentic-flow
# Verify file exists
ls dist/agentdb/cli/agentdb-cli.js
# Rebuild if needed
npm run build
"Shows old ASCII banner"
# You're using the old global package
# Use direct node execution instead:
node dist/agentdb/cli/agentdb-cli.js --help
"Database is locked"
# Use a different database file
export AGENTDB_PATH=./test-$(date +%s).db
📚 Full Documentation
See docs/AGENTDB_TESTING.md for comprehensive examples and API details.
🚀 Next Steps
- ✅ Run
./scripts/test-agentdb.shfor full feature test - ✅ Try the examples above
- ✅ Check
docs/AGENTDB_TESTING.mdfor more - ✅ Integrate into your agent workflows!