Composio allows you to connect your Mira Flows with various external services and platforms, enabling automated actions based on your flow outputs. This integration bridges the gap between AI-powered flows and real-world actions.

Composio tool requires Anthropic Claude-3.5-sonnet to function. Check out Models for more information.

Step-by-Step Integration Guide

1. Set Up Platform Integration

First, let’s set up your desired platform integration in Composio:

  1. Visit Composio

  2. Sign in to your account & Navigate to “All Tools”

  3. Search for your desired integration (e.g., Twitter, Discord, Telegram)

  4. Complete the integration process and authorise your account

2. Obtain Integration Details

After setting up the integration, you’ll need 3 key pieces of information:

  1. API Key:

    • Go to your Composio dashboard

    • Look for the API key section at top and copy your API key.

    • You can use the default API key or create a new one

  2. Enum:

    • Go to the actions of the app you want to integrate with

    • Copy the “Enum” of the action you wish to perform

  3. Entity ID:

    • This is generated after you complete the platform integration

    • Find it in your “connected accounts” section under tools

3. Step by Step Demo

Here’s an interactive demo showing the process:

Code Implementation

ComposioConfig Attributes

AttributeDescriptionRequired
COMPOSIO_API_KEYYour Composio authentication keyYes
ACTIONPlatform-specific action (e.g., “TWITTER_POST”, “DISCORD_SEND”)Yes
TASKNatural language description including {content} placeholderYes
ENTITY_IDPlatform-specific entity identifierYes

Code Example

from mira_sdk import MiraClient, Flow, ComposioConfig

# Initialize Mira client with your API key
client = MiraClient(config={"API_KEY": "YOUR_MIRA_API_KEY"})

# Load your existing flow from YAML file
flow = Flow(source="path/to/your/flow.yaml")

# Set up your flow's input parameters
input_dict = {
    "user": "your_username"
}

# Execute flow with Composio integration
# The flow's output will automatically replace {content} in the TASK
response = client.flow.execute(
    flow,
    input_dict,
    ComposioConfig(
        COMPOSIO_API_KEY="YOUR_COMPOSIO_API_KEY",
        ACTION="PLATFORM_ACTION",  # e.g., "TWITTER_POST", "DISCORD_SEND"
        TASK="Action specific task - {content}",  # {content} is required and gets replaced with flow output
        ENTITY_ID="YOUR_ENTITY_ID"  # Platform-specific identifier
    )
)

What Not to Do

  1. Don’t forget {content} in TASK:
# ❌ Incorrect - missing {content}
TASK="Post this message"

# ✅ Correct
TASK="Post this message: {content}"
  1. Don’t modify the {content} placeholder:
# ❌ Incorrect
TASK="Send {message}"
TASK="Post {text}"

# ✅ Correct
TASK="Send {content}"
  1. Don’t use multiple {content} placeholders:
# ❌ Incorrect
TASK="Post {content} and then {content}"

# ✅ Correct
TASK="Post {content}"