TechSetupGuides
Intermediateaiagentstoolkitmcppythontypescriptlangchainllamaindexopenaianthropic

Composio: AI toolkit orchestration platform

Power 1000+ toolkits, tool search, context management, authentication, and sandboxed workbench for building AI agents that turn intent into action.

  1. Step 1

    What is Composio?

    Composio is a powerful platform that enables AI agents to interact with real-world applications and services. It provides access to 1000+ toolkits, handling tool search, context management, authentication, and execution. Composio powers AI agents with the ability to turn natural language intent into concrete actions across platforms like GitHub, Gmail, Slack, and hundreds more.

    Key capabilities:

    • 1000+ Toolkits: Pre-built integrations for popular services
    • Authentication Management: Handle OAuth and API keys automatically
    • Context-Aware Tools: Dynamic tool selection based on conversation context
    • Provider Integrations: Works with OpenAI, Anthropic, LangChain, CrewAI, LlamaIndex and more
    • MCP Server Support: Deploy as Model Context Protocol servers
  2. Step 2

    Technology stack

    Composio is a polyglot platform with both TypeScript and Python SDKs:

    TypeScript SDK:

    • TypeScript 5
    • Node.js runtime with edge support (Cloudflare Workers)
    • Zod for schema validation
    • tsdown for building
    • Vitest for testing
    • pnpm package manager
    • Changesets for version management

    Python SDK:

    • Python 3.10+
    • Pydantic for validation
    • pytest for testing
    • Nox for CI/CD workflows
    • Poetry/pip for package management

    Architecture:

    • Modular SDK design with separate provider packages
    • API client generated from OpenAPI specs
    • Platform-specific builds for Node and workerd (Cloudflare)
    • TypeScript/Python language parity for core functionality
    TypeScript SDK:
    ├── TypeScript 5
    ├── Zod (schema validation)
    ├── tsdown (bundler)
    ├── Vitest (testing)
    ├── pnpm (package manager)
    └── Changesets (versioning)
    
    Python SDK:
    ├── Python 3.10+
    ├── Pydantic (validation)
    ├── pytest (testing)
    ├── Nox (CI/CD)
    └── Poetry/pip (package management)
  3. Step 3

    Prerequisites

    Before getting started with Composio, you'll need:

    For TypeScript:

    • Node.js 18+ or any edge runtime (Cloudflare Workers)
    • npm, yarn, or pnpm package manager
    • A Composio API key from https://composio.dev

    For Python:

    • Python 3.10 or higher
    • pip or poetry package manager
    • A Composio API key from https://composio.dev

    Optional AI Provider Keys:

    • OpenAI API key for OpenAI integrations
    • Anthropic API key for Claude integrations
    • Other provider keys as needed
    # Check Node.js version (18+ recommended)
    node --version
    
    # Check Python version (3.10+ required)
    python --version
    
    # Get your Composio API key from https://composio.dev
    # Then set it as an environment variable
    export COMPOSIO_API_KEY="your-api-key-here"
  4. Step 4

    TypeScript SDK installation

    Install the Composio TypeScript SDK using your preferred package manager. The core package provides all essential functionality.

    # Using npm
    npm install @composio/core
    
    # Using yarn
    yarn add @composio/core
    
    # Using pnpm
    pnpm add @composio/core
    
    # Verify installation
    npm list @composio/core
  5. Step 5

    Python SDK installation

    Install the Composio Python SDK. You can install the core package alone or with specific provider integrations.

    # Core package only
    pip install composio
    # or
    pip install composio-core
    
    # With OpenAI integration
    pip install composio-openai
    
    # With LangChain integration
    pip install composio-langchain
    
    # With CrewAI integration
    pip install composio-crewai
    
    # Verify installation
    python -c "import composio; print(composio.__version__)"
  6. Step 6

    Core SDK usage - TypeScript

    Initialize the Composio SDK and start using tools. The SDK handles authentication and tool execution automatically.

    import { Composio } from '@composio/core';
    
    // Initialize the SDK with your API key
    const composio = new Composio({
      apiKey: process.env.COMPOSIO_API_KEY,
    });
    
    // Get tools from specific toolkits
    const tools = await composio.tools.get('default', {
      toolkits: ['github', 'gmail'],
    });
    
    // Get a specific tool
    const specificTool = await composio.tools.get(
      'default', 
      'GITHUB_GET_REPOS'
    );
    
    // Execute a tool
    const result = await composio.tools.execute(
      'GITHUB_GET_REPO',
      {
        userId: 'default',
        arguments: {
          owner: 'composiohq',
          repo: 'composio',
        },
      }
    );
    
    console.log(result.data);
  7. Step 7

    Core SDK usage - Python

    Initialize the Composio Python SDK and start using tools with the same capabilities as TypeScript.

    from composio import Composio
    
    # Initialize the SDK with your API key
    composio = Composio(
        api_key="your-api-key",  # Or use COMPOSIO_API_KEY env var
    )
    
    # Get tools from specific toolkits
    tools = composio.tools.get(
        user_id="default",
        toolkits=["github", "gmail"]
    )
    
    # Get a specific tool
    specific_tool = composio.tools.get(
        user_id="default",
        slug="GITHUB_GET_REPOS"
    )
    
    # Execute a tool
    result = composio.tools.execute(
        "GITHUB_GET_REPO",
        arguments={
            "owner": "composiohq",
            "repo": "composio",
        }
    )
    
    print(result.data)
  8. Step 8

    OpenAI Agents integration - TypeScript

    Use Composio with OpenAI's Agents SDK for sophisticated agent workflows with tool use.

    import { Composio } from '@composio/core';
    import { OpenAIAgentsProvider } from '@composio/openai-agents';
    import { Agent, run } from '@openai/agents';
    
    // Initialize Composio with OpenAI Agents provider
    const composio = new Composio({
      provider: new OpenAIAgentsProvider(),
    });
    
    const userId = 'user@acme.org';
    
    // Get HackerNews tools
    const tools = await composio.tools.get(userId, {
      toolkits: ['HACKERNEWS'],
    });
    
    // Create an agent with the tools
    const agent = new Agent({
      name: 'Hackernews assistant',
      instructions: 'You fetch and summarize HackerNews posts.',
      tools: tools,
    });
    
    // Run the agent
    const result = await run(
      agent,
      'What is the latest hackernews post about?'
    );
    
    console.log(JSON.stringify(result.finalOutput, null, 2));
  9. Step 9

    OpenAI Agents integration - Python

    Use Composio with OpenAI's Agents SDK in Python for the same powerful agent capabilities.

    import asyncio
    from agents import Agent, Runner
    from composio import Composio
    from composio_openai_agents import OpenAIAgentsProvider
    
    # Initialize Composio client with OpenAI Agents Provider
    composio = Composio(provider=OpenAIAgentsProvider())
    
    user_id = "user@acme.org"
    
    # Get HackerNews tools
    tools = composio.tools.get(
        user_id=user_id, 
        toolkits=["HACKERNEWS"]
    )
    
    # Create an agent with the tools
    agent = Agent(
        name="Hackernews Agent",
        instructions="You are a helpful assistant.",
        tools=tools,
    )
    
    # Run the agent
    async def main():
        result = await Runner.run(
            starting_agent=agent,
            input="What's the latest Hackernews post about?",
        )
        print(result.final_output)
    
    asyncio.run(main())
  10. Step 10

    LangChain integration - Python

    Integrate Composio with LangChain for agent-based workflows with tool use and memory.

    from composio_langchain import ComposioToolSet
    from langchain_openai import ChatOpenAI
    from langchain.agents import create_openai_functions_agent, AgentExecutor
    from langchain.prompts import ChatPromptTemplate
    
    # Initialize the toolset
    toolset = ComposioToolSet()
    
    # Get tools for specific toolkits
    tools = toolset.get_tools(toolkits=["GITHUB"])
    
    # Initialize LLM
    llm = ChatOpenAI(model="gpt-4o")
    
    # Create prompt template
    prompt = ChatPromptTemplate.from_messages([
        ("system", "You are a helpful assistant with GitHub access"),
        ("user", "{input}"),
        ("assistant", "{agent_scratchpad}")
    ])
    
    # Create agent with tools
    agent = create_openai_functions_agent(llm, tools, prompt)
    agent_executor = AgentExecutor(agent=agent, tools=tools)
    
    # Execute task
    result = agent_executor.invoke({
        "input": "Star the composiohq/composio repository"
    })
    print(result)
  11. Step 11

    LangChain integration - TypeScript

    Use Composio with LangChain in TypeScript for the same powerful agent capabilities.

    import { ComposioToolSet } from '@composio/langchain';
    import { ChatOpenAI } from '@langchain/openai';
    import { createOpenAIFunctionsAgent, AgentExecutor } from 'langchain/agents';
    import { ChatPromptTemplate } from '@langchain/core/prompts';
    
    // Initialize the toolset
    const toolset = new ComposioToolSet();
    
    // Get tools for specific toolkits
    const tools = await toolset.getTools({
      toolkits: ['GITHUB']
    });
    
    // Initialize LLM
    const llm = new ChatOpenAI({
      model: 'gpt-4o'
    });
    
    // Create prompt template
    const prompt = ChatPromptTemplate.fromMessages([
      ['system', 'You are a helpful assistant with GitHub access'],
      ['human', '{input}'],
      ['placeholder', '{agent_scratchpad}']
    ]);
    
    // Create agent with tools
    const agent = createOpenAIFunctionsAgent({
      llm,
      tools,
      prompt
    });
    
    const agentExecutor = new AgentExecutor({
      agent,
      tools,
      returnIntermediateSteps: true
    });
    
    // Execute task
    const result = await agentExecutor.invoke({
      input: "Star the composiohq/composio repository"
    });
    console.log(result);
  12. Step 12

    Available provider integrations

    Composio supports multiple AI frameworks and platforms. Install the provider package you need:

    TypeScript providers:

    • @composio/openai - OpenAI native integration
    • @composio/openai-agents - OpenAI Agents SDK
    • @composio/anthropic - Anthropic Claude
    • @composio/langchain - LangChain
    • @composio/llamaindex - LlamaIndex
    • @composio/vercel - Vercel AI SDK
    • @composio/google - Google Gemini
    • @composio/mastra - Mastra framework
    • @composio/cloudflare - Cloudflare Workers AI

    Python providers:

    • composio-openai - OpenAI native integration
    • composio-openai-agents - OpenAI Agents SDK
    • composio-anthropic - Anthropic Claude
    • composio-langchain - LangChain
    • composio-langgraph - LangGraph
    • composio-llamaindex - LlamaIndex
    • composio-crewai - CrewAI
    • composio-autogen - AutoGen
    • composio-gemini - Google Gemini
    • composio-google-adk - Google ADK
    # TypeScript - install specific providers
    npm install @composio/openai
    npm install @composio/langchain
    npm install @composio/llamaindex
    npm install @composio/anthropic
    npm install @composio/google
    
    # Python - install specific providers
    pip install composio-openai
    pip install composio-langchain
    pip install composio-llamaindex
    pip install composio-crewai
    pip install composio-autogen
  13. Step 13

    Connected accounts management

    Composio handles authentication to third-party services through connected accounts. This manages OAuth flows and API keys automatically.

    import { Composio } from '@composio/core';
    
    const composio = new Composio({
      apiKey: process.env.COMPOSIO_API_KEY,
    });
    
    // List all connected accounts for a user
    const accounts = await composio.connectedAccounts.list('default');
    console.log('Connected accounts:', accounts);
    
    // Create a new connection to a service
    const connection = await composio.connectedAccounts.create('default', {
      toolkitId: 'github',
    });
    
    // Get the authorization URL
    console.log('Authorize at:', connection.redirectUrl);
    
    // After user authorizes, check status
    const status = await composio.connectedAccounts.get('default', 'github');
    console.log('Connection status:', status.status);
  14. Step 14

    Creating custom tools

    Extend Composio with your own custom tools for services not covered by the 1000+ built-in toolkits.

    import { Composio } from '@composio/core';
    import { z } from 'zod';
    
    const composio = new Composio({
      apiKey: process.env.COMPOSIO_API_KEY,
    });
    
    // Create a custom tool with Zod schema
    const customTool = await composio.tools.createCustomTool({
      name: 'Weather Forecast',
      description: 'Get the weather forecast for a location',
      slug: 'WEATHER_FORECAST',
      inputParams: z.object({
        location: z.string().describe('The location to get the forecast for'),
        days: z.number().optional().default(3).describe('Number of days')
      }),
      execute: async (input) => {
        try {
          const { location, days = 3 } = input;
          
          // Your implementation here
          const forecast = [
            { date: '2025-05-21', temperature: 72, conditions: 'Sunny' },
          ];
          
          return {
            data: { forecast },
            successful: true,
            error: null,
          };
        } catch (error) {
          return {
            data: {},
            successful: false,
            error: error.message,
          };
        }
      },
    });
    
    // Use the custom tool with an LLM
    const tools = [customTool];
    // Pass to your AI provider...
  15. Step 15

    Tool search and discovery

    Search and discover tools from the 1000+ available toolkits in the Composio ecosystem.

    import { Composio } from '@composio/core';
    
    const composio = new Composio({
      apiKey: process.env.COMPOSIO_API_KEY,
    });
    
    // List all available toolkits
    const toolkits = await composio.toolkits.list();
    console.log('Available toolkits:', toolkits);
    
    // Search for specific toolkits
    const searchResults = await composio.toolkits.search('github');
    console.log('GitHub toolkits:', searchResults);
    
    // Get a specific toolkit
    const githubToolkit = await composio.toolkits.get('github');
    console.log('GitHub toolkit:', githubToolkit);
    
    // List all tools in a toolkit
    const tools = await githubToolkit.tools.list();
    console.log('GitHub tools:', tools);
    
    // Get a specific tool details
    const repoTool = await githubToolkit.tools.get('GITHUB_GET_REPO');
    console.log('Get repo tool:', repoTool);
  16. Step 16

    Middleware and modifiers

    Composio supports middleware and modifiers to customize tool behavior, add logging, transform inputs/outputs, and modify tool schemas dynamically.

    import { Composio } from '@composio/core';
    
    const composio = new Composio({
      apiKey: process.env.COMPOSIO_API_KEY,
    });
    
    // Get tools with a modifier
    const modifiedTools = await composio.tools.get('default', {
      toolkits: ['github'],
      modifiers: {
        // Add custom middleware
        addContext: true,  // Add conversation context
        fileUploads: { 
          enabled: true,   // Enable file uploads
          maxFiles: 5,
        },
      },
    });
    
    // Tools are automatically enhanced with modifiers
    console.log('Modified tools:', modifiedTools);
  17. Step 17

    Project structure

    The Composio repository is organized as a monorepo with separate packages for TypeScript and Python SDKs:

    TypeScript structure:

    • /ts/packages/core - Core SDK
    • /ts/packages/providers/* - Provider implementations
    • /ts/examples - Example applications
    • /ts/docs - Documentation

    Python structure:

    • /python/composio - Core SDK
    • /python/providers/* - Provider implementations
    • /python/examples - Example applications
    • /python/docs - Documentation
    composio/
    ├── ts/
    │   ├── packages/
    │   │   ├── core/            @composio/core
    │   │   ├── providers/       @composio/{provider}
    │   │   ├── cli/             CLI tools
    │   │   └── json-schema-to-zod
    │   ├── examples/
    │   ├── docs/
    │   └── scripts/
    ├── python/
    │   ├── composio/           composio-core
    │   ├── providers/          composio-{provider}
    │   ├── examples/
    │   └── docs/
    └── README.md
  18. Step 18

    Resources

    Official documentation: https://docs.composio.dev

    Website: https://composio.dev

    GitHub repository: https://github.com/ComposioHQ/composio

    Discord community: https://discord.gg/composio

    Rube MCP Server: https://rube.app (MCP server built with Composio)

    Documentation: https://docs.composio.dev
    Website: https://composio.dev
    GitHub: https://github.com/ComposioHQ/composio
    Discord: https://discord.gg/composio
    Rube MCP: https://rube.app
  19. Step 19

    Package details

    TypeScript packages:

    • @composio/core v0.10.0 - Main SDK
    • @composio/json-schema-to-zod - Utility for schema conversion

    Python packages:

    • composio / composio-core - Main SDK
    • Individual provider packages for each integration

    Language breakdown:

    • TypeScript: 4.6M lines (main language)
    • Python: 1.3M lines
    • Shell scripts, Swift (iOS app), JavaScript, Docker, Makefile

    License: MIT

    Languages:
    - TypeScript: 4,602,401 lines
    - Python: 1,281,665 lines  
    - Swift: 39,158 lines
    - Shell: 48,599 lines
    - JavaScript: 33,389 lines
    - Makefile: 1,527 lines
    - Dockerfile: 994 lines
    
    Packages:
    - @composio/core (npm)
    - composio (pypi)
    - 20+ provider packages for both ecosystems

Feature requests

Sign in to suggest features or vote on existing ones.

No feature requests yet.

Discussion

0 people marked this as worked·Sign in to mark your own.

Sign in to join the discussion.

No comments yet.