Initial commit
This commit is contained in:
44
scripts/create-agent.sh
Executable file
44
scripts/create-agent.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
# Create ElevenLabs agent using CLI
|
||||
|
||||
set -e
|
||||
|
||||
AGENT_NAME="${1:-Support Agent}"
|
||||
TEMPLATE="${2:-customer-service}"
|
||||
ENV="${3:-dev}"
|
||||
|
||||
echo "Creating ElevenLabs agent..."
|
||||
echo "Name: $AGENT_NAME"
|
||||
echo "Template: $TEMPLATE"
|
||||
echo "Environment: $ENV"
|
||||
|
||||
# Check if CLI is installed
|
||||
if ! command -v elevenlabs &> /dev/null; then
|
||||
echo "Error: @elevenlabs/cli is not installed"
|
||||
echo "Install with: npm install -g @elevenlabs/cli"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if authenticated
|
||||
if ! elevenlabs auth whoami &> /dev/null; then
|
||||
echo "Not authenticated. Please login:"
|
||||
elevenlabs auth login
|
||||
fi
|
||||
|
||||
# Initialize project if not already initialized
|
||||
if [ ! -f "agents.json" ]; then
|
||||
echo "Initializing project..."
|
||||
elevenlabs agents init
|
||||
fi
|
||||
|
||||
# Create agent
|
||||
echo "Creating agent: $AGENT_NAME"
|
||||
elevenlabs agents add "$AGENT_NAME" --template "$TEMPLATE"
|
||||
|
||||
# Push to platform
|
||||
echo "Deploying to environment: $ENV"
|
||||
elevenlabs agents push --env "$ENV"
|
||||
|
||||
echo "✓ Agent created successfully!"
|
||||
echo "Edit configuration in: agent_configs/"
|
||||
echo "Test with: elevenlabs agents test \"$AGENT_NAME\""
|
||||
46
scripts/deploy-agent.sh
Executable file
46
scripts/deploy-agent.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
# Multi-environment deployment for ElevenLabs agents
|
||||
|
||||
set -e
|
||||
|
||||
ENV="${1:-dev}"
|
||||
AGENT_NAME="${2}"
|
||||
|
||||
echo "Deploying ElevenLabs agent to environment: $ENV"
|
||||
|
||||
# Check if CLI is installed
|
||||
if ! command -v elevenlabs &> /dev/null; then
|
||||
echo "Error: @elevenlabs/cli is not installed"
|
||||
echo "Install with: npm install -g @elevenlabs/cli"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if authenticated
|
||||
if ! elevenlabs auth whoami &> /dev/null; then
|
||||
echo "Not authenticated. Please login:"
|
||||
elevenlabs auth login
|
||||
fi
|
||||
|
||||
# Dry run first to show changes
|
||||
echo "Preview of changes for $ENV:"
|
||||
if [ -n "$AGENT_NAME" ]; then
|
||||
elevenlabs agents push --env "$ENV" --agent "$AGENT_NAME" --dry-run
|
||||
else
|
||||
elevenlabs agents push --env "$ENV" --dry-run
|
||||
fi
|
||||
|
||||
# Confirm deployment
|
||||
read -p "Deploy to $ENV? (y/n) " -n 1 -r
|
||||
echo
|
||||
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
if [ -n "$AGENT_NAME" ]; then
|
||||
elevenlabs agents push --env "$ENV" --agent "$AGENT_NAME"
|
||||
else
|
||||
elevenlabs agents push --env "$ENV"
|
||||
fi
|
||||
echo "✓ Deployment to $ENV completed successfully!"
|
||||
else
|
||||
echo "Deployment cancelled"
|
||||
exit 0
|
||||
fi
|
||||
53
scripts/simulate-conversation.sh
Executable file
53
scripts/simulate-conversation.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
# Programmatically simulate conversation for testing
|
||||
|
||||
set -e
|
||||
|
||||
AGENT_ID="${1}"
|
||||
SIMULATION_FILE="${2:-simulation.json}"
|
||||
|
||||
if [ -z "$AGENT_ID" ]; then
|
||||
echo "Usage: ./simulate-conversation.sh <agent_id> [simulation_file]"
|
||||
echo "Example: ./simulate-conversation.sh agent_abc123 simulation.json"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if API key is set
|
||||
if [ -z "$ELEVENLABS_API_KEY" ]; then
|
||||
echo "Error: ELEVENLABS_API_KEY environment variable not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if simulation file exists
|
||||
if [ ! -f "$SIMULATION_FILE" ]; then
|
||||
echo "Creating example simulation file: $SIMULATION_FILE"
|
||||
cat > "$SIMULATION_FILE" << 'EOF'
|
||||
{
|
||||
"scenario": "Customer requests refund",
|
||||
"user_messages": [
|
||||
"I want a refund for order #12345",
|
||||
"I ordered it last week",
|
||||
"Yes, please process it"
|
||||
],
|
||||
"success_criteria": [
|
||||
"Agent acknowledges request",
|
||||
"Agent asks for order details",
|
||||
"Agent provides refund timeline"
|
||||
]
|
||||
}
|
||||
EOF
|
||||
echo "Example simulation file created. Edit $SIMULATION_FILE and run again."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Running conversation simulation..."
|
||||
echo "Agent ID: $AGENT_ID"
|
||||
echo "Simulation file: $SIMULATION_FILE"
|
||||
|
||||
# Run simulation
|
||||
curl -X POST "https://api.elevenlabs.io/v1/convai/agents/$AGENT_ID/simulate" \
|
||||
-H "xi-api-key: $ELEVENLABS_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @"$SIMULATION_FILE" | jq .
|
||||
|
||||
echo "✓ Simulation completed!"
|
||||
33
scripts/test-agent.sh
Executable file
33
scripts/test-agent.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Run automated tests on ElevenLabs agent
|
||||
|
||||
set -e
|
||||
|
||||
AGENT_NAME="${1:-Support Agent}"
|
||||
|
||||
echo "Testing ElevenLabs agent: $AGENT_NAME"
|
||||
|
||||
# Check if CLI is installed
|
||||
if ! command -v elevenlabs &> /dev/null; then
|
||||
echo "Error: @elevenlabs/cli is not installed"
|
||||
echo "Install with: npm install -g @elevenlabs/cli"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if authenticated
|
||||
if ! elevenlabs auth whoami &> /dev/null; then
|
||||
echo "Not authenticated. Please login:"
|
||||
elevenlabs auth login
|
||||
fi
|
||||
|
||||
# Push tests to platform
|
||||
if [ -f "tests.json" ]; then
|
||||
echo "Deploying tests..."
|
||||
elevenlabs tests push
|
||||
fi
|
||||
|
||||
# Run agent tests
|
||||
echo "Running tests for: $AGENT_NAME"
|
||||
elevenlabs agents test "$AGENT_NAME"
|
||||
|
||||
echo "✓ Tests completed!"
|
||||
Reference in New Issue
Block a user