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.1.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.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for composio_claude_agent_sdk-0.18.1.tar.gz
Algorithm Hash digest
SHA256 619c81dd081236cde31a1abc4ba79937514cdc190ba2ca7a5419e89829d305fc
MD5 6602fe683d80a3d374da0d713ac35e89
BLAKE2b-256 3365b41c6a6b4db6b2f4e5a5472c05160f8e420a81a48172836e5fe1a4722a51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for composio_claude_agent_sdk-0.18.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79f8b589a64eb0ec3bf91fa1e8b76cceb72dbf9044a59bde43d94f7c0dbb0d5f
MD5 edf70f7be1a8d5c7a417b40b7a68011b
BLAKE2b-256 ae376ed4dc158791622b829d13e8cb53cfc6e44b1ced54220996a37281034e51

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