CrewAI Provider

CrewAI Provider

The CrewAI Provider is a provider that formats the Composio tools into an object compatible with CrewAI’s tool calling capabilities. Agents and LLM workflows built with this can call and execute the Composio tools.

Setup

The CrewAI provider is available for only the Python SDK.

Python
1pip install composio[crewai]

Usage

Python
1from crewai import Agent, Crew, Task
2from langchain_openai import ChatOpenAI
3
4from composio import Composio
5from composio_crewai import CrewAIProvider
6
7# Initialize tools.
8openai_client = ChatOpenAI()
9composio = Composio(provider=CrewAIProvider())
10
11# Get All the tools
12tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
13
14# Define agent
15crewai_agent = Agent(
16 role="Github Agent",
17 goal="""You take action on Github using Github APIs""",
18 backstory=(
19 "You are AI agent that is responsible for taking actions on Github "
20 "on users behalf. You need to take action on Github using Github APIs"
21 ),
22 verbose=True,
23 tools=tools,
24 llm=openai_client,
25)
26
27# Define task
28task = Task(
29 description=(
30 "Star a repo composiohq/composio on GitHub, if the action is successful "
31 "include Action executed successfully"
32 ),
33 agent=crewai_agent,
34 expected_output="if the star happened",
35)
36
37my_crew = Crew(agents=[crewai_agent], tasks=[task])
38result = my_crew.kickoff()
39print(result)