From 372ba9a0d91c6a84fb330b5d52ef93c914bbd988 Mon Sep 17 00:00:00 2001 From: Greyson LaLonde Date: Wed, 14 Jan 2026 05:53:04 -0500 Subject: [PATCH] fix: reorganize type declarations --- lib/crewai/src/crewai/a2a/types.py | 9 --------- lib/crewai/src/crewai/a2a/utils/response_model.py | 7 ++++++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/crewai/src/crewai/a2a/types.py b/lib/crewai/src/crewai/a2a/types.py index b26c2ab56..90473b669 100644 --- a/lib/crewai/src/crewai/a2a/types.py +++ b/lib/crewai/src/crewai/a2a/types.py @@ -3,12 +3,10 @@ from __future__ import annotations from typing import ( - TYPE_CHECKING, Annotated, Any, Literal, Protocol, - TypeAlias, TypedDict, runtime_checkable, ) @@ -27,10 +25,6 @@ from crewai.a2a.updates import ( ) -if TYPE_CHECKING: - from crewai.a2a.config import A2AClientConfig, A2AConfig, A2AServerConfig - - TransportType = Literal["JSONRPC", "GRPC", "HTTP+JSON"] http_url_adapter: TypeAdapter[HttpUrl] = TypeAdapter(HttpUrl) @@ -87,6 +81,3 @@ HANDLER_REGISTRY: dict[type[UpdateConfig], HandlerType] = { StreamingConfig: StreamingHandler, PushNotificationConfig: PushNotificationHandler, } - -A2AConfigTypes: TypeAlias = A2AConfig | A2AServerConfig | A2AClientConfig -A2AClientConfigTypes: TypeAlias = A2AConfig | A2AClientConfig diff --git a/lib/crewai/src/crewai/a2a/utils/response_model.py b/lib/crewai/src/crewai/a2a/utils/response_model.py index 2f19a71ae..44d8a5ba6 100644 --- a/lib/crewai/src/crewai/a2a/utils/response_model.py +++ b/lib/crewai/src/crewai/a2a/utils/response_model.py @@ -2,13 +2,18 @@ from __future__ import annotations +from typing import TypeAlias + from pydantic import BaseModel, Field, create_model from crewai.a2a.config import A2AClientConfig, A2AConfig, A2AServerConfig -from crewai.a2a.types import A2AClientConfigTypes, A2AConfigTypes from crewai.types.utils import create_literals_from_strings +A2AConfigTypes: TypeAlias = A2AConfig | A2AServerConfig | A2AClientConfig +A2AClientConfigTypes: TypeAlias = A2AConfig | A2AClientConfig + + def create_agent_response_model(agent_ids: tuple[str, ...]) -> type[BaseModel]: """Create a dynamic AgentResponse model with Literal types for agent IDs.