Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

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