Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

1.9 KB
Raw Blame
from crewai_core.platform_app_defaults import PLATFORM_APP_DEFAULT_TOOLS
from crewai_core.platform_apps import (
    PLATFORM_CATALOG,
    PLATFORM_APP_CATEGORIES,
    PLATFORM_APP_DISPLAY_NAMES,
    PLATFORM_APP_TOOL_COUNTS,
    PLATFORM_APP_TOOLS,
    PLATFORM_APPLICATION_CATALOG,
    PLATFORM_APPS,
)


def test_platform_apps_contains_supported_application_catalog() -> None:
    assert isinstance(PLATFORM_CATALOG["applications"], list)
    assert len(PLATFORM_APPS) == 129
    assert len(set(PLATFORM_APPS)) == len(PLATFORM_APPS)
    assert PLATFORM_APPS[0] == "airtable"
    assert PLATFORM_APPS[-1] == "pinecone"
    assert set(PLATFORM_APP_DISPLAY_NAMES) == set(PLATFORM_APPS)
    assert set(PLATFORM_APP_TOOL_COUNTS) == set(PLATFORM_APPS)
    assert PLATFORM_APP_DISPLAY_NAMES["github"] == "GitHub"
    assert PLATFORM_APP_TOOL_COUNTS["github"] == 877
    assert tuple(application.slug for application in PLATFORM_APPLICATION_CATALOG) == (
        PLATFORM_APPS
    )
    assert next(
        application for application in PLATFORM_APPLICATION_CATALOG if application.slug == "github"
    ).display_name == "GitHub"


def test_platform_app_default_tools_match_the_catalog() -> None:
    assert len(PLATFORM_APP_DEFAULT_TOOLS) == len(PLATFORM_APPS)
    assert set(PLATFORM_APP_DEFAULT_TOOLS) == set(PLATFORM_APPS)
    for app, defaults in PLATFORM_APP_DEFAULT_TOOLS.items():
        slugs = {tool.slug for tool in PLATFORM_APP_TOOLS[app]}
        assert len(defaults) == 3
        assert set(defaults) <= slugs


def test_platform_app_categories_cover_the_catalog_once() -> None:
    categorized_apps = [
        app for category in PLATFORM_APP_CATEGORIES for app in category.apps
    ]

    assert len(PLATFORM_APP_CATEGORIES) == 12
    assert set(categorized_apps) == set(PLATFORM_APPS)
    assert len(categorized_apps) == len(set(categorized_apps))
    assert PLATFORM_APP_CATEGORIES[0].name == "Google Workspace & Google Cloud"