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
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ async def get_examples(ctx: ReadonlyContext) -> str:
"""

import inspect
import json
import logging
import re
from typing import (
TYPE_CHECKING,
Any,
Expand All @@ -101,7 +99,6 @@ async def get_examples(ctx: ReadonlyContext) -> str:
Union,
)

import jsonschema

from a2a import types as a2a_types
from a2ui.a2a import (
Expand Down
2 changes: 1 addition & 1 deletion agent_sdks/python/src/a2ui/core/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import re
from typing import List, Optional, Any
from typing import List
from .response_part import ResponsePart
from ..schema.constants import A2UI_OPEN_TAG, A2UI_CLOSE_TAG
from .payload_fixer import parse_and_fix
Expand Down
1 change: 0 additions & 1 deletion agent_sdks/python/src/a2ui/core/parser/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from .constants import *
from ..schema.constants import (
VERSION_0_9,
VERSION_0_8,
A2UI_OPEN_TAG,
A2UI_CLOSE_TAG,
SURFACE_ID_KEY,
Expand Down
3 changes: 1 addition & 2 deletions agent_sdks/python/src/a2ui/core/parser/streaming_v08.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
# limitations under the License.

import re
import json
from typing import Any, List, Dict, Optional, Set

from .streaming import A2uiStreamParser
from .response_part import ResponsePart
from .constants import *
from ..schema.constants import VERSION_0_8, SURFACE_ID_KEY, CATALOG_COMPONENTS_KEY
from ..schema.constants import SURFACE_ID_KEY, CATALOG_COMPONENTS_KEY


class A2uiStreamParserV08(A2uiStreamParser):
Expand Down
2 changes: 1 addition & 1 deletion agent_sdks/python/src/a2ui/core/parser/streaming_v09.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .streaming import A2uiStreamParser
from .response_part import ResponsePart
from .constants import *
from ..schema.constants import VERSION_0_9, SURFACE_ID_KEY, CATALOG_COMPONENTS_KEY
from ..schema.constants import SURFACE_ID_KEY, CATALOG_COMPONENTS_KEY


class A2uiStreamParserV09(A2uiStreamParser):
Expand Down
4 changes: 2 additions & 2 deletions agent_sdks/python/src/a2ui/core/schema/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import json
import logging
import os
from dataclasses import dataclass, field, replace
from typing import Any, Dict, List, Optional, TYPE_CHECKING
from dataclasses import dataclass, replace
from typing import Any, Dict, List, Optional

from .catalog_provider import A2uiCatalogProvider, FileSystemCatalogProvider
from .constants import (
Expand Down
5 changes: 0 additions & 5 deletions agent_sdks/python/src/a2ui/core/schema/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
# limitations under the License.

import copy
import json
import logging
import os
import importlib.resources
from typing import List, Dict, Any, Optional, Callable
from dataclasses import dataclass, field
from .utils import load_from_bundled_resource
from ..inference_strategy import InferenceStrategy
from .constants import *
Expand Down
2 changes: 0 additions & 2 deletions agent_sdks/python/src/a2ui/core/schema/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@
from .constants import (
BASE_SCHEMA_URL,
CATALOG_COMPONENTS_KEY,
CATALOG_ID_KEY,
CATALOG_STYLES_KEY,
VERSION_0_8,
VERSION_0_9,
)

# RFC 6901 compliant regex for JSON Pointer
Expand Down
2 changes: 1 addition & 1 deletion agent_sdks/python/src/a2ui/core/template/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

from ..inference_strategy import InferenceStrategy
from typing import List, Optional, Any
from typing import List


class A2uiTemplateManager(InferenceStrategy):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
# limitations under the License.

import json
from unittest.mock import AsyncMock, MagicMock, patch
from unittest.mock import MagicMock, patch

import pytest

from a2a import types as a2a_types
from a2ui.a2a import create_a2ui_part
from google.adk.agents.invocation_context import InvocationContext
from google.adk.events.event import Event

from a2ui.adk.a2a_extension.send_a2ui_to_client_toolset import (
A2uiEventConverter,
Expand Down
2 changes: 1 addition & 1 deletion agent_sdks/python/tests/core/parser/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import pytest
from a2ui.core.parser.parser import parse_response, ResponsePart
from a2ui.core.parser.parser import parse_response
from a2ui.core.schema.constants import A2UI_OPEN_TAG, A2UI_CLOSE_TAG


Expand Down
2 changes: 0 additions & 2 deletions agent_sdks/python/tests/core/parser/test_payload_fixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import pytest
from a2ui.core.parser.payload_fixer import (
_remove_trailing_commas,
_parse,
Expand Down
5 changes: 0 additions & 5 deletions agent_sdks/python/tests/core/parser/test_streaming_v08.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import copy
from unittest.mock import MagicMock
import pytest
from a2ui.core.schema.constants import (
A2UI_OPEN_TAG,
A2UI_CLOSE_TAG,
VERSION_0_8,
SURFACE_ID_KEY,
CATALOG_COMPONENTS_KEY,
)
from a2ui.core.parser.constants import (
MSG_TYPE_SURFACE_UPDATE,
MSG_TYPE_BEGIN_RENDERING,
MSG_TYPE_DELETE_SURFACE,
MSG_TYPE_DATA_MODEL_UPDATE,
)
from a2ui.core.schema.catalog import A2uiCatalog
from a2ui.core.parser.streaming import A2uiStreamParser
Expand Down
5 changes: 0 additions & 5 deletions agent_sdks/python/tests/core/parser/test_streaming_v09.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import copy
from unittest.mock import MagicMock
import pytest
from a2ui.core.schema.constants import (
A2UI_OPEN_TAG,
A2UI_CLOSE_TAG,
VERSION_0_9,
SURFACE_ID_KEY,
CATALOG_COMPONENTS_KEY,
)
from a2ui.core.parser.constants import (
MSG_TYPE_CREATE_SURFACE,
MSG_TYPE_UPDATE_COMPONENTS,
MSG_TYPE_DELETE_SURFACE,
MSG_TYPE_DATA_MODEL_UPDATE,
)
from a2ui.core.schema.catalog import A2uiCatalog
from a2ui.core.parser.streaming import A2uiStreamParser
Expand Down
3 changes: 0 additions & 3 deletions agent_sdks/python/tests/core/schema/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import os
import pytest
from typing import Any, Dict, List
from a2ui.core.schema.catalog import A2uiCatalog
from a2ui.core.schema.constants import (
A2UI_SCHEMA_BLOCK_START,
Expand Down
1 change: 0 additions & 1 deletion agent_sdks/python/tests/core/schema/test_modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import pytest
from unittest.mock import patch
from a2ui.core.schema.constants import VERSION_0_8
from a2ui.core.schema.manager import A2uiSchemaManager
Expand Down
4 changes: 1 addition & 3 deletions agent_sdks/python/tests/core/schema/test_schema_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import io
import pytest
import json
import os
from unittest.mock import patch, MagicMock, PropertyMock
from unittest.mock import patch, MagicMock
from a2ui.core.schema.manager import A2uiSchemaManager, A2uiCatalog, CatalogConfig
from a2ui.basic_catalog import BasicCatalog
from a2ui.basic_catalog.constants import BASIC_CATALOG_NAME
Expand Down
4 changes: 1 addition & 3 deletions agent_sdks/python/tests/core/schema/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import copy
import pytest
from unittest.mock import MagicMock
from a2ui.core.schema.manager import A2uiSchemaManager, A2uiCatalog, CatalogConfig
from a2ui.core.schema.common_modifiers import remove_strict_validation
from a2ui.core.schema.manager import A2uiCatalog
from a2ui.core.schema.constants import VERSION_0_8, VERSION_0_9
from a2ui.core.schema.validator import (
_find_root_id as find_root_id,
Expand Down
3 changes: 1 addition & 2 deletions samples/agent/adk/component_gallery/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
import logging
from collections.abc import AsyncIterable
from typing import Any, Optional
import json

from a2a.types import DataPart, Part, TextPart
from a2a.types import Part, TextPart
from a2ui.core.schema.constants import A2UI_OPEN_TAG, A2UI_CLOSE_TAG
from a2ui.a2a import create_a2ui_part, parse_response_to_parts

Expand Down
3 changes: 1 addition & 2 deletions samples/agent/adk/component_gallery/agent_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
"""Agent executor for Component Gallery."""

import logging
import json
from a2a.server.agent_execution import AgentExecutor, RequestContext
from a2a.server.events import EventQueue
from a2a.server.tasks import TaskUpdater
from a2a.types import (DataPart, Part, TaskState, TextPart, AgentCard)
from a2a.types import (DataPart, TaskState, TextPart, AgentCard)
from a2a.utils import new_agent_parts_message, new_task
from agent import ComponentGalleryAgent
from a2ui.a2a import try_activate_a2ui_extension
Expand Down
6 changes: 2 additions & 4 deletions samples/agent/adk/contact_lookup/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import logging
import os
from collections.abc import AsyncIterable
from dataclasses import dataclass
from typing import Any, Dict, Optional

import jsonschema
Expand All @@ -31,7 +30,6 @@
AgentCapabilities,
AgentCard,
AgentSkill,
DataPart,
Part,
TextPart,
)
Expand All @@ -41,9 +39,9 @@
from tools import get_contact_info
from a2ui.core.schema.constants import VERSION_0_8, VERSION_0_9, A2UI_OPEN_TAG, A2UI_CLOSE_TAG
from a2ui.core.schema.manager import A2uiSchemaManager
from a2ui.core.parser.parser import parse_response, ResponsePart
from a2ui.core.parser.parser import parse_response
from a2ui.basic_catalog.provider import BasicCatalog
from a2ui.a2a import create_a2ui_part, get_a2ui_agent_extension, parse_response_to_parts
from a2ui.a2a import get_a2ui_agent_extension, parse_response_to_parts

logger = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion samples/agent/adk/contact_lookup/agent_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from a2a.server.tasks import TaskUpdater
from a2a.types import (
DataPart,
Part,
Task,
TaskState,
TextPart,
Expand Down
2 changes: 1 addition & 1 deletion samples/agent/adk/contact_lookup/prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from a2ui.core.schema.constants import VERSION_0_8, VERSION_0_9, A2UI_OPEN_TAG, A2UI_CLOSE_TAG
from a2ui.core.schema.constants import VERSION_0_9, A2UI_OPEN_TAG, A2UI_CLOSE_TAG
from a2ui.core.schema.manager import A2uiSchemaManager
from a2ui.basic_catalog.provider import BasicCatalog

Expand Down
3 changes: 0 additions & 3 deletions samples/agent/adk/custom-components-example/a2ui_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import logging
import os
from pathlib import Path
from typing import Optional
from a2ui.core.schema.constants import VERSION_0_8, VERSION_0_9

import jsonschema

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -162,7 +160,6 @@ def load_close_modal_example(version: Optional[str] = None) -> list[dict]:

def load_send_message_example(contact_name: str, version: Optional[str] = None) -> str:
"""Constructs the JSON string for the send message confirmation."""
from pathlib import Path

examples_dir = Path(os.path.dirname(__file__)) / "examples" / version
action_file = examples_dir / "action_confirmation.json"
Expand Down
9 changes: 3 additions & 6 deletions samples/agent/adk/custom-components-example/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import logging
import os
from collections.abc import AsyncIterable
from dataclasses import dataclass
from typing import Any, Dict, Optional

import jsonschema
Expand All @@ -32,7 +31,6 @@
AgentCapabilities,
AgentCard,
AgentSkill,
DataPart,
Part,
TextPart,
)
Expand All @@ -43,9 +41,9 @@
from a2ui.core.schema.constants import VERSION_0_8, VERSION_0_9, A2UI_OPEN_TAG, A2UI_CLOSE_TAG
from a2ui.core.schema.common_modifiers import remove_strict_validation
from a2ui.core.schema.manager import A2uiSchemaManager
from a2ui.core.parser.parser import parse_response, ResponsePart
from a2ui.core.parser.parser import parse_response
from a2ui.basic_catalog.provider import BasicCatalog
from a2ui.a2a import create_a2ui_part, get_a2ui_agent_extension, parse_response_to_parts
from a2ui.a2a import get_a2ui_agent_extension, parse_response_to_parts

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -182,7 +180,6 @@ async def _handle_action(
return None

from a2ui_examples import (
load_floor_plan_example,
load_close_modal_example,
load_send_message_example,
)
Expand Down Expand Up @@ -237,7 +234,7 @@ async def _handle_action(
}

json_content = json.dumps(load_floor_plan_example(ui_version, html_content))
logger.info(f"--- ContactAgent.stream: Sending Floor Plan ---")
logger.info("--- ContactAgent.stream: Sending Floor Plan ---")

final_response_content = (
f"Here is the floor plan.\n{A2UI_OPEN_TAG}\n{json_content}\n{A2UI_CLOSE_TAG}"
Expand Down
2 changes: 0 additions & 2 deletions samples/agent/adk/custom-components-example/agent_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
# limitations under the License.

import logging
import time

from a2a.server.agent_execution import AgentExecutor, RequestContext
from a2a.server.events import EventQueue
from a2a.server.tasks import TaskUpdater
from a2a.types import (
DataPart,
Part,
Task,
TaskState,
TextPart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import asyncio
from mcp.server import Server
from mcp.types import Resource, TextContent
from mcp.types import Resource

app = Server("floor-plan-server")

Expand Down
Loading