How dasouvik122005/orca works
Purpose and entry points
ORCA is a marine decision-intelligence platform for safety and fishing-operation recommendations. A FastAPI backend accepts natural-language queries, coordinates domain agents, computes deterministic risk, and returns explainable results. The React/Vite client presents chat, maps, risk metrics, and execution trace.
• Backend API: backend/app/main.py
• Frontend bootstrap: frontend/src/main.tsx, frontend/src/App.tsx
Backend boundary and contracts
The backend separates HTTP/WebSocket transport, typed response contracts, agent orchestration, and external-data access. Shared schemas stabilize exchanges among agents and the frontend; configuration and API credentials are environment-driven.
• API and application setup: backend/app/main.py, backend/app/config.py
• Typed models: backend/app/models/schemas.py
• Streaming transport: backend/app/websocket.py
Orchestration stage
The orchestrator is the control-plane state machine. It interprets a user request, selects/invokes specialized agents—potentially in parallel—collects standardized reports, then triggers risk and explanation stages. It also emits progress events for the client’s reasoning trace.
• Coordinator: backend/app/agents/orchestrator.py
• Agent package boundary: backend/app/agents/__init__.py
• WebSocket delivery: backend/app/websocket.py
Live marine-data acquisition
Weather and ocean agents obtain current meteorological and marine conditions; the geospatial agent derives location-aware constraints such as EEZ/MPA context through geographic calculations. External REST clients isolate Open-Meteo and OpenWeatherMap integration details from agent logic.
• Weather: backend/app/agents/weather_agent.py
• Ocean and geospatial analysis: backend/app/agents/ocean_agent.py, backend/app/agents/geospatial_agent.py
• API integration layer: backend/app/data/api_clients.py
Operational recommendation stages
PFZ discovery produces potential fishing-zone information, while route planning produces navigable route/risk-zone data for mapping. These are independent domain outputs consumed by the final response and visualization layer rather than replacing safety assessment.
• PFZ stage: backend/app/agents/pfz_agent.py
• Route stage: backend/app/agents/route_agent.py
• Shared response definitions: backend/app/models/schemas.py
Risk and explainability boundary
Risk scoring is deterministic and threshold-based, converting collected weather, ocean, and geospatial reports into a numeric risk profile. A separate explainability agent uses Google Gemini to turn that structured profile into localized human-readable advice, preventing the LLM from being the safety decision engine.
• Deterministic risk engine: backend/app/agents/risk_agent.py
• Gemini-backed explanation: backend/app/agents/explainability_agent.py
• Environment configuration: backend/.env.example, backend/app/config.py
Client visualization and interaction
The frontend submits queries through a service boundary, receives final structured results and real-time progress, then renders domain-specific views. React-Leaflet displays routes, zones, and PFZ heatmaps; dashboard and trace components expose risk and orchestration status.
• API client: frontend/src/services/api.ts
• Map and dashboard: frontend/src/components/MarineMap.tsx, frontend/src/components/RiskDashboard.tsx
• Chat and trace: frontend/src/components/ChatPanel.tsx, frontend/src/components/AgentTrace.tsx
Main entry points: orchestrator.py Orchestrator · api.ts API client · schemas.py Shared schemas · main.py FastAPI application
Components 16
React client
- App bootstrap
- API client
frontend/src/services/api.ts - Chat & trace · Captures queries and displays live orchestration progress.
- Map & risk dashboard
Backend transport
- FastAPI application
backend/app/main.py - WebSocket stream
backend/app/websocket.py - Shared schemas · Standardizes agent reports and frontend responses.
backend/app/models/schemas.py - Configuration · Supplies API credentials and application settings.
Decision pipeline
- Orchestrator · Selects agents, aggregates reports, and drives risk and explanation stages.
backend/app/agents/orchestrator.py - Weather, ocean & geospatial
- PFZ & route planning · Produces fishing-zone and navigable route outputs independently of safety scoring.
- Risk engine · Applies threshold-based safety scoring to collected reports.
backend/app/agents/risk_agent.py - Explainability agent · Turns structured risk into localized human-readable advice.
backend/app/agents/explainability_agent.py
External data & AI
- Marine API clients · Isolates Open-Meteo and OpenWeatherMap integration.
backend/app/data/api_clients.py - Weather & ocean APIs · Open-Meteo and OpenWeatherMap live conditions.
- Google Gemini
Connections 20
- App bootstrap → API client: submits queries
- App bootstrap → Chat & trace: renders interaction
- App bootstrap → Map & risk dashboard: renders results
- API client → FastAPI application: HTTP requests
- API client → WebSocket stream: progress stream
- FastAPI application → Orchestrator: dispatches request
- WebSocket stream → Chat & trace: progress events
- Orchestrator → Weather, ocean & geospatial: invokes
- Orchestrator → PFZ & route planning: invokes
- Orchestrator → Risk engine: collected reports
- Risk engine → Explainability agent: structured risk profile
- Orchestrator → Shared schemas: builds response
- Shared schemas → API client: structured result
- Weather, ocean & geospatial → Marine API clients: live-condition requests
- Marine API clients → Weather & ocean APIs: REST integration
- Explainability agent → Google Gemini: advice generation
- Configuration → FastAPI application: application settings
- Configuration → Marine API clients: API credentials
- Configuration → Explainability agent: Gemini credentials
- Shared schemas → Map & risk dashboard: routes, zones & metrics