fix: reorganize type declarations

This commit is contained in:
Greyson LaLonde
2026-01-14 05:53:04 -05:00
parent 68df061c20
commit 372ba9a0d9
2 changed files with 6 additions and 10 deletions

View File

@@ -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

View File

@@ -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.