Product

    Meet Ask the Sea, A Natural-Language AI Assistant for the Black Sea Observatory

    AQUA-SMART Product Team, e-AQUAF Project (BSB01009)

    June 2026 9 min read 0 views
    Ask the Sea assistant open over the AQUA-SMART homepage

    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.

    Ask the Sea open over the AQUA-SMART homepage, a floating assistant available across the platform for signed-in users.
    Ask the Sea open over the AQUA-SMART homepage, a floating assistant available across the platform for signed-in users.

    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:

    ThemeExample 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.

    The open assistant panel with four context-aware starter prompts. When opened from a station page, a small badge shows the active station (Romania, Bulgaria, or Georgia).
    The open assistant panel with four context-aware starter prompts. When opened from a station page, a small badge shows the active station (Romania, Bulgaria, or Georgia).

    How a Question Becomes an Answer

    Every response goes through a single edge function, ask-the-sea, that we deployed on Supabase. The function:

    1. Verifies the user's JWT, anonymous traffic is rejected at the edge.
    2. Enforces a 20-questions-per-hour rate limit per user, to keep model costs predictable.
    3. Forwards the conversation (last 6 turns only) to Gemini 3 Flash via the AQUA SMART AI Gateway, with six platform tools attached.
    4. Streams tokens back to the browser via Server-Sent Events, so answers appear word-by-word.
    5. Emits a final meta event 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.
    End-to-end architecture. The ask-the-sea Edge Function verifies the JWT, enforces a 20-questions-per-hour rate limit, and invokes Gemini 3 Flash via the AQUA SMART AI Gateway with six platform tools wired to Supabase.
    End-to-end architecture. The ask-the-sea Edge Function verifies the JWT, enforces a 20-questions-per-hour rate limit, and invokes Gemini 3 Flash via the AQUA SMART AI Gateway with six platform tools wired to Supabase.

    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:

    ToolWhat it returnsSource
    get_live_conditionsLatest WQI, SST, DO, pH, salinity per stationstation_observations (auto-refreshed every 5 min)
    get_historical_dataDaily aggregates over a chosen date rangestation_observations with 3σ outlier filter
    get_basin_comparisonSide-by-side current readings across all stationsAggregated live view
    get_bloom_eventsPast bloom events (Chl-a > 3 µg/L for 3+ days)station_indicators + PACE OCI
    get_eddy_eventsPast eddy events (SSH > +20 cm for 3+ days)Copernicus Marine SSH anomaly
    get_fao_market_dataBlack Sea production and species mixfao_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.

    A live response streamed from Gemini 3 Flash. Each answer carries citation metadata, which tools were called and which station data sources were consulted.
    A live response streamed from Gemini 3 Flash. Each answer carries citation metadata, which tools were called and which station data sources were consulted.

    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.

    Interreg NEXT Black Sea Basin Programme – Co-funded by the European Union

    Interreg NEXT Black Sea Basin Programme — Co-funded by the European Union

    Download the AQUA-SMART app

    Android
    Coming soon
    iOS
    Coming soon