Skip to main content

Use Composio to get an array of tools with Claude Code Agents SDK.

Project description

Composio Claude Code Agents Provider

Use Composio tools with the Claude Code Agents SDK.

Installation

Prerequisites

  1. Claude Code CLI: The Claude Agent SDK requires Claude Code to be installed:

    # macOS/Linux/WSL
    curl -fsSL https://claude.ai/install.sh | bash
    
    # or via Homebrew
    brew install --cask claude-code
    
    # or via npm
    npm install -g @anthropic-ai/claude-code
    
  2. Anthropic API Key: Set your API key as an environment variable:

    export ANTHROPIC_API_KEY="your-api-key"
    

Install the package

pip install composio-claude-agent-sdk

Usage

import asyncio
from composio import Composio
from composio_claude_agent_sdk import ClaudeAgentSDKProvider
from claude_agent_sdk import query, ClaudeAgentOptions

# Initialize Composio with the Claude Code Agents provider
composio = Composio(provider=ClaudeAgentSDKProvider())

async def main():
    # Get tools from Composio
    tools = composio.tools.get(
        user_id="default",
        toolkits=["gmail"],
    )

    # Create an MCP server configuration with the tools
    mcp_server = composio.provider.create_mcp_server(tools)

    # Run a Claude agent with access to Composio tools
    async for message in query(
        prompt="Fetch my latest email from Gmail",
        options=ClaudeAgentOptions(
            mcp_servers={"composio": mcp_server},
            permission_mode="bypassPermissions",
        ),
    ):
        if message.type == "assistant":
            print(message.message)

asyncio.run(main())

API Reference

ClaudeCodeAgentsProvider

The main provider class for integrating Composio tools with Claude Code Agents SDK.

Constructor Options

ClaudeCodeAgentsProvider(
    server_name: str = "composio",  # Name for the MCP server
    server_version: str = "1.0.0",  # Version for the MCP server
)

Methods

  • wrap_tool(tool, execute_tool) - Wraps a single Composio tool as a Claude Agent SDK MCP tool
  • wrap_tools(tools, execute_tool) - Wraps multiple Composio tools
  • create_mcp_server(wrapped_tools) - Creates an MCP server configuration from wrapped tools

Environment Variables

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

composio_claude_agent_sdk-0.13.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

composio_claude_agent_sdk-0.13.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file composio_claude_agent_sdk-0.13.1.tar.gz.

File metadata

File hashes

Hashes for composio_claude_agent_sdk-0.13.1.tar.gz
Algorithm Hash digest
SHA256 891261aaa8d12dfa9c3c7733651d67031d3f851ebfc4155c8783ade2de28c6c4
MD5 5128ccb5660b4fb404372cb6dffce1c5
BLAKE2b-256 38594a3ddd64e5d642063d4f7bda1da36010ef703dea0c5fd7dae48ba23d5c3d

See more details on using hashes here.

File details

Details for the file composio_claude_agent_sdk-0.13.1-py3-none-any.whl.

File metadata

File hashes

Hashes for composio_claude_agent_sdk-0.13.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a83d20e1a0e012d4dde757aae9778d02d4c2a45f9045bda632b96274ea2b569d
MD5 600d91e13fa4e25d2737e5fdf4c670ea
BLAKE2b-256 0c91d4d035d55fe7bc3ef28581129978190dc07e9eaa43fbc0e4198837a990d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page