Skip to content

persist-os/agent-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agent Playground

Multi-armed bandit agent testing platform with FastAPI backend and Next.js frontend.

Tech Stack

  • Backend: FastAPI (Python 3.11+)
  • Frontend: Next.js 15 with TypeScript
  • Styling: Tailwind CSS
  • Experiment Tracking: Weave
  • Cache: Redis (optional)

Project Structure

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

Prerequisites

  • Python 3.11 or higher
  • Node.js 20 or higher
  • Docker and Docker Compose (optional, for containerized deployment)

Installation & Setup

Option 1: Local Development (Recommended for development)

  1. Clone the repository

    cd agent-playground
  2. 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 ..
  3. Set up environment variables

    cp .env.example .env
    # Edit .env with your configuration
  4. 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 8000

    Terminal 2: Frontend

    cd frontend
    npm run dev
  5. Access the application

Option 2: Docker Compose (Recommended for production-like environment)

  1. Build and start all services

    docker-compose up --build
  2. Access the application

  3. Stop all services

    docker-compose down

Available Scripts

Root Level

  • npm run dev - Run both frontend and backend in development mode
  • npm run dev:frontend - Run only frontend
  • npm run dev:backend - Run only backend
  • npm run install - Install all dependencies
  • npm run docker:up - Start Docker containers
  • npm run docker:down - Stop Docker containers

Backend (in /backend directory)

Run backend server:

cd backend
python -m uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Other commands:

  • pip install -r requirements.txt - Install Python dependencies

Frontend (in /frontend directory)

  • npm run dev - Run development server
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint

API Endpoints

Health & Status

  • GET / - Root endpoint
  • GET /health - Health check
  • GET /docs - Interactive API documentation (Swagger UI)
  • GET /redoc - Alternative API documentation (ReDoc)

Example Endpoints

  • GET /api/v1/hello - Hello world endpoint

Development

Adding New API Routes

  1. Add routes in backend/app/main.py
  2. Define request/response models using Pydantic
  3. Update frontend API client in frontend/src/lib/api.ts

Adding New Frontend Pages

  1. Create new files in frontend/src/app/ directory
  2. Use the App Router file conventions (page.tsx, layout.tsx)
  3. Add API calls using the client in frontend/src/lib/api.ts

Weave Integration

The backend is configured to initialize Weave for experiment tracking. To use it:

  1. Set your WANDB_API_KEY in .env
  2. Weave will automatically track experiments
  3. View results at https://wandb.ai/

Troubleshooting

Port Already in Use

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  # Frontend

Python Dependencies Issues

cd backend
pip install --upgrade pip
pip install -r requirements.txt

Frontend Build Issues

cd frontend
rm -rf node_modules package-lock.json
npm install

License

MIT

Contributing

  1. Create a feature branch
  2. Make your changes
  3. Test thoroughly
  4. Submit a pull request

🏆 Sponsor Integration Status

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%)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors