This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Run all tests with advanced test runner
python run_tests.py # Run all tests with parallel execution
python run_tests.py --coverage # Run tests with coverage report
python run_tests.py --file auth_service # Run specific test file
python run_tests.py --verbose # Run tests with verbose output
python run_tests.py --workers 8 # Run tests with 8 parallel workers
# Direct pytest commands
pytest tests/ # Run all tests
pytest tests/test_auth_service.py # Run specific test file
pytest tests/ --cov=services --cov-report=html # Generate HTML coverage report
pytest tests/ -xvs # Stop on first failure with verbose output# Install dependencies
pip install -r requirements.txt # 173 production dependencies
pip install -r test_requirements.txt # Testing dependencies
# Run locally (set LOCAL=true in environment)
uvicorn api:APP --reload # Run with auto-reload
uvicorn api:APP --host 0.0.0.0 --port 8080 # Run on specific host/port
# Deploy to environments
./deploy_development.sh # Deploy to dev (odai-dev-5e4fd)
./deploy_production.sh # Deploy to prod (odai-prod)ODAI is a sophisticated AI assistant platform built with FastAPI, featuring:
- 30+ Third-Party Integrations: Financial, travel, communication, entertainment services
- Real-time WebSocket Support: Streaming chat responses with connection lifecycle management
- Voice Interface: Twilio integration for voice-based AI interactions
- Enterprise Security: Google Cloud KMS encryption, OAuth 2.0 authentication
- Comprehensive Testing: 700+ tests with 90%+ coverage across 67 test files
- Cloud-Native Architecture: Google App Engine with auto-scaling (2-20 instances in production)
api.py (FastAPI main)
├── routers/ # API endpoints & route handlers
│ ├── app_voice.py # Voice interaction endpoints
│ ├── google.py # Google services integration
│ ├── twilio_handler.py # SMS/voice handling
│ └── voice_utils/ # Audio processing utilities
├── services/ # Business logic layer
│ ├── auth_service.py # Authentication & OAuth
│ ├── chat_service.py # OpenAI chat management
│ └── api_service.py # Non-chat API endpoints
├── connectors/ # 30+ third-party integrations
│ ├── orchestrator.py # Agent tool orchestration
│ └── [integration].py # Individual service connectors
├── firebase/models/ # Data models & encryption
│ ├── user.py # User profiles
│ ├── chat.py # Chat sessions
│ └── [model]_token.py # Encrypted token storage
├── websocket/ # Real-time communication
│ └── handlers/ # WebSocket connection handlers
├── middleware/ # Application middleware
└── tests/ # 67 test files, 700+ tests
- FastAPI application with CORS middleware and authentication
- RESTful endpoints + WebSocket support for real-time chat
- Routers:
app_voice.py: Voice-based AI interactionsgoogle.py: Google OAuth and services (Calendar, Docs, Gmail)plaid.py: Banking integrationevernote.py: Note-taking integrationtwilio_handler.py: SMS/voice communication
auth_service.py: Google OAuth, JWT tokens, user management (84% coverage)chat_service.py: OpenAI integration, message processing, agent tools (97% coverage)api_service.py: Non-chat API endpoint orchestrationlocation_service.py: IP-based geolocation services
- Real-time bidirectional communication for streaming chat
- Connection lifecycle management with authentication
- Message queuing and error handling
- Support for both text and voice interactions
- User Management:
user.py- profiles, preferences, integration settings - Chat Storage:
chat.py- sessions, messages, conversation history - Token Management: Encrypted storage using Google Cloud KMS
google_token.py: Google OAuth tokensplaid_token.py: Banking credentialsevernote_token.py: Note service tokens
- Analytics:
token_usage.py- OpenAI API usage and cost tracking - Error Tracking:
unhandled_request.py- Failed request logging
plaid_agent.py: Bank account access and transactionsfinnhub_agent.py: Stock market data and financial newscoinmarketcap.py: Cryptocurrency prices and market dataexchange_rate.py: Currency conversion rates
amadeus_agent.py: Flight booking and travel planningflightaware.py: Real-time flight trackingamtrak.py: Train schedules and bookingscaltrain.py: California commuter rail status
gmail.py: Email management and sendinggoogle_calendar.py: Calendar events and schedulinggoogle_docs.py: Document creation and editingslack.py: Team messaging integrationtwilio_assistant.py: SMS and voice communication
amazon.py: Product search and shoppinggoogle_shopping.py: Price comparison and product searchyelp.py: Restaurant and business reviews
spotify.py: Music streaming and playlist managementmovieglu.py: Movie showtimes and theater informationticketmaster.py: Event tickets and entertainmenttripadvisor.py: Travel reviews and recommendations
accuweather.py: Weather forecasts and conditionsweatherapi.py: Alternative weather data source
orchestrator.py: Agent tool management and routingvoice_orchestrator.py: Voice-specific agent handlinggoogle_connections.py: Google API connection pooling
- Agent Tool Architecture: Function-based tools for AI capabilities with OpenAI agents
- Repository Pattern: Firebase models abstract database operations
- Dependency Injection: Services receive dependencies via constructors
- Middleware Pipeline: Authentication, CORS, error handling in layers
- Async/Await: Consistent async patterns for WebSocket and external APIs
- Encryption at Rest: Google Cloud KMS for sensitive data protection
- Connection Pooling: Efficient management of external API connections
-
Test Suite Statistics:
- 67 test files covering all modules
- 700+ individual test cases
- 90%+ code coverage across tested modules
- Parallel test execution with 8 workers in CI/CD
-
Test Categories:
- Unit Tests: Isolated component testing with mocked dependencies
- Integration Tests: End-to-end workflow validation
- WebSocket Tests: Real-time connection and streaming tests
- Authentication Tests: OAuth flow and token validation
- Connector Tests: Each third-party integration thoroughly tested
-
Testing Tools & Configuration:
run_tests.py: Advanced test runner with coverage reportingpytest.ini: Async support, timeout settings, warning filters- Comprehensive mocking of external services (OpenAI, Google Cloud, Firebase)
- Edge case coverage including empty data, invalid inputs, error conditions
-
Local Development:
- Set
LOCAL=trueenvironment variable - Use
.envfile for API keys and secrets - Python 3.13 recommended
- 4GB RAM minimum for development
- Set
-
Cloud Deployment:
- Google App Engine with auto-scaling
- Development: 1 instance, 4GB RAM (
odai-dev-5e4fd) - Production: 2-20 instances, 4GB RAM (
odai-prod) - Google Secret Manager for API key storage
- Cloud KMS for encryption keys
-
Configuration Files:
app.yaml: Development environment settingsprod.yaml: Production environment settingspytest.ini: Test configurationrequirements.txt: 173 production dependenciestest_requirements.txt: Testing dependencies
- Modular Service Refactoring: Migrated from monolithic 614-line file to modular service architecture
- Centralized Import Management:
utils/imports.pyfor clean dependency handling - Enhanced WebSocket Support: Improved streaming with connection lifecycle management
- Voice Interface Addition: Twilio integration for voice-based AI interactions
- Advanced Testing Infrastructure: Parallel test execution with comprehensive coverage reporting
- Security Enhancements: Cloud KMS encryption for all sensitive tokens
TESTING_README.md: Comprehensive testing guide (504 lines)REFACTORING_SUMMARY.md: Details of modular architecture migrationLAUNCH_PLAN.md: Product launch and go-to-market strategyREADME.md: Main project documentation