Installation
This guide covers the complete installation and setup of the Autonomous Incident Agent (AIA).
#Prerequisites
Before proceeding, ensure you have:
- Bun: v1.2 or later (Install Bun)
- Git: For cloning the repository
- GitHub Account: For PR creation
- You.com API Key: For AI analysis (Get API Key)
- PostgreSQL Database: We recommend Neon (free tier available)
#Step 1: Clone Repository
Terminal
git clone https://github.com/sarthakNITT/autonomous-incident-agent
cd autonomous-incident-agent
#Step 2: Install Dependencies
Terminal
bun install
This installs all dependencies for the monorepo workspace.
#Step 3: Create GitHub Personal Access Token
- Go to GitHub Settings → Developer Settings → Personal Access Tokens
- Click "Generate new token (classic)"
- Give it a name (e.g., "AIA Bot")
- Select scope:
repo(Full control of private repositories) - Click "Generate token"
- Copy the token (starts with
ghp_)
#Step 4: Get You.com API Key
- Visit You.com
- Sign up or log in
- Navigate to API settings
- Generate an API key
- Copy the key (starts with
ydc-)
#Step 5: Set Up Database
Option A: Neon (Recommended)
- Go to Neon
- Create a free account
- Create a new project
- Copy the connection string (looks like
postgresql://user:pass@host/db)
Option B: Local PostgreSQL
Terminal
# Install PostgreSQL
brew install postgresql # macOS
# or
sudo apt install postgresql # Linux
# Create database
createdb aia_db
# Connection string
postgresql://localhost/aia_db
#Step 6: Configure Environment
Create a .env file in the project root:
.env
# AI Configuration
YOU_API_KEY=ydc_your_actual_key_here
# GitHub Configuration
GITHUB_TOKEN=ghp_your_actual_token_here
# Database Configuration
DATABASE_URL=postgresql://user:pass@host/db
# Optional: R2 Storage (for autopsy backups)
R2_ACCESS_KEY_ID=your_r2_access_key
R2_SECRET_ACCESS_KEY=your_r2_secret_key
R2_BUCKET_NAME=aia
R2_ACCOUNT_ID=your_account_id
#Step 7: Configure GitHub Repository
Create aia.config.local.yaml (gitignored):
aia.config.local.yaml
github:
provider: "github"
token: "PLACEHOLDER" # Read from .env
owner: "your-github-username" # REQUIRED
repo: "your-repo-name" # REQUIRED
base_branch: "main"
Example:
- If your repo is
https://github.com/johndoe/my-app - Set
owner: "johndoe" - Set
repo: "my-app"
#Step 8: Verify TypeScript
Ensure no type errors:
Terminal
bun run check-types
#Step 9: Start Services
Terminal
bun run dev
This starts all services:
- Agent (OTEL):
http://localhost:4318 - Dashboard:
http://localhost:3000 - Router:
http://localhost:3001 - Autopsy:
http://localhost:3002 - State:
http://localhost:3003 - Git:
http://localhost:3004 - Web:
http://localhost:3006 - Docs:
http://localhost:3007 - Sample App:
http://localhost:3008
#Step 10: Test the System
Trigger a test incident:
Terminal
curl -X POST http://localhost:3008/trigger \
-H "Content-Type: application/json" \
-d '{"action":"cause_error"}'
Then:
- Check dashboard:
http://localhost:3000 - View autopsy results
- Check your GitHub repo for a new PR
#Troubleshooting
"Command not found: bun"
Install Bun: curl -fsSL https://bun.sh/install | bash
"GitHub token invalid"
- Ensure token has
reposcope - Check token hasn't expired
- Verify token is correctly set in
.env
"Database connection failed"
- Verify
DATABASE_URLis correct - Check database is running
- Ensure network allows connection
"You.com API error"
- Verify API key is correct
- Check you have API credits
- Ensure key starts with
ydc-
"TypeScript errors"
Run bun run check-types to see specific errors
"Port already in use"
Another service is using the port. Stop it or change ports in aia.config.yaml
#Next Steps
- Configuration Reference - Detailed config options
- OpenTelemetry Integration - Instrument your app
- Architecture - Understand the system
- Troubleshooting - Common issues