Skip to content
Open
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
4 changes: 2 additions & 2 deletions .gemini/GEMINI.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ The A2UI repository is organized into several key directories:
- `angular/`: Clients using Angular.
- `mcp/`: MCP server samples (e.g., `flight_booking`).
- `a2a_agents/`: Contains source code for A2A extension integrations.
- `python/a2ui_extension/`: Python implementation of the A2UI A2A extension.
- `java/`: Java implementation of the A2UI A2A extension.
- `python/a2ui_agent/`: Python implementation of the A2UI agent library.
- `java/`: Java implementation of the A2UI agent library.
- `renderers/`: Contains renderer libraries.
- `lit/`: The shared Lit renderer library used by the Lit clients.
- `tools/`: Helper tools for development.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python_samples_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ on:
- main
paths:
- 'samples/agent/adk/**'
- 'a2a_agents/python/a2ui_extension/**'
- 'a2a_agents/python/a2ui_agent/**'
pull_request:
paths:
- 'samples/agent/adk/**'
- 'a2a_agents/python/a2ui_extension/**'
- 'a2a_agents/python/a2ui_agent/**'

jobs:
build:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
# A2UI Extension Implementation
# A2UI Agent Implementation

a2ui_extension.py is the Python implementation of the a2ui extension.
send_a2ui_to_client_toolset.py is an example Python implementation of using ADK toolcalls to implement A2UI.
The `a2a_agents/python/a2ui_agent/` is the Python implementation of the a2ui agent library.

### Extension Components (`src/a2ui/extension`)

The `src/a2ui/extension` directory contains the core logic for the A2UI agent extension:

* **`a2ui_extension.py`**: Core utilities for extension management and A2UI part handling.
* **`a2ui_schema_utils.py`**: Schema manipulation helpers.
* **`send_a2ui_to_client_toolset.py`**: An example implementation of using ADK toolcalls to implement A2UI.

## Running Tests

1. Navigate to the a2ui_extension dir:
1. Navigate to the a2ui_agent dir:

```bash
cd a2a_agents/python/a2ui_extension
cd a2a_agents/python/a2ui_agent
```

2. Run the tests

```bash
uv run --with pytest pytest tests/*.py
uv run --with pytest pytest tests/
```

## Disclaimer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
[project]
name = "a2ui"
name = "a2ui-agent"
version = "0.1.0"
description = "A2UI Extension"
description = "A2UI Agent"
readme = "README.md"
requires-python = ">=3.10"
dependencies = ["a2a-sdk>=0.3.0"]
dependencies = [
"a2a-sdk>=0.3.0",
"google-adk>=1.8.0",
"google-genai>=1.27.0",
"jsonschema>=4.0.0"
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/a2ui"]

[[tool.uv.index]]
url = "https://pypi.org/simple"
default = true
Expand All @@ -29,3 +37,8 @@ pyink-annotation-pragmas = [
"pyre-",
]

[dependency-groups]
dev = [
"pytest>=9.0.2",
"pytest-asyncio>=1.3.0",
]
13 changes: 13 additions & 0 deletions a2a_agents/python/a2ui_agent/src/a2ui/extension/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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
#
# https://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.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ async def get_schema(ctx: ReadonlyContext) -> dict[str, Any]:
import jsonschema

from a2a import types as a2a_types
from a2ui.a2ui_extension import create_a2ui_part
from a2ui.a2ui_schema_utils import wrap_as_json_array
from a2ui.extension.a2ui_extension import create_a2ui_part
from a2ui.extension.a2ui_schema_utils import wrap_as_json_array
from google.adk.a2a.converters import part_converter
from google.adk.agents.readonly_context import ReadonlyContext
from google.adk.models import LlmRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

from a2a.server.agent_execution import RequestContext
from a2a.types import DataPart, TextPart, Part
from a2ui import a2ui_extension
from a2ui.a2ui_extension import AGENT_EXTENSION_ACCEPTS_INLINE_CATALOGS_KEY, AGENT_EXTENSION_SUPPORTED_CATALOG_IDS_KEY
from a2ui.extension import a2ui_extension
from a2ui.extension.a2ui_extension import AGENT_EXTENSION_ACCEPTS_INLINE_CATALOGS_KEY, AGENT_EXTENSION_SUPPORTED_CATALOG_IDS_KEY
from unittest.mock import MagicMock


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import pytest
from a2ui.a2ui_schema_utils import wrap_as_json_array
from a2ui.extension.a2ui_schema_utils import wrap_as_json_array


def test_wrap_as_json_array():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import pytest

from a2a import types as a2a_types
from a2ui.a2ui_extension import create_a2ui_part
from a2ui.extension.a2ui_extension import create_a2ui_part

from a2ui.send_a2ui_to_client_toolset import convert_send_a2ui_to_client_genai_part_to_a2a_part
from a2ui.send_a2ui_to_client_toolset import SendA2uiToClientToolset
from a2ui.extension.send_a2ui_to_client_toolset import convert_send_a2ui_to_client_genai_part_to_a2a_part
from a2ui.extension.send_a2ui_to_client_toolset import SendA2uiToClientToolset
from google.adk.agents.readonly_context import ReadonlyContext
from google.adk.tools.tool_context import ToolContext
from google.genai import types as genai_types
Expand Down
Loading
Loading