An ElizaOS-powered AI assistant that provides accurate Arkansas ALICE (Asset Limited, Income Constrained, Employed) data through CSV-based actions and knowledge retrieval.
- CSV-Based Data Retrieval: Accurate county, subcounty, demographic, and employment data from CSV files
- County & City Queries: Search by county name, city, township, or zip code
- Comparison Analysis: Compare multiple counties with detailed breakdowns
- Demographic Data: Race, ethnicity, and household type breakdowns
- Employment Sectors: Industry-specific ALICE statistics
- Trend Analysis: Historical data tracking over time
- Statewide Statistics: Arkansas-wide ALICE metrics
- Knowledge Base: Conceptual ALICE information with retrieval system
- WordPress Integration: Optional custom chat widget for WordPress sites (see bottom of README)
Before installing, ensure you have the following installed on your machine:
-
Node.js (v18 or higher)
- Download from nodejs.org
- Verify installation:
node --version
-
npm (comes with Node.js)
- Verify installation:
npm --version
- Verify installation:
-
Git (for cloning the repository)
- Download from git-scm.com
- Verify installation:
git --version
- Bun (fast JavaScript runtime, alternative to npm)
- Install:
curl -fsSL https://bun.sh/install | bash - Verify:
bun --version
- Install:
git clone <repository-url>
cd my-agentUsing npm:
npm installOr using bun (faster):
bun installCreate a .env file in the root directory. For local development, you only need the required API keys:
# Required: OpenRouter API for text generation
OPENROUTER_API_KEY=your_openrouter_api_key_here
TEXT_MODEL=anthropic/claude-3.5-sonnet
# Required: OpenAI API for embeddings
OPENAI_API_KEY=your_openai_api_key_here
TEXT_EMBEDDING_MODEL=text-embedding-3-small
# Knowledge system configuration
KNOWLEDGE_PATH=./knowledge
LOAD_DOCS_ON_STARTUP=true
CTX_KNOWLEDGE_ENABLED=true
KNOWLEDGE_RETRIEVAL_ENABLED=true
USE_KNOWLEDGE_IN_RESPONSES=true
# Server configuration
SERVER_PORT=3000
LOG_LEVEL=infoNote: WordPress and Telegram settings are optional and only needed if you're integrating with those platforms. See the WordPress Integration section at the bottom of this README for those settings.
npm run buildOr with bun:
bun run buildDevelopment mode (with hot-reloading, recommended for local testing):
npm run devProduction mode:
npm startOnce the server is running, you can interact with Alice through:
-
ElizaOS CLI (recommended for local testing)
- The CLI will start automatically with
npm run dev - Type your queries directly in the terminal
- The CLI will start automatically with
-
Telegram Bot (if configured)
- Add your bot token to
.env - Message your bot on Telegram
- Add your bot token to
-
Direct API Calls
- Server runs on
http://localhost:3000by default - Use tools like Postman or curl to test endpoints
- Server runs on
Try these example queries:
- "Tell me about Pulaski County"
- "What is the ALICE threshold?"
- "Compare Benton County and Washington County"
- Visit openrouter.ai
- Sign up for an account
- Navigate to API Keys section
- Create a new API key
- Add to your
.envfile asOPENROUTER_API_KEY
- Visit platform.openai.com
- Sign up or log in
- Go to API Keys section
- Create a new secret key
- Add to your
.envfile asOPENAI_API_KEY
The project includes CSV data files in the data/ directory:
counties.csv- County-level ALICE statisticssubcounty.csv- City, town, and township datastatewide.csv- Arkansas-wide statisticsdemographics.csv- Demographic breakdownsemployment.csv- Employment sector datatrends.csv- Historical trend data
These files are loaded automatically on startup.
# Start with hot-reloading (recommended)
npm run dev
# Build the project
npm run build
# Start production server
npm start
# Type checking
npm run type-check
# Format code
npm run format
# Run tests
npm testmy-agent/
├── data/ # CSV data files
│ ├── counties.csv
│ ├── subcounty.csv
│ ├── statewide.csv
│ ├── demographics.csv
│ ├── employment.csv
│ └── trends.csv
├── knowledge/ # Knowledge base documents
│ └── info.md
├── src/
│ ├── character.ts # Character configuration
│ ├── index.ts # Main entry point
│ ├── plugins/
│ │ └── csv-analysis/ # CSV data plugin
│ │ ├── actions/ # Data retrieval actions
│ │ ├── services/ # CSV data service
│ │ └── index.ts
│ └── services/
│ └── chatApiService.ts # WordPress integration
├── .env # Environment variables
├── package.json
└── README.md
ElizaOS employs a dual testing strategy:
-
Component Tests (
src/__tests__/*.test.ts)- Run with Bun's native test runner
- Fast, isolated tests using mocks
- Perfect for TDD and component logic
-
E2E Tests (
src/__tests__/e2e/*.e2e.ts)- Run with ElizaOS custom test runner
- Real runtime with actual database (PGLite)
- Test complete user scenarios
src/
__tests__/ # All tests live inside src
*.test.ts # Component tests (use Bun test runner)
e2e/ # E2E tests (use ElizaOS test runner)
project-starter.e2e.ts # E2E test suite
README.md # E2E testing documentation
index.ts # Export tests here: tests: [ProjectStarterTestSuite]
elizaos test- Run all tests (component + e2e)elizaos test component- Run only component testselizaos test e2e- Run only E2E tests
Component tests use bun:test:
// Unit test example (__tests__/config.test.ts)
describe('Configuration', () => {
it('should load configuration correctly', () => {
expect(config.debug).toBeDefined();
});
});
// Integration test example (__tests__/integration.test.ts)
describe('Integration: Plugin with Character', () => {
it('should initialize character with plugins', async () => {
// Test interactions between components
});
});E2E tests use ElizaOS test interface:
// E2E test example (e2e/project.test.ts)
export class ProjectTestSuite implements TestSuite {
name = 'project_test_suite';
tests = [
{
name: 'project_initialization',
fn: async (runtime) => {
// Test project in a real runtime
},
},
];
}
export default new ProjectTestSuite();The test utilities in __tests__/utils/ provide helper functions to simplify writing tests.
Edit src/character.ts to customize:
- Character name and bio
- Personality traits
- Response style
- Plugin configuration
- Add CSV files to
data/directory - Update
src/plugins/csv-analysis/services/csvDataService.tsto load new data - Create new actions in
src/plugins/csv-analysis/actions/ - Register actions in
src/plugins/csv-analysis/index.ts
- Create a Railway account at railway.app
- Install Railway CLI:
npm install -g @railway/cli - Login:
railway login - Initialize:
railway init - Add environment variables in Railway dashboard
- Deploy:
railway up
Ensure all required environment variables are set in your deployment platform:
OPENROUTER_API_KEYOPENAI_API_KEYTEXT_MODELTEXT_EMBEDDING_MODELKNOWLEDGE_PATH=./knowledgeLOAD_DOCS_ON_STARTUP=trueCTX_KNOWLEDGE_ENABLED=true
User: "Tell me about Pulaski County"
User: "What's the ALICE rate in Benton?"
User: "Show me data for zip code 72701"
User: "Compare Benton County and Pulaski County"
User: "What's the difference between Washington and Sebastian counties?"
User: "What's the ALICE rate for Black households in Arkansas?"
User: "Show me Hispanic household data"
User: "What is the ALICE threshold?"
User: "How is ALICE calculated?"
User: "What does ALICE stand for?"
Issue: Build fails with TypeScript errors
- Solution: Run
npm installto ensure all dependencies are installed - Check that Node.js version is 18 or higher
Issue: "Cannot find module" errors
- Solution: Run
npm run buildto compile TypeScript - Check that all imports are correct
Issue: API keys not working
- Solution: Verify
.envfile exists and has correct keys - Ensure no extra spaces in
.envvalues - Restart the server after changing
.env
Issue: CSV data not loading
- Solution: Check that CSV files exist in
data/directory - Verify CSV file format matches expected schema
- Check console logs for parsing errors
For questions or issues:
- Check the troubleshooting section above
- Review ElizaOS documentation at docs.eliza.ai
- Contact the development team
If you want to add Alice to a WordPress website using a chat widget, follow these additional steps:
- Deploy the ElizaOS server to a public hosting service (Railway, Heroku, etc.)
- WordPress website with admin access
- WordPress plugin files (contact your admin for the Alice chat widget plugin)
First, deploy the server to a platform like Railway:
# Install Railway CLI
npm install -g @railway/cli
# Login to Railway
railway login
# Initialize your project
railway init
# Deploy
railway upAfter deployment, note your public URL (e.g., https://your-app.railway.app)
Add these variables to your deployed server's environment (in Railway dashboard or your hosting platform):
# WordPress API integration
WORDPRESS_API_URL=https://your-wordpress-site.com
WORDPRESS_API_SECRET=your_secret_key_here
# Optional: Telegram integration
TELEGRAM_BOT_TOKEN=your_telegram_bot_tokenImportant: Generate a strong secret key for WORDPRESS_API_SECRET. This will be used to authenticate requests between WordPress and your ElizaOS server.
- Download the Alice chat widget plugin files
- In WordPress admin, go to Plugins → Add New → Upload Plugin
- Upload the plugin ZIP file
- Activate the plugin
- Go to Settings → Alice Chat Widget
- Enter your configuration:
- API URL: Your deployed ElizaOS server URL (e.g.,
https://your-app.railway.app) - API Secret: The same secret key you set in
WORDPRESS_API_SECRET - Widget Position: Choose where the chat icon appears
- Custom Styling: Optional CSS customization
- API URL: Your deployed ElizaOS server URL (e.g.,
- Save settings
- Visit your WordPress site (logged out to see the public view)
- Look for the chat widget icon (usually bottom right)
- Click to open and try queries:
- "What is the ALICE threshold?"
- "Tell me about Pulaski County"
- "Compare Benton and Washington counties"
Issue: Chat widget not appearing
- Verify plugin is activated
- Check browser console for JavaScript errors
- Ensure API URL is correct (no trailing slash)
Issue: "Connection failed" or "Unable to connect" errors
- Verify your ElizaOS server is running and accessible
- Check
WORDPRESS_API_SECRETmatches in both .env and WordPress settings - Ensure CORS is enabled on your server for your WordPress domain
Issue: Responses are slow or timing out
- Check your hosting plan limits (Railway free tier has restrictions)
- Verify OpenRouter/OpenAI API keys have sufficient credits
- Check server logs for errors
- Never commit your
WORDPRESS_API_SECRETto version control - Use environment variables for all sensitive data
- Implement rate limiting if you expect high traffic
- Regularly rotate your API secret
- Monitor API usage to prevent abuse
This project is built on ElizaOS. See LICENSE file for details.