Skip to main content

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

Project description

composio-claude-agent-sdk

Adapts Composio tools to the Claude Agent SDK, exposing them to Claude through an in-process MCP server.

Installation

pip install composio composio-claude-agent-sdk claude-agent-sdk

The Claude Agent SDK also requires the Claude Code CLI: npm install -g @anthropic-ai/claude-code.

Set COMPOSIO_API_KEY (from the dashboard) and ANTHROPIC_API_KEY in your environment.

Quickstart

import asyncio

from composio import Composio
from composio_claude_agent_sdk import ClaudeAgentSDKProvider
from claude_agent_sdk import (
    AssistantMessage,
    ClaudeAgentOptions,
    TextBlock,
    create_sdk_mcp_server,
    query,
)

composio = Composio(provider=ClaudeAgentSDKProvider())

# Each session is scoped to one of your users
session = composio.create(user_id="user_123")
tools = session.tools()

server = create_sdk_mcp_server(name="composio", version="1.0.0", tools=tools)


async def main():
    options = ClaudeAgentOptions(
        system_prompt="You are a helpful assistant. Use tools to complete tasks.",
        permission_mode="bypassPermissions",
        mcp_servers={"composio": server},
    )
    async for message in query(prompt="Summarize my emails from today", options=options):
        if isinstance(message, AssistantMessage):
            for block in message.content:
                if isinstance(block, TextBlock):
                    print(block.text)


asyncio.run(main())

For multi-turn use, store session.session_id and reuse it with composio.use(session_id) instead of calling create() again.

How tools are exposed

session.tools() returns SdkMcpTool objects that plug straight into create_sdk_mcp_server. The provider also ships composio.provider.create_mcp_server(tools) if you prefer a preconfigured server (name composio, customizable via ClaudeAgentSDKProvider(server_name=..., server_version=...)).

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.18.0.tar.gz (6.0 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.18.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for composio_claude_agent_sdk-0.18.0.tar.gz
Algorithm Hash digest
SHA256 d1aecbb7c711bbe86a64e46ad73658727cc8a0d8fee7bc63c8d37754f6df8a3c
MD5 9f3e7e614947c1fbeb19d29fe0a22f03
BLAKE2b-256 babfffd47287261063f664b9214a1a751a202930f4bbaaf02a884e1e639dd6b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for composio_claude_agent_sdk-0.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 776ec4ee42b076b5a34ca13f17d04cbef949292731759682ae8c937e615fa342
MD5 c14b33c572df6f2aff74ebb0b8256c87
BLAKE2b-256 bef6bb6881ed007b0533cfe5b7cd1cfff96b7354458373066b8c7917f6149e10

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