Meet Ask the Sea, A Natural-Language AI Assistant for the Black Sea Observatory
AQUA-SMART Product Team, e-AQUAF Project (BSB01009)

Why We Built Ask the Sea
AQUA-SMART now ingests dozens of live data streams: in-situ DO, pH, salinity and temperature from three Black Sea buoys; daily satellite layers from Copernicus Marine and NASA PACE; FAO FishStat production baselines; AIS vessel positions; eddy and bloom event histories. The dashboard exposes all of this through charts, badges and forecasts, but answering a simple question like "is now a good time to harvest sea bass?" still required jumping between four or five sections.
Ask the Sea is the natural-language layer that sits on top of every monitoring page. Type a question, get a sourced answer in seconds, with the exact tools and stations used to build it shown beneath every reply.

What You Can Ask
The assistant is wired to the same datasets that power the dashboard, so it can reason across them. Typical questions include:
| Theme | Example question |
|---|---|
| Live conditions | "What are conditions across all three stations right now?" |
| Bloom history | "When was the last major bloom event in Bulgaria?" |
| Eddy interpretation | "There's an active eddy, what does this mean for the next two weeks?" |
| Harvest timing | "Is now a good time to harvest sea bass in Romania?" |
| Basin comparison | "Which station has the highest WQI this month?" |
| Market context | "What's the FAO trout production trend for the Black Sea?" |
When you open the assistant from a station detail page, a small badge in the header (e.g. Romania) tells the model which station to prioritise. Open it from the GIS map and it answers in basin-wide terms instead.

How a Question Becomes an Answer
Every response goes through a single edge function, ask-the-sea, that we deployed on Supabase. The function:
- Verifies the user's JWT, anonymous traffic is rejected at the edge.
- Enforces a 20-questions-per-hour rate limit per user, to keep model costs predictable.
- Forwards the conversation (last 6 turns only) to Gemini 3 Flash via the AQUA SMART AI Gateway, with six platform tools attached.
- Streams tokens back to the browser via Server-Sent Events, so answers appear word-by-word.
- Emits a final
metaevent listing which tools were called and which station data sources were consulted, this is what powers the "Tools: get live conditions · Romania, Bulgaria, Georgia" footer under each answer.

The Six Tools Behind the Model
The model never invents marine data. When it needs a number it must call one of these tools, each backed by real platform tables and edge functions:
| Tool | What it returns | Source |
|---|---|---|
get_live_conditions | Latest WQI, SST, DO, pH, salinity per station | station_observations (auto-refreshed every 5 min) |
get_historical_data | Daily aggregates over a chosen date range | station_observations with 3σ outlier filter |
get_basin_comparison | Side-by-side current readings across all stations | Aggregated live view |
get_bloom_events | Past bloom events (Chl-a > 3 µg/L for 3+ days) | station_indicators + PACE OCI |
get_eddy_events | Past eddy events (SSH > +20 cm for 3+ days) | Copernicus Marine SSH anomaly |
get_fao_market_data | Black Sea production and species mix | fao_production (refreshed every 4 months) |
Because the answers are grounded in tool output rather than the model's training data, they stay correct even as conditions change minute-by-minute.

Design Choices
A few decisions were deliberate:
- Gemini 3 Flash, not Pro. Flash is fast enough for streaming chat and ~10× cheaper. For the structured, tool-augmented questions this assistant handles, the quality difference is invisible.
- AQUA SMART AI Gateway, not direct API keys. There is no per-user OpenAI or Google key to manage; the gateway handles auth, billing and model routing for us.
- Citation metadata on every answer. Marine science benefits from transparency, users see exactly which tools were invoked, so the reply can be audited against the underlying dashboards.
- Auth-gated. The widget renders nothing for anonymous visitors. This protects the rate-limit budget and keeps the assistant grounded in the per-user context.
- Context-aware launcher placement. The button sits next to the chat bubble at the bottom-right, with a station badge when a station page is active.
Limits and Honest Caveats
- 20 questions per hour per user. Hitting the cap returns a friendly "come back later" message instead of an error.
- 6-turn conversation memory. Long sessions truncate to the most recent 6 messages so the prompt stays compact.
- Tool coverage, not free-form recall. If you ask something outside the six tools (e.g. "explain quantum mechanics"), the model will politely decline and steer you back to platform topics.
- Tokens stream, they don't finalise. If you close the panel mid-stream the answer is discarded; rate-limit is still charged for the request that started.
What's Next
We're tracking three additions for the next release cycle:
- Chart-aware answers. When the question is best shown visually ("plot DO for the last 30 days"), have the assistant render a small inline chart alongside the text.
- Multi-language replies. Ask the Sea currently answers in English; the next pass will respect the user's selected platform language (BG / EL / RO / TR / UK).
- Voice mode for field use on a phone, so a farmer at a cage can ask a question without typing.
About the Project
AQUA-SMART is developed within e-AQUAF (BSB01009), Smart Aqua Farming, co-funded by the Interreg NEXT Black Sea Basin Programme of the European Union. The platform is open source and built by Re:Invent Education with contributions from all project partners across Romania, Bulgaria and Georgia.
The responsibility for the content of this material is that of the author(s). The content does not necessarily represent the official position of the European Union.
