feat: Add intelligent auto-router and enhanced integrations
- Add intelligent-router.sh hook for automatic agent routing - Add AUTO-TRIGGER-SUMMARY.md documentation - Add FINAL-INTEGRATION-SUMMARY.md documentation - Complete Prometheus integration (6 commands + 4 tools) - Complete Dexto integration (12 commands + 5 tools) - Enhanced Ralph with access to all agents - Fix /clawd command (removed disable-model-invocation) - Update hooks.json to v5 with intelligent routing - 291 total skills now available - All 21 commands with automatic routing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
35
dexto/agents/database-agent/README.md
Normal file
35
dexto/agents/database-agent/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Database Agent
|
||||
|
||||
An AI agent that provides natural language access to database operations and analytics. This approach changes how we interact with data - instead of learning SQL syntax, building query interfaces, or designing complex dashboards, users can simply ask for what they need in natural language.
|
||||
|
||||
## Setup
|
||||
|
||||
```bash
|
||||
cd database-agent
|
||||
./setup-database.sh
|
||||
npm start -- --agent database-agent.yml
|
||||
```
|
||||
|
||||
## Example Interactions
|
||||
|
||||
- "Show me all users"
|
||||
- "Create a new user named John Doe with email john@example.com"
|
||||
- "Find products under $100"
|
||||
- "Generate a sales report by category"
|
||||
|
||||
## Capabilities
|
||||
|
||||
- **Data Queries**: Natural language database queries and reporting
|
||||
- **Data Management**: Create, update, and delete records
|
||||
- **Analytics**: Generate insights and business intelligence
|
||||
- **Schema Operations**: Table creation and database structure management
|
||||
|
||||
## How It Works
|
||||
|
||||
The agent connects to a SQLite database via MCP server and:
|
||||
- Interprets natural language requests into SQL queries
|
||||
- Validates data before operations
|
||||
- Provides formatted results and insights
|
||||
- Handles errors gracefully with helpful suggestions
|
||||
|
||||
This agent demonstrates intelligent database interaction through conversation.
|
||||
BIN
dexto/agents/database-agent/data/example.db
Normal file
BIN
dexto/agents/database-agent/data/example.db
Normal file
Binary file not shown.
98
dexto/agents/database-agent/database-agent-example.sql
Normal file
98
dexto/agents/database-agent/database-agent-example.sql
Normal file
@@ -0,0 +1,98 @@
|
||||
-- Sample database schema and data for the Database Interaction Agent
|
||||
-- This demonstrates the types of operations the agent can perform
|
||||
|
||||
-- Create users table
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
email TEXT UNIQUE NOT NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
last_login DATETIME,
|
||||
is_active BOOLEAN DEFAULT 1
|
||||
);
|
||||
|
||||
-- Create products table
|
||||
CREATE TABLE IF NOT EXISTS products (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
description TEXT,
|
||||
price DECIMAL(10,2) NOT NULL,
|
||||
category TEXT NOT NULL,
|
||||
stock_quantity INTEGER DEFAULT 0,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Create orders table
|
||||
CREATE TABLE IF NOT EXISTS orders (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER NOT NULL,
|
||||
total_amount DECIMAL(10,2) NOT NULL,
|
||||
status TEXT DEFAULT 'pending',
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id)
|
||||
);
|
||||
|
||||
-- Create order_items table
|
||||
CREATE TABLE IF NOT EXISTS order_items (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
order_id INTEGER NOT NULL,
|
||||
product_id INTEGER NOT NULL,
|
||||
quantity INTEGER NOT NULL,
|
||||
unit_price DECIMAL(10,2) NOT NULL,
|
||||
FOREIGN KEY (order_id) REFERENCES orders(id),
|
||||
FOREIGN KEY (product_id) REFERENCES products(id)
|
||||
);
|
||||
|
||||
-- Insert sample users
|
||||
INSERT INTO users (name, email) VALUES
|
||||
('John Doe', 'john@example.com'),
|
||||
('Jane Smith', 'jane@example.com'),
|
||||
('Bob Johnson', 'bob@example.com'),
|
||||
('Alice Brown', 'alice@example.com'),
|
||||
('Charlie Wilson', 'charlie@example.com');
|
||||
|
||||
-- Insert sample products
|
||||
INSERT INTO products (name, description, price, category, stock_quantity) VALUES
|
||||
('Laptop', 'High-performance laptop for professionals', 899.99, 'Electronics', 15),
|
||||
('Smartphone', 'Latest smartphone with advanced features', 699.99, 'Electronics', 25),
|
||||
('Coffee Maker', 'Automatic coffee maker for home use', 89.99, 'Home & Kitchen', 30),
|
||||
('Running Shoes', 'Comfortable running shoes for athletes', 129.99, 'Sports', 20),
|
||||
('Backpack', 'Durable backpack for daily use', 49.99, 'Fashion', 40),
|
||||
('Bluetooth Speaker', 'Portable wireless speaker', 79.99, 'Electronics', 18),
|
||||
('Yoga Mat', 'Non-slip yoga mat for fitness', 29.99, 'Sports', 35),
|
||||
('Desk Lamp', 'LED desk lamp with adjustable brightness', 39.99, 'Home & Kitchen', 22);
|
||||
|
||||
-- Insert sample orders
|
||||
INSERT INTO orders (user_id, total_amount, status) VALUES
|
||||
(1, 899.99, 'completed'),
|
||||
(2, 209.98, 'completed'),
|
||||
(3, 159.98, 'pending'),
|
||||
(4, 699.99, 'completed'),
|
||||
(5, 89.99, 'shipped');
|
||||
|
||||
-- Insert sample order items
|
||||
INSERT INTO order_items (order_id, product_id, quantity, unit_price) VALUES
|
||||
(1, 1, 1, 899.99), -- John bought a laptop
|
||||
(2, 3, 1, 89.99), -- Jane bought a coffee maker
|
||||
(2, 7, 1, 29.99), -- Jane also bought a yoga mat
|
||||
(2, 8, 1, 39.99), -- Jane also bought a desk lamp
|
||||
(3, 5, 1, 49.99), -- Bob bought a backpack
|
||||
(3, 6, 1, 79.99), -- Bob also bought a bluetooth speaker
|
||||
(3, 8, 1, 39.99), -- Bob also bought a desk lamp
|
||||
(4, 2, 1, 699.99), -- Alice bought a smartphone
|
||||
(5, 3, 1, 89.99); -- Charlie bought a coffee maker
|
||||
|
||||
-- Update some user last_login times
|
||||
UPDATE users SET last_login = datetime('now', '-1 day') WHERE id = 1;
|
||||
UPDATE users SET last_login = datetime('now', '-3 days') WHERE id = 2;
|
||||
UPDATE users SET last_login = datetime('now', '-7 days') WHERE id = 3;
|
||||
UPDATE users SET last_login = datetime('now', '-2 days') WHERE id = 4;
|
||||
UPDATE users SET last_login = datetime('now', '-5 days') WHERE id = 5;
|
||||
|
||||
-- Create indexes for better performance
|
||||
CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);
|
||||
CREATE INDEX IF NOT EXISTS idx_products_category ON products(category);
|
||||
CREATE INDEX IF NOT EXISTS idx_orders_user_id ON orders(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_orders_status ON orders(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_order_items_order_id ON order_items(order_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_order_items_product_id ON order_items(product_id);
|
||||
166
dexto/agents/database-agent/database-agent.yml
Normal file
166
dexto/agents/database-agent/database-agent.yml
Normal file
@@ -0,0 +1,166 @@
|
||||
# Database Interaction Agent
|
||||
# This agent demonstrates an alternative approach to building database interfaces
|
||||
# Instead of traditional web UIs with forms and buttons, this agent provides
|
||||
# natural language interaction with database operations through MCP tools
|
||||
|
||||
mcpServers:
|
||||
# SQLite database server for direct database interaction
|
||||
sqlite:
|
||||
type: stdio
|
||||
command: npx
|
||||
args:
|
||||
- -y
|
||||
- "@executeautomation/database-server"
|
||||
- "${{dexto.agent_dir}}/data/example.db"
|
||||
timeout: 30000
|
||||
connectionMode: strict
|
||||
|
||||
# Filesystem access for database file management and schema inspection
|
||||
filesystem:
|
||||
type: stdio
|
||||
command: npx
|
||||
args:
|
||||
- -y
|
||||
- "@modelcontextprotocol/server-filesystem"
|
||||
- .
|
||||
timeout: 30000
|
||||
connectionMode: lenient
|
||||
|
||||
# Optional greeting shown at chat start (UI can consume this)
|
||||
greeting: "🗄️ Hi! I'm your Database Agent. What would you like to explore?"
|
||||
|
||||
# System prompt that defines the agent's database interaction capabilities
|
||||
systemPrompt:
|
||||
contributors:
|
||||
- id: primary
|
||||
type: static
|
||||
priority: 0
|
||||
content: |
|
||||
You are a Database Interaction Agent that provides natural language access to database operations
|
||||
and analytics. You orchestrate database operations through intelligent conversation and tool usage.
|
||||
|
||||
## Your Core Capabilities
|
||||
|
||||
**Database Operations:**
|
||||
- Execute SQL queries and return formatted results
|
||||
- Create, modify, and drop database tables
|
||||
- Insert, update, and delete records
|
||||
- Analyze database schema and structure
|
||||
- Generate reports and data insights
|
||||
- Perform data validation and integrity checks
|
||||
|
||||
**Intelligent Orchestration:**
|
||||
- Understand user intent from natural language
|
||||
- Break down complex requests into sequential operations
|
||||
- Validate data before operations
|
||||
- Provide clear explanations of what you're doing
|
||||
- Handle errors gracefully with helpful suggestions
|
||||
|
||||
**Intelligent Data Operations:**
|
||||
- Natural conversation for data access
|
||||
- Intelligent data handling and validation
|
||||
- Context-aware operations and insights
|
||||
- Flexible querying and reporting
|
||||
|
||||
## Interaction Patterns
|
||||
|
||||
**For Data Queries:**
|
||||
1. Understand what the user wants to know
|
||||
2. Formulate appropriate SQL queries
|
||||
3. Execute and format results clearly
|
||||
4. Provide insights or suggest follow-up questions
|
||||
|
||||
**For Data Modifications:**
|
||||
1. Confirm the user's intent
|
||||
2. Validate data integrity
|
||||
3. Execute the operation safely
|
||||
4. Confirm success and show results
|
||||
|
||||
**For Schema Operations:**
|
||||
1. Analyze current structure
|
||||
2. Plan the changes needed
|
||||
3. Execute modifications
|
||||
4. Verify the new structure
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Always explain what you're doing before doing it
|
||||
- Show sample data when creating tables
|
||||
- Validate user input before database operations
|
||||
- Provide helpful error messages and suggestions
|
||||
- Use transactions for multi-step operations
|
||||
- Keep responses concise but informative
|
||||
|
||||
## Example Interactions
|
||||
|
||||
User: "Create a users table with name, email, and created_at fields"
|
||||
You: "I'll create a users table with the specified fields. Let me set this up for you..."
|
||||
|
||||
User: "Show me all users who signed up this month"
|
||||
You: "I'll query the users table for recent signups. Let me get that information..."
|
||||
|
||||
User: "Add a new user named John Doe with email john@example.com"
|
||||
You: "I'll insert a new user record for John Doe. Let me add that to the database..."
|
||||
|
||||
Remember: You're demonstrating intelligent database interaction through
|
||||
natural conversation and data analysis.
|
||||
|
||||
- id: date
|
||||
type: dynamic
|
||||
priority: 10
|
||||
source: date
|
||||
enabled: true
|
||||
|
||||
# Storage configuration
|
||||
storage:
|
||||
cache:
|
||||
type: in-memory
|
||||
database:
|
||||
type: sqlite
|
||||
blob:
|
||||
type: local # CLI provides storePath automatically
|
||||
maxBlobSize: 52428800 # 50MB per blob
|
||||
maxTotalSize: 1073741824 # 1GB total storage
|
||||
cleanupAfterDays: 30
|
||||
|
||||
# LLM configuration for intelligent database interactions
|
||||
llm:
|
||||
provider: openai
|
||||
model: gpt-5-mini
|
||||
apiKey: $OPENAI_API_KEY
|
||||
temperature: 0.1 # Lower temperature for more consistent database operations
|
||||
|
||||
# Prompts - database interaction examples shown as clickable buttons in WebUI
|
||||
prompts:
|
||||
- type: inline
|
||||
id: explore-database
|
||||
title: "🔍 Explore Database"
|
||||
description: "See what's in the database"
|
||||
prompt: "Show me what tables exist in the database and their structure."
|
||||
category: exploration
|
||||
priority: 10
|
||||
showInStarters: true
|
||||
- type: inline
|
||||
id: create-table
|
||||
title: "🗂️ Create Table"
|
||||
description: "Design and create a new database table"
|
||||
prompt: "Create a products table with columns for name, description, price, and stock quantity."
|
||||
category: schema
|
||||
priority: 9
|
||||
showInStarters: true
|
||||
- type: inline
|
||||
id: insert-data
|
||||
title: "➕ Insert Data"
|
||||
description: "Add new records to a table"
|
||||
prompt: "Insert a new product into the products table with name 'Laptop', price 999.99, and stock 15."
|
||||
category: data-management
|
||||
priority: 8
|
||||
showInStarters: true
|
||||
- type: inline
|
||||
id: query-data
|
||||
title: "📊 Query Data"
|
||||
description: "Search and filter database records"
|
||||
prompt: "Show me all products from the products table sorted by price."
|
||||
category: queries
|
||||
priority: 7
|
||||
showInStarters: true
|
||||
64
dexto/agents/database-agent/setup-database.sh
Executable file
64
dexto/agents/database-agent/setup-database.sh
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit immediately on errors, unset variables, or pipeline failures
|
||||
set -euo pipefail
|
||||
|
||||
# Get the directory where this script is located
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Setup script for Database Interaction Agent
|
||||
# This script creates the data directory and initializes the database with sample data
|
||||
|
||||
echo "🚀 Setting up Database Interaction Agent..."
|
||||
|
||||
# Create data directory if it doesn't exist
|
||||
echo "📁 Creating data directory..."
|
||||
mkdir -p "${SCRIPT_DIR}/data"
|
||||
|
||||
# Check if SQLite is available
|
||||
if ! command -v sqlite3 &> /dev/null; then
|
||||
echo "❌ SQLite3 is not installed. Please install SQLite3 first:"
|
||||
echo " macOS: brew install sqlite3"
|
||||
echo " Ubuntu/Debian: sudo apt-get install sqlite3"
|
||||
echo " Windows: Download from https://www.sqlite.org/download.html"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize database with sample data
|
||||
echo "🗄️ Initializing database with sample data..."
|
||||
|
||||
# Remove existing database if it exists to avoid constraint violations
|
||||
if [ -f "${SCRIPT_DIR}/data/example.db" ]; then
|
||||
echo "🗑️ Removing existing database..."
|
||||
rm "${SCRIPT_DIR}/data/example.db"
|
||||
fi
|
||||
|
||||
sqlite3 "${SCRIPT_DIR}/data/example.db" < "${SCRIPT_DIR}/database-agent-example.sql"
|
||||
|
||||
# Verify the database was created successfully
|
||||
if [ -f "${SCRIPT_DIR}/data/example.db" ]; then
|
||||
echo "✅ Database created successfully!"
|
||||
|
||||
# Show some basic stats
|
||||
echo "📊 Database statistics:"
|
||||
echo " Tables: $(sqlite3 "${SCRIPT_DIR}/data/example.db" "SELECT COUNT(*) FROM sqlite_master WHERE type='table';")"
|
||||
echo " Users: $(sqlite3 "${SCRIPT_DIR}/data/example.db" "SELECT COUNT(*) FROM users;")"
|
||||
echo " Products: $(sqlite3 "${SCRIPT_DIR}/data/example.db" "SELECT COUNT(*) FROM products;")"
|
||||
echo " Orders: $(sqlite3 "${SCRIPT_DIR}/data/example.db" "SELECT COUNT(*) FROM orders;")"
|
||||
|
||||
echo ""
|
||||
echo "🎉 Database setup complete!"
|
||||
echo ""
|
||||
echo "You can now run the Database Interaction Agent with:"
|
||||
echo " dexto --agent agents/database-agent.yml"
|
||||
echo ""
|
||||
echo "Example interactions you can try:"
|
||||
echo " - 'Show me all users'"
|
||||
echo " - 'List products under \$100'"
|
||||
echo " - 'Create a new user named Test User with email test@example.com'"
|
||||
echo " - 'Show me total sales by category'"
|
||||
echo " - 'Find users who haven't logged in for more than 5 days'"
|
||||
else
|
||||
echo "❌ Failed to create database. Please check the SQL file and try again."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user