composio

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

When to Apply

适用场景

  • User wants to access or interact with external apps (Gmail, Slack, GitHub, Notion, etc.)
  • User wants to automate a task using an external service (send email, create issue, post message)
  • Building an AI agent or app that integrates with external tools
  • Multi-user apps that need per-user connections to external services
  • 用户想要访问或与外部应用(Gmail、Slack、GitHub、Notion等)进行交互
  • 用户想要借助外部服务自动化完成任务(发送邮件、创建Issue、发布消息)
  • 构建与外部工具集成的AI Agent或应用
  • 需要为每位用户建立外部服务连接的多用户应用

Setup

设置步骤

Check if the CLI is installed; if not, install it:
bash
curl -fsSL https://composio.dev/install | bash
After installation, restart your terminal or source your shell config, then authenticate:
bash
composio login       # OAuth; interactive org/project picker (use -y to skip)
composio whoami      # verify org_id, project_id, user_id
For agents without direct browser access:
composio login --no-wait | jq
to get URL/key, share URL with user, then
composio login --key <cli_key> --no-wait
once they complete login.

检查CLI是否已安装;若未安装,请执行以下命令安装:
bash
curl -fsSL https://composio.dev/install | bash
安装完成后,重启终端或加载shell配置文件,然后进行身份验证:
bash
composio login       # OAuth;交互式组织/项目选择器(使用-y参数跳过)
composio whoami      # 验证org_id、project_id、user_id
对于无法直接访问浏览器的Agent:执行
composio login --no-wait | jq
获取URL/密钥,将URL分享给用户,待用户完成登录后执行
composio login --key <cli_key> --no-wait

1. Use Apps via Composio CLI

1. 通过Composio CLI使用应用

Use this when: The user wants to take action on an external app directly — no code writing needed. The agent uses the CLI to search, connect, and execute tools on behalf of the user.
Key commands (new top-level aliases):
  • composio search "<query>"
    — find tools by use case
  • composio execute "<TOOL_SLUG>" -d '{...<input params>}'
    — execute a tool
  • composio link [toolkit]
    — connect a user account to an app (agents: always use
    --no-wait
    for non-interactive mode)
  • composio listen
    — listen for real-time trigger events
Typical workflow: search → link (if needed) → execute
Full reference: Composio CLI Guide

适用场景: 用户想要直接对外部应用执行操作——无需编写代码。Agent可借助CLI代表用户搜索、连接并执行工具。
核心命令(新增顶级别名):
  • composio search "<query>"
    —— 根据使用场景查找工具
  • composio execute "<TOOL_SLUG>" -d '{...<input params>}'
    —— 执行工具
  • composio link [toolkit]
    —— 将用户账户与应用连接(Agent:非交互模式下请始终使用
    --no-wait
    参数)
  • composio listen
    —— 监听实时触发事件
典型工作流:搜索 → 连接(如需) → 执行
完整参考文档:Composio CLI指南

2. Building Apps and Agents with Composio

2. 使用Composio构建应用与Agent

Use this when: Writing code — an AI agent, app, or backend service that integrates with external tools via the Composio SDK.
Run this first inside the project directory to set up the API key:
bash
composio init
Full reference: Building with Composio
适用场景: 编写代码时——构建通过Composio SDK与外部工具集成的AI Agent、应用或后端服务。
首先在项目目录内执行以下命令设置API密钥:
bash
composio init
完整参考文档:使用Composio构建应用