feat: add update mechanism config structure

This commit is contained in:
Greyson LaLonde
2026-01-05 18:46:41 -05:00
parent f8deb0fd18
commit 2d09e6bbcd
7 changed files with 75 additions and 0 deletions

View 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",
]

View File

@@ -0,0 +1 @@
"""Polling update mechanism module."""

View 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"
)

View File

@@ -0,0 +1 @@
"""Push notification update mechanism module."""

View File

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

View File

@@ -0,0 +1 @@
"""Streaming update mechanism module."""

View 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."""