Skip to content

feat(AgenticNavigation): add Agentic Navigation SDK (v8.2.0) voice copilot (:app + :server) with Google Maps grounding attribution - #39

Draft
LoyalAbbas wants to merge 1 commit into
mainfrom
feat/agentic_nav_Sdk
Draft

LoyalAbbas wants to merge 1 commit into
mainfrom
feat/agentic_nav_Sdk

Conversation

@LoyalAbbas

Copy link
Copy Markdown

Summary

Adds the Agentic Navigation SDK (v8.2.0) to navigation-sample as a two-module Gradle project (:app + :server), demonstrating live turn-by-turn navigation voice assistance with NavSDK ToolExecutor, Gemini function calling, and compliant Grounding with Google Maps attribution.

:app holds zero LLM API keys—all Gemini API calls, partner backend tools, and Google Maps grounding are owned by :server.

Key Changes

Build & Configuration

  • Bumped Navigation SDK (navSdk) from 8.0.0 to 8.2.0 in gradle/libs.versions.toml.
  • Added the :server Kotlin/JVM (Java 17) subproject (settings.gradle.kts, server/build.gradle.kts, server/Dockerfile) using Ktor Netty (3.4.0), com.google.genai:google-genai (2.6.0), and kotlinx-serialization-json (1.9.0).
  • Added .DS_Store to .gitignore and kept secrets.properties gitignored for local MAPS_API_KEY / AGENT_SERVER_URL overrides.

:server — Ktor Relay, Gemini Orchestration & Google Maps Grounding

  • HTTP relay (Application.kt, ProtocolModels.kt, ServerConfig.kt):
    • Exposes GET /health, POST /api/chat/start, and POST /api/chat/tool-results with security headers and optional constant-time X-Sample-Auth verification.
    • Defaults to gemini-3.5-flash-lite, GEMINI_API_VERSION=v1, and ENABLE_MAPS_GROUNDING=true (all configurable via env vars).
    • Added GroundingSource(title, uri, placeId) and returns groundingSources: List<GroundingSource> = emptyList() in every DONE response.
  • Gemini integration (ModelGateway.kt, PromptBuilder.kt):
    • Passes raw NavSDK tool schemas directly via FunctionDeclaration.parametersJsonSchema.
    • Sets ToolConfig.includeServerSideToolInvocations = true when combining Google Maps grounding with custom function calling.
    • Extracts Maps sources from groundingChunks -> maps() (title, uri, placeId) and maps.placeAnswerSources().reviewSnippets() (title, googleMapsUri).
    • Instructs the assistant in the system prompt to acknowledge Google Maps and direct drivers to the on-screen Sources view when asked where place/destination information came from.
  • Multi-round orchestration (AgentOrchestrator.kt, SessionStore.kt, PartnerTools.kt):
    • Retains verbatim raw SDK Content across rounds (preserving Gemini 3 thoughtSignature and server-side tool invocations).
    • Deduplicates groundingSources by uri across all rounds of a turn.
    • Enforces kill-switch fast-fail when clientTools is empty, holds side-effect server tools (completeTrip, messagePassenger) until phone tool results succeed, guarantees 1:1 FunctionResponse ordering, caches per-round responses for idempotent retries, and evicts in-memory sessions after a 2-minute TTL.

:app — Push-to-Talk Voice Copilot & Grounding Attribution UI

  • Activity & NavSDK bridge (AgenticNavActivity.kt, MainActivity.kt, NavToolBridge.kt, RemoteAgentClient.kt):
    • Added AgenticNavActivity with a simulated Mountain View demo route, push-to-talk voice controls, debug-only cleartext loopback config (app/src/debug/res/xml/network_security_config.xml), and DUMP-gated debug query broadcast receiver.
    • Bridges NavSDK ToolExecutor descriptors/execution on the main thread and relays turns via RemoteAgentClient (with kill-switch fast-fail and timeout retry).
  • Voice lifecycle (VoiceAssistantController.kt, VoiceAssistantButton.kt):
    • Coordinates SpeechRecognizer, TextToSpeech, AudioManager focus ducking, barge-in, and yielding to turn-by-turn voice guidance via Navigator.AudioGuidancePlaybackListener.
  • Google Maps grounding attribution & in-memory transcript (AgentTranscriptStore.kt, activity_agentic_nav.xml, item_grounding_source.xml, item_transcript_turn.xml):
    • Maintains a strictly in-memory session transcript (never persisted to disk, SharedPreferences, or saved instance state; cleared on new route start or activity destroy).
    • Displays a compact companion overlay card showing the verbatim assistant reply, a 1-tap expandable Sources list below grounded replies, and a 1-tap expandable Session Transcript overlay.
    • Shows the active disclosure ("AI-generated answers may include information from Google Maps. View sources below.") whenever Maps-grounded content is displayed.
    • Renders each source with the non-localized "Google Maps" string (translatable="false", single-line/no-wrap, Roboto/sans-serif, normal weight 400, 12sp, #FFFFFF on dark #2D2E31 surface with >4.5:1 contrast), the source title, and HTTP/HTTPS-validated Intent.ACTION_VIEW link handling.

Documentation

  • Updated README.md with :server + :app setup (emulator and USB), ENABLE_MAPS_GROUNDING toggle, Google Maps attribution behavior, and Cloud Run deployment instructions.
  • Added AGENTIC_ARCHITECTURE.md documenting the relay protocol, sequence diagram, and safety invariants.

Testing

All unit tests run offline with zero API keys:

  • ./gradlew :server:test — 15 passed, 0 failed (PromptAndSchemaTest, AgentOrchestratorTest, ServerRoutesTest).
  • ./gradlew :app:testDebugUnitTest — 12 passed, 0 failed (RemoteAgentClientTest, VoiceAssistantControllerTest, AgentTranscriptStoreTest).
  • ./gradlew :app:assembleDebug — build succeeded.

@LoyalAbbas
LoyalAbbas requested a review from dkhawk November 30, 2026 08:06
…pilot (:app + :server) with Google Maps grounding attribution
@LoyalAbbas
LoyalAbbas force-pushed the feat/agentic_nav_Sdk branch from bfd1a4f to a76b5e8 Compare December 4, 2026 04:27
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