Spaces:
Running
Running
AgentGraph React
A modern React-based interface for AI agent pipeline analysis and knowledge graph management, built with Shadcn UI components.
Features
- Modern UI: Built with React 18, TypeScript, and Shadcn UI components
- Trace Management: Upload, view, and manage AI agent execution traces
- Pipeline Processing: Run comprehensive analysis pipelines including:
- Prompt Reconstruction
- Perturbation Testing
- Causal Analysis
- Knowledge Graphs: Generate and visualize knowledge graphs from trace data
- Real-time Updates: Live progress tracking and status updates
- Command Palette: Quick access to all features via Cmd/Ctrl+K
- Dark/Light Theme: Automatic theme switching with system preference
Tech Stack
- React 18 with TypeScript
- Vite for fast development and building
- Shadcn UI for beautiful, accessible components
- Tailwind CSS for styling
- Lucide React for icons
- React Query for data fetching (planned)
Development
Prerequisites
- Node.js 16+
- npm or yarn
Setup
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Type checking
npm run type-check
# Linting
npm run lint
Development Server
The development server runs on http://localhost:3001 with hot reload enabled.
Building
The build output goes to ../static/js/agentgraph/dist/ to integrate with the FastAPI backend.
Integration
This React app integrates with the existing FastAPI backend:
- Route:
/agentgraph- Main interface - API Proxy: Development server proxies
/api/*tohttp://localhost:8000 - Static Assets: Built files are served by FastAPI from
/static/js/agentgraph/dist/
Project Structure
src/
βββ components/
β βββ ui/ # Shadcn UI components
β βββ layout/ # Layout components (sidebar, workspace)
β βββ features/ # Feature-specific components
β β βββ upload/ # File upload functionality
β β βββ traces/ # Trace management
β β βββ pipeline/ # Pipeline processing
β β βββ command/ # Command palette
β β βββ workspace/ # Main workspace views
β βββ shared/ # Shared components
βββ context/ # React contexts for state management
βββ hooks/ # Custom React hooks
βββ lib/ # Utilities and API client
βββ types/ # TypeScript type definitions
βββ styles/ # Global styles
API Integration
The app uses a centralized API client (src/lib/api.ts) that interfaces with the FastAPI backend:
- Traces: Upload, list, and process trace files
- Knowledge Graphs: Generate, enrich, and analyze knowledge graphs
- Tasks: Monitor background task progress
- Pipeline: Execute and monitor analysis stages
State Management
Uses React Context for global state management:
- AgentGraphContext: Main application state (traces, pipeline stages, etc.)
- ThemeContext: Theme switching (light/dark)
- NotificationContext: Toast notifications and alerts
Commands
- Cmd/Ctrl+K: Open command palette
- Upload: Drag & drop or click to upload trace files
- Pipeline: Start/stop analysis pipeline stages
- Theme: Toggle between light and dark themes
Contributing
- Follow the existing code structure and patterns
- Use TypeScript for all new code
- Follow the Shadcn UI component patterns
- Add proper error handling and loading states
- Update types when adding new features