Development Setup

This guide will help you set up the BILL AI Agent development environment.

Prerequisites

  • Bun (v1.0+) - Fast JavaScript runtime (NOT npm/Node.js)

  • PostgreSQL (via Supabase)

  • Git

  • Code Editor (VS Code recommended)

Environment Setup

1. Clone the Repository

git clone https://github.com/your-org/bill-agent.git
cd bill-agent

2. Install Dependencies

# Install all dependencies using Bun
bun install

# Navigate to agent directory and install
cd agent
bun install

# Install website dependencies
cd ../clients/website
bun install

# Install API server dependencies
cd ../bill-api-server
bun install

3. Environment Variables

Create .env file in the project root:

4. Database Setup

Create Supabase Project

  1. Create a new project

  2. Copy the project URL and keys to .env

Run Database Migrations

5. Twitter Authentication

6. Telegram Bot Setup

  1. Get bot token

  2. Add token to .env

  3. Set webhook (optional) or use polling

Running the Project

Development Mode

This starts:

  • Agent runtime with Twitter plugin

  • Website client

  • API server

  • Logging UI

2. Individual Services

Testing

Project Structure

Common Development Tasks

Adding a New Tool

  1. Create tool in agent/src/tools/

  2. Implement Tool interface

  3. Register in runtime.ts

Creating a Workflow

  1. Create workflow in agent/src/workflows/

  2. Export configuration

Testing Context Pipeline

Troubleshooting

Common Issues

1. "Cannot find module" errors

  • Make sure you're using bun not npm

  • Run bun install in the specific directory

2. Database connection errors

  • Verify Supabase credentials in .env

  • Check if tables are created

  • Ensure service role key is set if needed

3. Twitter authentication fails

  • Verify OAuth credentials

  • Check redirect URI matches configuration

  • Clear tokens and re-authenticate: bun run agent/plugins/twitter/auth/clear-auth.ts

4. LLM errors

  • Verify API keys are set

  • Check rate limits

  • Enable fallbacks: LLM_FALLBACKS_ENABLED=true

5. WebSocket connection issues

  • Check if API server is running

  • Verify WebSocket URLs in .env

  • Check for CORS issues

Debug Commands

Production Deployment

Railway (API Server)

  1. Connect GitHub repo

  2. Set environment variables

  3. Deploy with bun install && bun run server.ts

Vercel (Website)

  1. Import project

  2. Set environment variables

  3. Deploy with automatic builds

Database

  1. Use Supabase cloud instance

  2. Enable row-level security

  3. Set up backups

Additional Resources

Support

For issues or questions:

  1. Check existing documentation

  2. Review test files for examples

  3. Check GitHub issues

  4. Contact the development team

Last updated