Implementation:CrewAIInc CrewAI Platform Tool Builder
| Knowledge Sources | |
|---|---|
| Domains | Tools, Platform_Integration, CrewAI_Platform |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
Concrete builder class for fetching action schemas from the CrewAI platform API and dynamically building tool instances provided by CrewAI.
Description
The CrewaiPlatformToolBuilder class automates the discovery and instantiation of platform tools at runtime. Initialized with a list of app names, it fetches available action schemas for those apps from the platform API (/actions endpoint) with bearer token authentication and comma-separated app filter parameters. The _fetch_actions method parses the response to extract action schemas with names, descriptions, and parameters organized by app category. The _create_tools method creates CrewAIPlatformActionTool instances for each discovered action. The class implements a lazy loading pattern where tools are fetched on first access via the tools() method. It also implements the context manager protocol (__enter__/__exit__) for convenient tool access. Supports SSL verification toggling for factory environments via CREWAI_FACTORY env var.
Usage
Use this builder when developers need to dynamically discover and instantiate platform tools for specific apps, enabling extensibility as new platform integrations are added without code changes.
Code Reference
Source Location
- Repository: CrewAI
- File: lib/crewai-tools/src/crewai_tools/tools/crewai_platform_tools/crewai_platform_tool_builder.py
- Lines: 1-110
Signature
class CrewaiPlatformToolBuilder:
def __init__(self, apps: list[str]) -> None: ...
def tools(self) -> list[BaseTool]: ...
def _fetch_actions(self) -> None: ...
def _create_tools(self) -> None: ...
def __enter__(self) -> list[BaseTool]: ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
Import
from crewai_tools.tools.crewai_platform_tools.crewai_platform_tool_builder import CrewaiPlatformToolBuilder
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| apps | list[str] | Yes | List of app names to fetch tools for (constructor) |
Outputs
| Name | Type | Description |
|---|---|---|
| tools() returns | list[BaseTool] | List of CrewAIPlatformActionTool instances built from fetched action schemas |
Usage Examples
Basic Usage
from crewai_tools.tools.crewai_platform_tools.crewai_platform_tool_builder import CrewaiPlatformToolBuilder
# Direct usage
builder = CrewaiPlatformToolBuilder(apps=["slack", "github"])
tools = builder.tools()
# Context manager usage
with CrewaiPlatformToolBuilder(apps=["slack"]) as tools:
for tool in tools:
print(tool.name)