Observability and annotations for AI applications.
This is a comprehensive tracing and annotation system that allows you to:
- Manage tracing projects - Organize traces into projects
- Store and query traces - Record AI execution traces with inputs, outputs, and metadata
- Provide feedback - Annotate traces with scores, comments, and span-level highlights
- Create annotation queues - Build review workflows for traces
- Define rubrics - Specify evaluation criteria for queue items
- Process queues FIFO-style - Pop traces from queues for review and mark them complete
Backend:
- Python 3.11+
- PostgreSQL 14+ (running on localhost:5432)
- uv package manager
Frontend:
- Node.js 18+
- pnpm package manager
Run the complete backend setup with one command:
cd backend
make setupThis will:
- Install all dependencies
- Create the
langsmithdatabase (if it doesn't exist) - Run database migrations
- Seed with sample data
Then start the backend server:
make runTo re-seed the data run:
make seedThe API will be available at http://localhost:8000
Install dependencies and start the dev server:
cd client
pnpm install
pnpm devThe frontend will be available at http://localhost:5173 (Vite default port)
POST /queues- Create a queueGET /queues- List all queuesGET /queues/{queue_id}- Get a specific queuePATCH /queues/{queue_id}- Update a queueDELETE /queues/{queue_id}- Delete a queue
POST /queues/{queue_id}/populate- Add traces to a queueGET /queues/{queue_id}/entries/next- Get next pending entryPOST /queues/{queue_id}/entries/{entry_id}/complete- Mark entry as complete (deletes it)POST /queues/{queue_id}/entries/{entry_id}/requeue- Re-queue an entry
POST /queues/{queue_id}/rubric- Create a rubric itemGET /queues/{queue_id}/rubric- List rubric itemsPATCH /queues/{queue_id}/rubric/{item_id}- Update a rubric itemDELETE /queues/{queue_id}/rubric/{item_id}- Delete a rubric item
POST /feedback/batch- Create multiple feedback items at oncePATCH /feedback/{feedback_id}- Update feedbackDELETE /feedback/{feedback_id}- Delete feedback
POST /projects- Create a tracing projectGET /projects- List projectsGET /projects/{project_id}- Get a specific projectDELETE /projects/{project_id}- Delete a projectPOST /traces- Create a tracePOST /traces/query- Query traces (filter by trace_ids, project_id, session_id)GET /traces/{trace_id}- Get a specific trace
tracing_projects- Projects that contain tracestraces- Individual traces with inputs, outputs, metadataqueues- Annotation queuesqueue_rubric_items- Evaluation criteria for queuesqueue_entries- Entries in queues (with status field)feedback- Annotations on traces
- Cascade deletes: Deleting a project deletes its traces, which deletes queue entries and feedback
- FIFO ordering: Queue entries are returned in order of
added_at - Concurrency control: Uses
FOR UPDATE SKIP LOCKEDto prevent concurrent access to the same entry - Span highlighting: Feedback can reference specific paths in the outputs JSON, with optional start/end indices for strings
Format code with ruff:
cd backend
make formatLint code with ruff and mypy:
cd backend
make lintThe backend includes comprehensive unit tests for all endpoints (69 tests covering projects, traces, queues, rubrics, and feedback).
cd backend
make testAll commands should be run from the backend directory:
Create a new migration:
cd backend
uv run alembic revision -m "Description of changes"Apply migrations:
make migrateRollback last migration:
uv run alembic downgrade -1Backend:
- FastAPI - Modern async Python web framework
- asyncpg - High-performance PostgreSQL driver
- Alembic - Database migrations
- PostgreSQL - Database with JSONB support
- Pydantic - Data validation and schema management
- pytest - Testing framework with async support
Frontend:
- React - UI library for building interactive interfaces
- TypeScript - Type-safe JavaScript
- Vite - Fast build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- pnpm - Fast, efficient package manager
Once the server is running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
.
├── backend/ # Backend Python service
│ ├── alembic/ # Database migrations
│ │ └── versions/
│ ├── scripts/ # Helper scripts
│ │ ├── create_db.py
│ │ └── seed_data.py
│ ├── src/
│ │ ├── routers/ # API route handlers
│ │ │ ├── queues.py
│ │ │ ├── rubrics.py
│ │ │ ├── feedback.py
│ │ │ ├── projects.py
│ │ │ └── traces.py
│ │ ├── services/ # Business logic layer
│ │ │ ├── queues.py
│ │ │ ├── rubrics.py
│ │ │ ├── feedback.py
│ │ │ ├── projects.py
│ │ │ └── traces.py
│ │ ├── config.py # Configuration
│ │ ├── database.py # Database connection pool
│ │ ├── models.py # SQLAlchemy models (for Alembic only)
│ │ ├── schemas.py # Pydantic models
│ │ ├── sql_utils.py # SQL query utilities
│ │ └── main.py # FastAPI app
│ ├── tests/ # Test files
│ ├── docker-compose.yml # PostgreSQL container
│ ├── Makefile # Common commands
│ ├── pyproject.toml # Python dependencies
│ ├── alembic.ini # Alembic configuration
│ └── uv.lock # Locked dependencies
├── client/ # Frontend React application
│ ├── src/ # React source files
│ ├── public/ # Static assets
│ ├── package.json # Node dependencies
│ ├── pnpm-lock.yaml # Locked dependencies
│ ├── vite.config.ts # Vite configuration
│ ├── tsconfig.json # TypeScript configuration
│ └── tailwind.config.js # Tailwind CSS configuration
├── .gitignore # Git ignore patterns
├── .python-version # Python version for the project
├── INTERVIEW.md # Interview task description
└── README.md # This file