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.

Type tool and app in CrewDefinition (#6395)

Vinicius Brasil04fec31f1ec1
diff --git a/lib/crewai/src/crewai/project/crew_definition.py b/lib/crewai/src/crewai/project/crew_definition.py
index 863e97086..f69787766 100644
--- a/lib/crewai/src/crewai/project/crew_definition.py
+++ b/lib/crewai/src/crewai/project/crew_definition.py
@@ -74,6 +74,44 @@ class CrewAgentDefinition(BaseModel):
description="Additional agent settings passed to the loader.",
examples=[{"llm": "openai/gpt-4o-mini"}],
)
+ tools: list[str | dict[str, Any]] | None = Field(
+ default=None,
+ description=(
+ "Tool refs or serialized tool definitions available to this agent. "
+ "String refs can use CrewAI tool names, `custom:<name>`, or fully "
+ "qualified `module:Class` references."
+ ),
+ examples=[["crewai_tools:SerperDevTool", "custom:file_read"]],
+ )
+ apps: list[str] | None = Field(
+ default=None,
+ description=(
+ "Platform apps available to this agent. Can contain app names such as "
+ "`gmail` or app/action refs such as `gmail/send_email`."
+ ),
+ examples=[["gmail", "slack/send_message"]],
+ )
+ mcps: list[str | dict[str, Any]] | None = Field(
+ default=None,
+ description=(
+ "MCP server refs or serialized MCP server configs available to this "
+ "agent. String refs can use HTTPS URLs, connected MCP integration "
+ "slugs, or refs with a `#tool_name` suffix for specific tools."
+ ),
+ examples=[
+ [
+ "https://api.weather.com/mcp#get_current_weather",
+ "snowflake",
+ "stripe#list_invoices",
+ {
+ "url": "https://api.example.com/mcp",
+ "headers": {"Authorization": "Bearer your_token"},
+ "streamable": True,
+ "cache_tools_list": True,
+ },
+ ]
+ ],
+ )
@field_validator("settings", mode="before")
@classmethod
diff --git a/lib/crewai/tests/test_flow_from_definition.py b/lib/crewai/tests/test_flow_from_definition.py
index 7764037bf..2a718d29d 100644
--- a/lib/crewai/tests/test_flow_from_definition.py
+++ b/lib/crewai/tests/test_flow_from_definition.py
@@ -1328,6 +1328,9 @@ def test_crew_action_json_schema_describes_inline_crew_definitions():
"goal",
"backstory",
"settings",
+ "tools",
+ "apps",
+ "mcps",
}
assert set(schema_defs["CrewTaskDefinition"]["properties"]) >= {
"description",