Run This Ai
EN DE

Getting Started with Composio: Quick Tutorial with Docker & Python SDK

Step-by-step tutorial for setting up Composio with Docker or Python SDK — connect Gmail, Slack, GitHub and 1000+ tools to your AI agent in 10 minutes.

Composio Logo

Getting Started with Composio: Connect Your AI Agent to 1,000+ Tools in 10 Minutes

Alright, let's cut the theory and get our hands dirty. I'm going to walk you through setting up Composio from scratch — connecting an AI agent to real tools — and I'll show you exactly where I got stuck so you don't make the same mistakes.

🚀 Want to deploy Composio yourself?

Docker configs, system requirements, and installation guides — all on one page.

View Composio Tool Page →

Prerequisites

Takes about 2 minutes to check these:

  • ✅ Docker installed (or Node.js 18+ / Python 3.10+)
  • ✅ An API key for Claude, GPT, or Gemini — Composio doesn't include the LLM, just the tools
  • ✅ A free Composio cloud account (or we'll self-host with Docker)

I'll cover both paths: self-hosted with Docker and using the Composio SDK directly.


Option 1: Docker (Self-Hosted, ~3 minutes)

Why I chose Docker: I wanted full control and no data leaving my machine. Composio runs entirely locally this way.

docker pull composio/swe:latest
docker run -d \
  --name composio \
  -p 8080:8080 \
  -v ./data/composio:/data \
  composio/swe:latest

Once it's running, check the logs:

docker logs composio --tail 20

If you see "Server is running on port 8080" — congratulations, you're up! If not, the most common issue is port conflict. Try -p 8081:8080 instead.

🕐 Time spent so far: About 3 minutes including pull time (image is ~500MB).


Option 2: SDK (Python, ~5 minutes)

I actually prefer this approach for prototyping — no Docker, just pip install and go.

pip install composio-core

Then configure your API key:

composio login

⚠️ I got stuck here for 10 minutes. The CLI asked me to open a browser link but I was on a headless server. The fix? Use the API key directly:

export COMPOSIO_API_KEY="your-key-here"

You can get your key from app.composio.dev after signing up.


Connecting Your First Tool: Gmail

Let's connect Gmail so your AI agent can read and send emails. This is where Composio really shines.

from composio import ComposioToolSet

toolset = ComposioToolSet()

# Connect Gmail
toolset.connect_connected_account(
    app_name="gmail",
    auth_mode="OAUTH2"
)

# Now your agent has Gmail access!
tools = toolset.get_tools(apps=["gmail"])
print(f"Loaded {len(tools)} Gmail tools")

The OAuth flow opens a browser window. Sign in with your Google account, and Composio handles the token refresh automatically. No more expired tokens at 3 AM.

Making Your Agent Use the Tools

from openai import OpenAI

client = OpenAI()
response = client.chat.completions.create(
    model="gpt-4o",
    tools=tools,  # Composio provides these
    messages=[{
        "role": "user",
        "content": "Find the latest unread email from John and reply saying I'll review the proposal by Friday."
    }]
)

Your AI agent can now read emails, search the inbox, send replies — all through Composio's unified interface. No separate Gmail API setup.


Common Mistakes I Made (So You Don't Have To)

⚠️ Mistake 1: Forgetting to export the API key. I ran composio login on a headless server and it opened a browser on... nothing. Use export COMPOSIO_API_KEY directly.

🚫 Mistake 2: Using the wrong model. Not all models support tool calling well. GPT-4o and Claude 3.5 Sonnet work great. GPT-3.5? It'll hallucinate tool responses. Stick with the big models.

✅ Pro tip: Use composio add "github gmail slack" to batch-connect multiple apps at once. Found this in the docs after manually connecting each one. Could've saved 15 minutes.


Wrapping Up

In about 10 minutes, you can have a fully functional AI agent connected to Gmail, Slack, GitHub, and hundreds of other tools. The hardest part? Choosing which tools to connect first.

If you get stuck, the Composio docs are actually pretty solid — and the community Discord is active. Jump in and ask questions.

🚀 Explore Composio on Run This Ai

Docker Compose configs, system requirements, installation guides, and more — all in one place.

View Composio Tool Page →
#composio #tutorial #docker #python #ai-agents