Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CrewAIInc CrewAI Platform Action Tool

From Leeroopedia
Knowledge Sources
Domains Tools, Platform_Integration, CrewAI_Platform
Last Updated 2026-02-11 00:00 GMT

Overview

Concrete tool for executing individual platform actions from the CrewAI platform API provided by CrewAI.

Description

The CrewAIPlatformActionTool class extends BaseTool to wrap individual platform actions dynamically. During initialization, it generates a Pydantic schema from the action's JSON schema parameters using create_model_from_schema, falling back to an empty schema if the parameters are invalid. The _run method sends POST requests to the platform API endpoint (/actions/{action_name}/execute) with cleaned kwargs (None values removed), authenticated via bearer token from get_platform_integration_token(). The tool handles error responses by extracting error messages from the JSON response body. It supports SSL verification toggling for factory environments via the CREWAI_FACTORY environment variable. Tool names are derived from the action name, lowercased with spaces replaced by underscores.

Usage

Use this tool when CrewAI agents need to execute specific actions from the CrewAI platform's integration catalog, typically created dynamically by the CrewaiPlatformToolBuilder.

Code Reference

Source Location

  • Repository: CrewAI
  • File: lib/crewai-tools/src/crewai_tools/tools/crewai_platform_tools/crewai_platform_action_tool.py
  • Lines: 1-93

Signature

class CrewAIPlatformActionTool(BaseTool):
    action_name: str = Field(default="", description="The name of the action")
    action_schema: dict[str, Any] = Field(default_factory=dict)

    def __init__(self, description: str, action_name: str,
                 action_schema: dict[str, Any]): ...
    def _run(self, **kwargs: Any) -> str: ...

Import

from crewai_tools.tools.crewai_platform_tools.crewai_platform_action_tool import CrewAIPlatformActionTool

I/O Contract

Inputs

Name Type Required Description
description str Yes Description of the action (constructor)
action_name str Yes Name of the platform action (constructor)
action_schema dict[str, Any] Yes JSON schema describing the action's parameters (constructor)
**kwargs Any No Dynamic keyword arguments matching the action's parameter schema (runtime)

Outputs

Name Type Description
_run() returns str JSON string of the API response data, or error message string

Usage Examples

Basic Usage

from crewai_tools.tools.crewai_platform_tools.crewai_platform_action_tool import CrewAIPlatformActionTool

# Typically created by CrewaiPlatformToolBuilder, not directly
tool = CrewAIPlatformActionTool(
    description="Send a Slack message",
    action_name="slack_send_message",
    action_schema={
        "function": {
            "parameters": {
                "type": "object",
                "properties": {
                    "channel": {"type": "string"},
                    "message": {"type": "string"}
                }
            }
        }
    }
)
result = tool.run(channel="#general", message="Hello from CrewAI!")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment