Use Composio to get an array of tools with your Anthropic LLMs.
Actively maintained. Last release 5 days ago, commits in 26 of the last 26 weeks. A safe choice.
pip install composio-anthropiccomposio-anthropic
Adapts Composio tools to the Claude Messages API tool format and executes the tool calls Claude returns.
Installation
pip install composio composio-anthropic anthropic
Set COMPOSIO_API_KEY (create one at https://dashboard.composio.dev/settings) and ANTHROPIC_API_KEY in your environment.
Quickstart
AnthropicProvider is non-agentic: Claude returns tool_use blocks, handle_tool_calls executes them, and you send the results back as tool_result blocks.
import json
import anthropic
from composio import Composio
from composio_anthropic import AnthropicProvider
composio = Composio(provider=AnthropicProvider())
client = anthropic.Anthropic()
# Create a session for your user
session = composio.create(user_id="user_123")
tools = session.tools()
messages = [
{"role": "user", "content": "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'"}
]
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=4096,
tools=tools,
messages=messages,
)
# Agentic loop: keep executing tool calls until the model responds with text
while response.stop_reason == "tool_use":
# Results retain each tool_use ID; Python still needs explicit content blocks.
results = composio.provider.handle_tool_calls(session=session, response=response)
messages.append({"role": "assistant", "content": response.content})
messages.append({
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": result["tool_use_id"],
"content": json.dumps(result),
"is_error": not result["successful"],
}
for result in results
]
})
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=4096,
tools=tools,
messages=messages,
)
# Print final response
for block in response.content:
if block.type == "text":
print(block.text)
handle_tool_calls extracts every tool_use block, executes the matching Composio tools through the supplied session, and returns execution dictionaries in tool-use order. Pass user_id instead for tools fetched with tools.get(). Claude occasionally emits tool input as a JSON string instead of an object; the provider normalizes this before execution.
Execution contracts
execute_tool_call(session=session, tool_call=block) returns one ; returns a list. Import both the provider and the response type from .