Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created March 6, 2025 15:16
Show Gist options
  • Save andrewxhill/34c732449442b30100cb94444145f952 to your computer and use it in GitHub Desktop.
Save andrewxhill/34c732449442b30100cb94444145f952 to your computer and use it in GitHub Desktop.
setup script for recall agent starter kit
#!/bin/bash
# Colors for better readability
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${BLUE}======================================================${NC}"
echo -e "${BLUE} Recall Agent Starter Kit Setup Script ${NC}"
echo -e "${BLUE}======================================================${NC}"
# Check for required tools
echo -e "\n${YELLOW}Checking prerequisites...${NC}"
# Check for Node.js
if ! command -v node &> /dev/null; then
echo -e "${RED}Node.js is not installed. Please install Node.js v22 or later.${NC}"
echo -e "Visit: https://nodejs.org/en/download/"
exit 1
fi
NODE_VERSION=$(node -v | cut -d'.' -f1 | sed 's/v//')
if [[ $NODE_VERSION -lt 22 ]]; then
echo -e "${RED}Node.js version 22 or later is required. You have version $NODE_VERSION.${NC}"
echo -e "Please upgrade your Node.js installation."
exit 1
fi
echo -e "${GREEN}✓ Node.js v$(node -v) is installed${NC}"
# Check for pnpm
if ! command -v pnpm &> /dev/null; then
echo -e "${YELLOW}pnpm is not installed. Would you like to install it? (y/n)${NC}"
read -r install_pnpm
if [[ $install_pnpm == "y" ]]; then
echo "Installing pnpm..."
npm install -g pnpm
else
echo -e "${RED}pnpm is required to continue. Please install manually and run this script again.${NC}"
echo -e "You can install pnpm with: npm install -g pnpm"
exit 1
fi
fi
echo -e "${GREEN}✓ pnpm is installed${NC}"
# Install dependencies
echo -e "\n${YELLOW}Installing dependencies...${NC}"
pnpm install
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to install dependencies. Please check the error message above.${NC}"
exit 1
fi
echo -e "${GREEN}✓ Dependencies installed successfully${NC}"
# Create .env file if it doesn't exist
if [ ! -f .env ]; then
echo -e "\n${YELLOW}Creating .env file...${NC}"
if [ -f .env.example.simple ]; then
cp .env.example.simple .env
elif [ -f .env.example ]; then
cp .env.example .env
else
touch .env
fi
echo -e "\n${YELLOW}Setting up API keys for language models...${NC}"
echo -e "You'll need at least one API key to use language models with your agent."
# Ask for OpenAI API key
echo -e "\n${BLUE}Would you like to use OpenAI models? (y/n)${NC}"
read -r use_openai
if [[ $use_openai == "y" ]]; then
echo -e "${YELLOW}Please enter your OpenAI API key:${NC}"
read -r openai_key
echo "OPENAI_API_KEY=$openai_key" >> .env
echo -e "${GREEN}✓ OpenAI API key added${NC}"
fi
# Ask for Anthropic API key
echo -e "\n${BLUE}Would you like to use Anthropic models? (y/n)${NC}"
read -r use_anthropic
if [[ $use_anthropic == "y" ]]; then
echo -e "${YELLOW}Please enter your Anthropic API key:${NC}"
read -r anthropic_key
echo "ANTHROPIC_API_KEY=$anthropic_key" >> .env
echo -e "${GREEN}✓ Anthropic API key added${NC}"
fi
# Ask for Recall settings
echo -e "\n${BLUE}Would you like to set up Recall Storage integration? (y/n)${NC}"
read -r use_recall
if [[ $use_recall == "y" ]]; then
echo -e "${YELLOW}Setting up Recall Storage integration${NC}"
echo -e "${YELLOW}Please visit https://portal.recall.network/ to create an account and bucket${NC}"
echo -e "\n${YELLOW}Enter your Recall private key (from faucet):${NC}"
read -r recall_key
echo -e "${YELLOW}Enter your bucket name:${NC}"
read -r bucket_name
echo "RECALL_PRIVATE_KEY=$recall_key" >> .env
echo "RECALL_BUCKET_NAME=$bucket_name" >> .env
echo -e "${GREEN}✓ Recall Storage settings added${NC}"
echo -e "\n${YELLOW}Do you need to get tokens from the Recall faucet? (y/n)${NC}"
read -r need_faucet
if [[ $need_faucet == "y" ]]; then
echo -e "${BLUE}Please visit: ${YELLOW}https://faucet.recall.network/${NC}"
echo -e "${BLUE}Using your private key: ${YELLOW}$recall_key${NC}"
echo -e "${BLUE}to receive tokens for storage operations.${NC}"
echo -e "${YELLOW}Press Enter once you've received tokens from the faucet${NC}"
read -r
fi
fi
# Set default model
echo -e "\n${YELLOW}Setting default model...${NC}"
if [[ $use_openai == "y" ]]; then
echo "DEFAULT_MODEL=gpt-4o" >> .env
echo -e "${GREEN}✓ Default model set to gpt-4o${NC}"
elif [[ $use_anthropic == "y" ]]; then
echo "DEFAULT_MODEL=claude-3-opus-20240229" >> .env
echo -e "${GREEN}✓ Default model set to claude-3-opus${NC}"
else
echo "DEFAULT_MODEL=gpt-4o" >> .env
echo -e "${YELLOW}⚠ Default model set to gpt-4o, but no API key provided${NC}"
fi
echo "CACHE_STORE=FS" >> .env
echo "DATABASE=sqlite" >> .env
echo "SERVER_PORT=3000" >> .env
fi
echo -e "\n${GREEN}======================================================${NC}"
echo -e "${GREEN} Setup completed successfully! ${NC}"
echo -e "${GREEN}======================================================${NC}"
echo -e "\n${BLUE}To start your agent, run:${NC}"
echo -e "${YELLOW} pnpm start${NC}"
echo -e "\n${BLUE}To use a specific character:${NC}"
echo -e "${YELLOW} pnpm start --character=nova${NC}"
echo -e "\n${BLUE}Available characters:${NC}"
ls -1 characters/*.character.json | sed 's|characters/||' | sed 's|.character.json||' | while read char; do
echo -e "${YELLOW} - $char${NC}"
done
echo -e "\n${BLUE}For more information, visit:${NC}"
echo -e "${YELLOW} https://docs.recall.network/docs/agents/index${NC}"
echo -e "${YELLOW} https://docs.recall.network/docs/tools/sdk/javascript${NC}"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment