mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-24 15:48:23 +00:00
feat: add update mechanism config structure
This commit is contained in:
15
lib/crewai/src/crewai/a2a/updates/__init__.py
Normal file
15
lib/crewai/src/crewai/a2a/updates/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
"""A2A update mechanism configuration types."""
|
||||||
|
|
||||||
|
from crewai.a2a.updates.polling.config import PollingConfig
|
||||||
|
from crewai.a2a.updates.push_notifications.config import PushNotificationConfig
|
||||||
|
from crewai.a2a.updates.streaming.config import StreamingConfig
|
||||||
|
|
||||||
|
|
||||||
|
UpdateConfig = PollingConfig | StreamingConfig | PushNotificationConfig
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"PollingConfig",
|
||||||
|
"PushNotificationConfig",
|
||||||
|
"StreamingConfig",
|
||||||
|
"UpdateConfig",
|
||||||
|
]
|
||||||
1
lib/crewai/src/crewai/a2a/updates/polling/__init__.py
Normal file
1
lib/crewai/src/crewai/a2a/updates/polling/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
"""Polling update mechanism module."""
|
||||||
23
lib/crewai/src/crewai/a2a/updates/polling/config.py
Normal file
23
lib/crewai/src/crewai/a2a/updates/polling/config.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
"""Polling update mechanism configuration."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
|
class PollingConfig(BaseModel):
|
||||||
|
"""Configuration for polling-based task updates.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
interval: Seconds between poll attempts.
|
||||||
|
timeout: Max seconds to poll before raising timeout error.
|
||||||
|
max_polls: Max number of poll attempts.
|
||||||
|
history_length: Number of messages to retrieve per poll.
|
||||||
|
"""
|
||||||
|
|
||||||
|
interval: float = Field(default=2.0, description="Seconds between poll attempts")
|
||||||
|
timeout: float | None = Field(default=None, description="Max seconds to poll")
|
||||||
|
max_polls: int | None = Field(default=None, description="Max poll attempts")
|
||||||
|
history_length: int = Field(
|
||||||
|
default=100, description="Messages to retrieve per poll"
|
||||||
|
)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Push notification update mechanism module."""
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
"""Push notification update mechanism configuration."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
from crewai.a2a.auth.schemas import AuthScheme
|
||||||
|
|
||||||
|
|
||||||
|
class PushNotificationConfig(BaseModel):
|
||||||
|
"""Configuration for webhook-based task updates.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
url: Callback URL where agent sends push notifications.
|
||||||
|
id: Unique identifier for this config.
|
||||||
|
token: Token to validate incoming notifications.
|
||||||
|
authentication: Auth scheme for the callback endpoint.
|
||||||
|
"""
|
||||||
|
|
||||||
|
url: str = Field(description="Callback URL for push notifications")
|
||||||
|
id: str | None = Field(default=None, description="Unique config identifier")
|
||||||
|
token: str | None = Field(default=None, description="Validation token")
|
||||||
|
authentication: AuthScheme | None = Field(
|
||||||
|
default=None, description="Authentication for callback endpoint"
|
||||||
|
)
|
||||||
1
lib/crewai/src/crewai/a2a/updates/streaming/__init__.py
Normal file
1
lib/crewai/src/crewai/a2a/updates/streaming/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
"""Streaming update mechanism module."""
|
||||||
9
lib/crewai/src/crewai/a2a/updates/streaming/config.py
Normal file
9
lib/crewai/src/crewai/a2a/updates/streaming/config.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
"""Streaming update mechanism configuration."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class StreamingConfig(BaseModel):
|
||||||
|
"""Configuration for SSE-based task updates."""
|
||||||
Reference in New Issue
Block a user