Implementation:CrewAIInc CrewAI Invoke Automation Tool
| Knowledge Sources | |
|---|---|
| Domains | Tools, CrewAI_Platform, Automation |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
Invokes external CrewAI Platform automations via API with dynamic input schemas and automatic polling for task completion.
Description
InvokeCrewAIAutomationTool extends BaseTool to enable inter-crew communication through the CrewAI Platform API. It accepts crew_api_url, crew_bearer_token, crew_name, crew_description, and optional crew_inputs for defining a custom input schema. When crew_inputs are provided, the tool dynamically generates a Pydantic model using create_model to build a type-safe args schema; otherwise it defaults to InvokeCrewAIAutomationInput with a single prompt field. The _run() method kicks off the crew via a POST to /kickoff, then polls the /status/{crew_id} endpoint every second until the task succeeds, fails, or reaches the max_polling_time (default: 600 seconds). Bearer token authentication is used for all API calls.
Usage
Use this tool when a CrewAI agent needs to invoke another crew or flow deployed on the CrewAI Platform, enabling microservices-style automation architecture where specialized crews can be composed and orchestrated.
Code Reference
Source Location
- Repository: CrewAI
- File:
lib/crewai-tools/src/crewai_tools/tools/invoke_crewai_automation_tool/invoke_crewai_automation_tool.py - Lines: 1-184
Signature
class InvokeCrewAIAutomationTool(BaseTool):
name: str = "invoke_amp_automation"
description: str = "Invokes an CrewAI Platform Automation using API"
args_schema: type[BaseModel] = InvokeCrewAIAutomationInput
crew_api_url: str
crew_bearer_token: str
max_polling_time: int = 10 * 60 # 600 seconds
def __init__(self, crew_api_url: str, crew_bearer_token: str,
crew_name: str, crew_description: str,
max_polling_time: int = 600,
crew_inputs: dict[str, Any] | None = None): ...
def _run(self, **kwargs) -> str: ...
Import
from crewai_tools import InvokeCrewAIAutomationTool
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| crew_api_url | str | Yes (constructor) | Base URL of the crew API service |
| crew_bearer_token | str | Yes (constructor) | Bearer token for API authentication |
| crew_name | str | Yes (constructor) | Name of the crew (becomes tool name) |
| crew_description | str | Yes (constructor) | Description of the crew (becomes tool description) |
| crew_inputs | dict | No (constructor) | Custom input schema fields for the crew |
| max_polling_time | int | No (constructor) | Maximum polling time in seconds (default: 600)
|
| prompt | str | Yes (runtime, default schema) | The prompt or query to send to the crew |
Outputs
| Name | Type | Description |
|---|---|---|
| _run() returns | str | Crew task result string on success, or an error message on failure or timeout |
Usage Examples
Basic Usage
from crewai_tools import InvokeCrewAIAutomationTool
tool = InvokeCrewAIAutomationTool(
crew_api_url="https://canary-crew-abc123.crewai.com",
crew_bearer_token="your-bearer-token",
crew_name="Research Crew",
crew_description="Performs research on a given topic",
)
result = tool.run(prompt="Research the latest AI agent frameworks")
With Custom Inputs
from pydantic import Field
from crewai_tools import InvokeCrewAIAutomationTool
tool = InvokeCrewAIAutomationTool(
crew_api_url="https://canary-crew-abc123.crewai.com",
crew_bearer_token="your-bearer-token",
crew_name="State of AI Report",
crew_description="Retrieves a report on state of AI for a given year.",
crew_inputs={
"year": Field(..., description="Year to retrieve the report for (integer)"),
},
)
result = tool.run(year="2025")