Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | # composio-crewai |
| 2 | |
| 3 | Adapts Composio tools to CrewAI's `BaseTool` format so your crew's agents can act across 1000+ apps through a single Composio session. |
| 4 | |
| 5 | ## Installation |
| 6 | |
| 7 | ```bash |
| 8 | pip install composio composio-crewai crewai |
| 9 | ``` |
| 10 | |
| 11 | Set `COMPOSIO_API_KEY` (get one from [dashboard.composio.dev/settings](https://dashboard.composio.dev/settings)) and `OPENAI_API_KEY` in your environment: |
| 12 | |
| 13 | ```bash |
| 14 | export COMPOSIO_API_KEY=xxxxxxxxx |
| 15 | export OPENAI_API_KEY=xxxxxxxxx |
| 16 | ``` |
| 17 | |
| 18 | ## Quickstart |
| 19 | |
| 20 | Create a session for your user, fetch its tools, and pass them to an `Agent`. CrewAI runs the task end to end; each tool executes itself through Composio. |
| 21 | |
| 22 | ```python |
| 23 | from crewai import Agent, Crew, Task |
| 24 | from composio import Composio |
| 25 | from composio_crewai import CrewAIProvider |
| 26 | |
| 27 | composio = Composio(provider=CrewAIProvider()) |
| 28 | |
| 29 | # Each session is scoped to one of your users |
| 30 | session = composio.create(user_id="user_123") |
| 31 | tools = session.tools() |
| 32 | |
| 33 | agent = Agent( |
| 34 | role="Email Agent", |
| 35 | goal="Send emails on behalf of the user", |
| 36 | backstory="You are an AI agent that sends emails using Gmail.", |
| 37 | tools=tools, |
| 38 | llm="gpt-5.2", |
| 39 | ) |
| 40 | |
| 41 | task = Task( |
| 42 | description="Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'", |
| 43 | agent=agent, |
| 44 | expected_output="Confirmation that the email was sent", |
| 45 | ) |
| 46 | |
| 47 | crew = Crew(agents=[agent], tasks=[task]) |
| 48 | result = crew.kickoff() |
| 49 | print(result) |
| 50 | ``` |
| 51 | |
| 52 | ## Error handling |
| 53 | |
| 54 | Each Composio tool becomes a CrewAI `BaseTool` whose `args_schema` is built from the tool's input schema, so CrewAI validates arguments before running anything. When validation fails, the tool does not raise; it returns a structured result: |
| 55 | |
| 56 | ```python |
| 57 | {"successful": False, "error": "<validation message>", "data": None} |
| 58 | ``` |
| 59 | |
| 60 | Check `successful` in your task output instead of wrapping calls in `try`/`except`. |
| 61 | |
| 62 | ## Links |
| 63 | |
| 64 | - [CrewAI provider docs](https://docs.composio.dev/docs/providers/crewai) |
| 65 | - [Composio documentation](https://docs.composio.dev) |