Skip to content

Add Ask GalwayBus: an on-device agent over new AppFunctions - #151

Merged
joreilly merged 3 commits into
mainfrom
ask-galwaybus
Nov 28, 2026
Merged

joreilly merged 3 commits into
mainfrom
ask-galwaybus

Conversation

@joreilly

@joreilly joreilly commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • AppFunctions: five functions, getDepartures, findStops, findNearbyStops, listRoutes and listSavedStops. Assistants can call them, and they're also the agent's tools.
  • getDepartures resolves a stop name, stop number or nearby place itself.
    • Places are geocoded within Galway. A match that's only the city itself, which is what "Tower Bridge" returns, counts as not found.
    • towards matches places on the way as well as the final destination, using route stop order. So "Eyre Square to Salthill" finds the 401.
  • findNearbyStops(nearMe=true) uses the same location as the Near me tab. It never prompts for permission, since an assistant can call it with nothing on screen. Without permission, it tells the agent to have the user allow it or name a place.
  • Ask GalwayBus chat (ML Kit GenAI agent, Gemini Nano), opened from a top-bar button that appears only where the model is available.
    • Departures and stops from the tool results render as cards in the app's route-badge style. The model answers in one sentence underneath, and tapping a stop card asks for its next buses.
    • Readable tool chips (tap to see the raw call), progress messages, and a filter for the model's raw function-call text.
    • Fixes a reply that rendered nothing, caused by the Markdown renderer's empty loading and error states, or that ended up below the input.
  • The shared App() gets an optional extraActions slot, and RouteBadge is now public. iOS, desktop and web are otherwise unchanged.
  • Side effects:
    • AppFunctions is held at 1.0.0-alpha13, with a Renovate rule, because genai-agent 1.0.0-alpha1 is binary-incompatible with newer versions.
    • Android minSdk goes from 24 to 26, which genai-agent requires.
    • New R8 keep rule for ML Kit's component registrars, which caused BikeShare's 1.0.17 crash.

Test plan

  • Unit tests pass for stop matching, route order, departure conversion, the reducer (results, raw-call filtering) and chip labels. :shared:jvmTest also passes.
  • Builds pass: Android debug and release, desktop, iOS simulator and wasm.
  • Each AppFunction called with adb shell cmd app_function on an API 37 emulator and the Pixel:
    • Eyre Square to Rahoon and to Salthill, and Salthill Prom to Eyre Square.
    • The cathedral, Shop Street and NUIG.
    • An unknown place gives an error.
    • nearMe with and without location permission.
  • On a Pixel 10 Pro XL with Gemini Nano:
    • Suggestions, departure and stop cards, tapping a stop, follow-ups, "nearest me" and Salthill.
    • Replayed the conversation whose reply had gone missing.
  • The app is unchanged where Gemini Nano isn't available (Ask stays hidden).
  • CI green

🤖 Generated with Claude Code

https://claude.ai/code/session_01XcDRQnBoiM8GnCbW7b4Dts

joreilly and others added 3 commits November 28, 2026 12:07
Exposes stops and departures as AppFunctions (for assistants as well as
the app) and uses them as the tools of an ML Kit GenAI agent running
Gemini Nano, the same approach as BikeShare. getDepartures resolves stop
names, numbers and nearby places itself, since Galway stop names are
abbreviated and most cover a stop each side of the road, and Gemini Nano
guesses coordinates when asked for them.

AppFunctions stays on 1.0.0-alpha13 (with a Renovate hold) because ML
Kit genai-agent 1.0.0-alpha1 breaks on anything newer, and the app's
minSdk rises to 26, which genai-agent requires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XcDRQnBoiM8GnCbW7b4Dts
No route ends at Salthill, so "Eyre Square to Salthill" found nothing
although the 401 goes there. towards now resolves to stops (by name,
number or place) and keeps a bus if its route, in its direction, reaches
one of them after the stop it leaves from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XcDRQnBoiM8GnCbW7b4Dts
Departures and stops from the AppFunction results now render as cards
in the app's own route-badge style, so the times on screen come from the
data rather than the model's retelling; the model is told to answer in
one sentence instead of repeating the list, and a stop card asks for that
stop's next buses. Tool chips read as people would put them, progress
says what the agent is doing, and the model's raw function-call text no
longer flashes up before each call.

Also fixes a reply that rendered nothing (the Markdown renderer's empty
loading and error states) or ended below the input, and the grey box on
the drag handle after asking.

findNearbyStops gains nearMe, using the same location as the Near me
tab. It never prompts for permission, since an assistant can call it
with nothing on screen; it tells the agent to have the user allow it in
the app or name a place instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XcDRQnBoiM8GnCbW7b4Dts
@joreilly
joreilly merged commit 3119870 into main Nov 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant