mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 08:38:30 +00:00
fix: handle missing a2a dep as optional
This commit is contained in:
@@ -1,18 +1,8 @@
|
|||||||
"""Agent-to-Agent (A2A) protocol communication module for CrewAI."""
|
"""Agent-to-Agent (A2A) protocol communication module for CrewAI."""
|
||||||
|
|
||||||
from crewai.a2a.config import A2AConfig
|
from crewai.a2a.config import A2AConfig
|
||||||
from crewai.a2a.errors import A2APollingTimeoutError
|
|
||||||
from crewai.a2a.updates import (
|
|
||||||
PollingConfig,
|
|
||||||
PushNotificationConfig,
|
|
||||||
StreamingConfig,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"A2AConfig",
|
"A2AConfig",
|
||||||
"A2APollingTimeoutError",
|
|
||||||
"PollingConfig",
|
|
||||||
"PushNotificationConfig",
|
|
||||||
"StreamingConfig",
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ This module is separate from experimental.a2a to avoid circular imports.
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Annotated, ClassVar
|
from typing import Annotated, Any, ClassVar
|
||||||
|
|
||||||
from pydantic import (
|
from pydantic import (
|
||||||
BaseModel,
|
BaseModel,
|
||||||
@@ -17,7 +17,12 @@ from pydantic import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from crewai.a2a.auth.schemas import AuthScheme
|
from crewai.a2a.auth.schemas import AuthScheme
|
||||||
from crewai.a2a.updates import StreamingConfig, UpdateConfig
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
from crewai.a2a.updates import UpdateConfig
|
||||||
|
except ImportError:
|
||||||
|
UpdateConfig = Any # type: ignore[misc,assignment]
|
||||||
|
|
||||||
|
|
||||||
http_url_adapter = TypeAdapter(HttpUrl)
|
http_url_adapter = TypeAdapter(HttpUrl)
|
||||||
@@ -30,6 +35,12 @@ Url = Annotated[
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _get_default_update_config() -> UpdateConfig:
|
||||||
|
from crewai.a2a.updates import StreamingConfig
|
||||||
|
|
||||||
|
return StreamingConfig()
|
||||||
|
|
||||||
|
|
||||||
class A2AConfig(BaseModel):
|
class A2AConfig(BaseModel):
|
||||||
"""Configuration for A2A protocol integration.
|
"""Configuration for A2A protocol integration.
|
||||||
|
|
||||||
@@ -68,6 +79,6 @@ class A2AConfig(BaseModel):
|
|||||||
description="If True, return A2A result directly when completed",
|
description="If True, return A2A result directly when completed",
|
||||||
)
|
)
|
||||||
updates: UpdateConfig = Field(
|
updates: UpdateConfig = Field(
|
||||||
default_factory=StreamingConfig,
|
default_factory=_get_default_update_config,
|
||||||
description="Update mechanism config",
|
description="Update mechanism config",
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user