From 4708ec9f3192789d82d9553d3f177ba9b4ff4c25 Mon Sep 17 00:00:00 2001 From: ViditOstwal Date: Thu, 10 Sep 2026 22:06:24 +0530 Subject: [PATCH] fix: preserve platform application typing --- lib/crewai-core/src/crewai_core/platform_apps.py | 8 +++++--- lib/crewai/src/crewai/agents/agent_builder/base_agent.py | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/crewai-core/src/crewai_core/platform_apps.py b/lib/crewai-core/src/crewai_core/platform_apps.py index 328684b5c..5817fb412 100644 --- a/lib/crewai-core/src/crewai_core/platform_apps.py +++ b/lib/crewai-core/src/crewai_core/platform_apps.py @@ -1,9 +1,9 @@ """CrewAI Platform application catalog.""" -from typing import Final +from typing import Final, Literal, get_args -PLATFORM_APPS: Final[tuple[str, ...]] = ( +PlatformApp = Literal[ "asana", "box", "clickup", @@ -20,4 +20,6 @@ PLATFORM_APPS: Final[tuple[str, ...]] = ( "slack", "stripe", "zendesk", -) +] + +PLATFORM_APPS: Final[tuple[str, ...]] = (*get_args(PlatformApp),) diff --git a/lib/crewai/src/crewai/agents/agent_builder/base_agent.py b/lib/crewai/src/crewai/agents/agent_builder/base_agent.py index 05543eea0..1693117eb 100644 --- a/lib/crewai/src/crewai/agents/agent_builder/base_agent.py +++ b/lib/crewai/src/crewai/agents/agent_builder/base_agent.py @@ -9,6 +9,7 @@ import re from typing import TYPE_CHECKING, Annotated, Any, Final, Literal import uuid +from crewai_core.platform_apps import PLATFORM_APPS, PlatformApp from pydantic import ( UUID4, BaseModel, @@ -57,6 +58,9 @@ from crewai.utilities.rpm_controller import RPMController from crewai.utilities.string_utils import interpolate_only +__all__ = ["PLATFORM_APPS"] + + if TYPE_CHECKING: from crewai.context import ExecutionContext from crewai.crew import Crew @@ -180,8 +184,7 @@ _SLUG_RE: Final[re.Pattern[str]] = re.compile( ) -PlatformApp = str -PlatformAppOrAction = str +PlatformAppOrAction = PlatformApp | str class BaseAgent(BaseModel, ABC, metaclass=AgentMeta):