Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ jobs:
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1

with:
node-version: 20
node-version: 22
registry-url: "https://wombat-dressing-room.appspot.com/"

- name: Run Semantic Release
working-directory: client/web
env:
GITHUB_TOKEN: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_WOMBAT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_WOMBAT_TOKEN }}
run: npm run release
NODE_PATH: ${{ github.workspace }}/client/web/node_modules
run: npx --prefix client/web semantic-release

14 changes: 14 additions & 0 deletions .github/workflows/web-ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Web CI

on:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
[![iOS Library](https://img.shields.io/badge/iOS_Library-SwiftUI-007AFF)](https://github.com/googlemaps/a2ui/tree/main/client/ios)

> **Note:** This toolkit is in **Experimental** status.
>
> 🔔 Stay Updated: Click the **Watch** button at the top right of this repository and select Custom → Releases to get notified whenever a new version is published.

This repository contains the A2UI implementation for the Maps Agentic UI Toolkit. It includes components and handlers implementing the Agent-to-User Interface (A2UI) standard, allowing agents to present rich, interactive interfaces across different platforms.

Expand Down
40 changes: 34 additions & 6 deletions agent/python_agent/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# MAUI Python Agent Package (`maui-a2ui-python`)

This package provides the core Python agent implementations for the Agentic UI Toolkit (MAUI). It includes the base `MAUIAgent` and the extended `MAUIAgentWithGrounding` that uses Vertex Grounding.
This package provides the core Python agent implementations for the Agentic UI
Toolkit (MAUI). It includes the base dynamic `MAUIAgent`, the low-latency
`MAUIAgentWithTemplates`, and the extended `MAUIAgentWithGrounding` using Vertex
AI Maps Grounding.

## File Structure

* `agent.py`: Contains the `MAUIAgent` class, which handles session management, LLM interaction, and A2UI schema loading.
* `agent_with_grounding.py`: Contains `MAUIAgentWithGrounding`, extending the base agent with Vertex Grounding capabilities.
* `shared/`: Contains schema extensions (e.g., `maps_catalog_extension.json`).
* `agent.py`: Contains `MAUIAgent`, which handles session management, LLM
interaction, and unconstrained dynamic A2UI schema validation.
* `agent_with_templates.py`: Contains `MAUIAgentWithTemplates`, a fast
template-driven agent utilizing intent classification (`LOCAL_SEARCH`,
`DIRECTIONS`) and structured parameter extraction for low latency.
* `agent_with_grounding.py`: Contains `MAUIAgentWithGrounding`, extending the
base agent with Vertex AI Grounding capabilities.
* `agent_config.py`: Contains `AgentConfig` and `FallbackMode` configurations
(`TEXT` vs `DYNAMIC`).
* `extractor.py` & `merger.py`: Parameter extraction schemas and template
merging engine.
* `shared/`: Contains layout templates (e.g. `local-search-template.json`,
`directions-template.json`) and schema extensions
(`maps_catalog_extension.json`).
* `skills/`: Contains specific skill definitions used by the agents.
* `pyproject.toml`: Configuration file for the package, using Hatchling as the build backend.

Expand All @@ -28,9 +42,20 @@ maui-a2ui-python = { path = "path/to/a2ui/agent/python_agent" }

### 2. Import and Use

The Agentic UI Toolkit includes two agents, one that uses Grounding Lite and one that uses Grounding with Google Maps. The Python integration steps are the same for each, but if you use Grounding with Google Maps, you must follow the instructions to configure your local environment. See the [Accessing Google Maps grounding data](#accessing-google-maps-grounding-data) section below for more information on configuring these services.
The Agentic UI Toolkit includes three agent architectures:

Tip: See the [agent_executor.py](https://github.com/googlemaps-samples/a2ui/blob/main/agent/python/agent_executor.py) example in the Agentic UI Toolkit Samples repository for a working example.
1. **Template-driven Agent (`MAUIAgentWithTemplates`)**: Recommended for
low-latency local search and directions queries.
2. **Standard Agent (`MAUIAgent`)**: Uses Grounding Lite MCP with dynamic A2UI
schema generation. Recommended when preferring maximum response flexibility
over low latency.
3. **Grounding Agent (`MAUIAgentWithGrounding`)**: Uses Grounding with Google
Maps via Vertex AI. Recommended when developing a Vertex-based solution.

Tip: See the
[agent_executor.py](https://github.com/googlemaps-samples/a2ui/blob/main/agent/python/agent_executor.py)
example in the Agentic UI Toolkit Samples repository for a working multi-agent
executor.

Import the MAUIAgent into your Python code (e.g., `__main__.py` or `agent_executor.py`) and
configure the ADK Agent Executor to call it.
Expand Down Expand Up @@ -167,11 +192,13 @@ To use Grounding Lite MCP, you must first enable the Maps Grounding Lite API and
To use Grounding with Google Maps, there are additional steps you must take to configure your environment:

1. Ensure you have the latest version of the genai python package.

```bash
pip install --upgrade google-genai
```

2. Configure additional environment variables to connect to your project.

```bash
## Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values
## with appropriate values for your project.
Expand All @@ -181,6 +208,7 @@ export GOOGLE_GENAI_USE_VERTEXAI=True
```

3. Ensure you are authenticated to Google Cloud.

```bash
gcloud auth application-default login
```
Expand Down
2 changes: 1 addition & 1 deletion agent/python_agent/agent_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AgentConfig:
generic_model: str = "gemini/gemini-3-flash-preview"
router_thinking_budget: int = 0
extractor_thinking_budget: int = 0
fallback_mode: FallbackMode = FallbackMode.DYNAMIC
fallback_mode: FallbackMode = FallbackMode.TEXT

def __post_init__(self):
if not isinstance(self.fallback_mode, FallbackMode):
Expand Down
41 changes: 32 additions & 9 deletions agent/python_agent/agent_with_grounding.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
from a2ui.schema.common_modifiers import remove_strict_validation
from a2ui.schema.constants import VERSION_0_9
from a2ui.schema.manager import A2uiSchemaManager

# Import MAUIAgent to inherit from it
from .agent import AGENT_INSTRUCTION, MAUIAgent, MergedCatalogProvider
from python_agent.agent import AGENT_INSTRUCTION, MAUIAgent, MergedCatalogProvider

logger = logging.getLogger(__name__)

Expand All @@ -52,11 +51,15 @@
logger.warning("Skill file not found at %s", skill_path)


async def query_vertex_map(query: str) -> str:
async def query_vertex_map(
query: str,
model_id: str = "gemini-3-flash-preview",
) -> str:
"""Query Google Maps via Vertex Grounding and return cleaned response.

Args:
query: The location query or question.
model_id: The model ID to use for Vertex Grounding.

Returns:
The grounded and cleaned A2UI response string.
Expand All @@ -74,8 +77,6 @@ async def query_vertex_map(query: str) -> str:
location = "global"
logger.warning("GOOGLE_CLOUD_LOCATION is not set, defaulting to 'global'.")

model_id = "gemini-3-flash-preview"

client = genai.Client(vertexai=True, project=project_id, location=location)

# Construct instruction
Expand Down Expand Up @@ -203,8 +204,30 @@ async def query_vertex_map(query: str) -> str:
class MAUIAgentWithGrounding(MAUIAgent):
"""An agent that finds restaurants based on user criteria, using Vertex Grounding."""

def __init__(self, base_url: str):
super().__init__(base_url, agent_name="MAUI Agent with Grounding")
def __init__(
self,
base_url: str,
model_name: str = "gemini/gemini-3-flash-preview",
):
super().__init__(
base_url,
agent_name="MAUI Agent with Grounding",
model_name=model_name,
)

async def query_vertex_map(self, query: str) -> str:
"""Query Google Maps via Vertex Grounding and return cleaned response.

Args:
query: The location query or question.

Returns:
The grounded and cleaned A2UI response string.
"""
model_id = (
self._model_name.removeprefix("gemini/").removeprefix("models/")
)
return await query_vertex_map(query, model_id=model_id)

def _build_llm_agent(
self, schema_manager: A2uiSchemaManager | None = None
Expand All @@ -223,7 +246,7 @@ def _build_llm_agent(
skill_manager_tool = skill_toolset.SkillToolset(skills=skills)

# Use FunctionTool for Vertex grounding
grounding_tool = FunctionTool(func=query_vertex_map)
grounding_tool = FunctionTool(func=self.query_vertex_map)

agent_instruction = """You are a location routing agent.
Whenever the user asks a question about a location, directions, places, or maps,
Expand All @@ -245,7 +268,7 @@ def _build_llm_agent(
instruction = agent_instruction

return LlmAgent(
model=LiteLlm(model="gemini/gemini-3-flash-preview"),
model=LiteLlm(model=self._model_name),
name="maui_agent_grounding",
description=(
"An agent that can provide Google Maps UI-enriched responses using"
Expand Down
Loading
Loading