Multi-armed bandit agent testing platform with FastAPI backend and Next.js frontend.
- Backend: FastAPI (Python 3.11+)
- Frontend: Next.js 15 with TypeScript
- Styling: Tailwind CSS
- Experiment Tracking: Weave
- Cache: Redis (optional)
agent-playground/
├── backend/
│ ├── app/
│ │ ├── __init__.py
│ │ └── main.py # FastAPI application
│ ├── requirements.txt
│ └── Dockerfile
├── frontend/
│ ├── src/
│ │ ├── app/ # Next.js app directory
│ │ ├── components/ # React components
│ │ └── lib/ # Utilities and API client
│ ├── package.json
│ ├── next.config.js
│ ├── tsconfig.json
│ └── Dockerfile
├── docker-compose.yml
├── package.json # Root package.json for managing both services
└── README.md
- Python 3.11 or higher
- Node.js 20 or higher
- Docker and Docker Compose (optional, for containerized deployment)
-
Clone the repository
cd agent-playground -
Install dependencies
# Install root dependencies (concurrently for running both services) npm install # Install backend dependencies cd backend pip install -r requirements.txt cd .. # Install frontend dependencies cd frontend npm install cd ..
-
Set up environment variables
cp .env.example .env # Edit .env with your configuration -
Run the development servers
Run them separately in different terminals:
Terminal 1: Backend
cd backend python -m uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Terminal 2: Frontend
cd frontend npm run dev -
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
-
Build and start all services
docker-compose up --build
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- Redis: localhost:6379
-
Stop all services
docker-compose down
npm run dev- Run both frontend and backend in development modenpm run dev:frontend- Run only frontendnpm run dev:backend- Run only backendnpm run install- Install all dependenciesnpm run docker:up- Start Docker containersnpm run docker:down- Stop Docker containers
Run backend server:
cd backend
python -m uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Other commands:
pip install -r requirements.txt- Install Python dependencies
npm run dev- Run development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLint
GET /- Root endpointGET /health- Health checkGET /docs- Interactive API documentation (Swagger UI)GET /redoc- Alternative API documentation (ReDoc)
GET /api/v1/hello- Hello world endpoint
- Add routes in
backend/app/main.py - Define request/response models using Pydantic
- Update frontend API client in
frontend/src/lib/api.ts
- Create new files in
frontend/src/app/directory - Use the App Router file conventions (page.tsx, layout.tsx)
- Add API calls using the client in
frontend/src/lib/api.ts
The backend is configured to initialize Weave for experiment tracking. To use it:
- Set your
WANDB_API_KEYin.env - Weave will automatically track experiments
- View results at https://wandb.ai/
If you get a "port already in use" error:
# Find and kill the process using the port
lsof -ti:8000 | xargs kill -9 # Backend
lsof -ti:3000 | xargs kill -9 # Frontendcd backend
pip install --upgrade pip
pip install -r requirements.txtcd frontend
rm -rf node_modules package-lock.json
npm installMIT
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
| Sponsor | Integration Level | Files | Stations | Status |
|---|---|---|---|---|
| Weights & Biases | ✅ Complete | 3 files | All 7 | Active |
| Google Cloud | ✅ Complete | 2 files | All 7 | Active |
| BrowserBase | ✅ Complete | 2 files | Web Playground | Active |
| AG-UI (CopilotKit) | ✅ Complete | 2 files | UI Art Room | Active |
| Daytona | ✅ Complete | 2 files | Safe Sandbox | Active |
| Tavily | ✅ Complete | 2 files | Research Library | Active |
| CoreWeave | ✅ Complete | 1 file | Training Gym | Active |
Total Integration Score: 7/7 (100%)