> ## Documentation Index
> Fetch the complete documentation index at: https://crewai.burt.pe.kr/llms.txt
> Use this file to discover all available pages before exploring further.

# Composio Tool

> Composio는 유연한 인증 관리를 통해 AI 에이전트를 위한 250개 이상의 프로덕션 준비 완료 도구를 제공합니다.

# `ComposioToolSet`

## 설명

Composio는 여러분의 AI 어시스턴트를 250개 이상의 도구와 연결할 수 있는 통합 플랫폼이다. 주요 기능은 다음과 같다:

* **엔터프라이즈급 인증**: OAuth, API 키, JWT 지원과 자동 토큰 갱신 기능을 내장
* **완벽한 가시성**: 도구 사용 로그, 실행 시간 기록 등 상세한 정보 제공

## 설치

Composio 도구를 프로젝트에 통합하려면 아래 지침을 따르세요:

```shell theme={null}
pip install composio-crewai
pip install crewai
```

설치가 완료되면 `composio login` 명령을 실행하거나 Composio API 키를 `COMPOSIO_API_KEY`로 내보내세요. Composio API 키는 [여기](https://app.composio.dev)에서 얻을 수 있습니다.

## 예제

다음 예제는 도구를 초기화하고 GitHub 액션을 실행하는 방법을 보여준다:

1. Composio 도구셋 초기화

```python theme={null}
from composio_crewai import ComposioToolSet, App, Action
from crewai import Agent, Task, Crew

toolset = ComposioToolSet()
```

2. GitHub 계정 연결

<CodeGroup>
  ```shell theme={null}
  composio add github
  ```

  ```python theme={null}
  request = toolset.initiate_connection(app=App.GITHUB)
  print(f"인증을 위해 이 URL을 열어주세요: {request.redirectUrl}")
  ```
</CodeGroup>

3. 도구 가져오기

* 앱에서 모든 도구를 가져오기 (프로덕션 환경에서는 권장하지 않음):

```python theme={null}
tools = toolset.get_tools(apps=[App.GITHUB])
```

* 태그를 기반으로 도구 필터링:

```python theme={null}
tag = "users"

filtered_action_enums = toolset.find_actions_by_tags(
    App.GITHUB,
    tags=[tag], 
)

tools = toolset.get_tools(actions=filtered_action_enums)
```

* 사용 사례를 기반으로 도구 필터링:

```python theme={null}
use_case = "Star a repository on GitHub"

filtered_action_enums = toolset.find_actions_by_use_case(
    App.GITHUB, use_case=use_case, advanced=False
)

tools = toolset.get_tools(actions=filtered_action_enums)
```

<Tip>복잡한 사용 사례에 대한 액션을 가져오려면 `advanced`를 True로 설정하세요</Tip>

* 특정 도구 사용:

이 데모에서는 GitHub 앱의 `GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER` 액션을 사용한다.

```python theme={null}
tools = toolset.get_tools(
    actions=[Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER]
)
```

액션 필터링에 대해 더 알아보려면 [여기](https://docs.composio.dev/patterns/tools/use-tools/use-specific-actions)를 참조하세요.

4. 에이전트 정의

```python theme={null}
crewai_agent = Agent(
    role="GitHub 에이전트",
    goal="GitHub API를 사용해 GitHub에서 액션을 수행한다",
    backstory="사용자를 대신해 GitHub API를 사용해 GitHub에서 액션을 수행하는 AI 에이전트이다",
    verbose=True,
    tools=tools,
    llm= # LLM을 전달하세요
)
```

5. 태스크 실행

```python theme={null}
task = Task(
    description="GitHub에서 composiohq/composio 저장소를 스타한다",
    agent=crewai_agent,
    expected_output="작업 상태",
)

crew = Crew(agents=[crewai_agent], tasks=[task])

crew.kickoff()
```

* 더 상세한 도구 목록은 [여기](https://app.composio.dev)에서 확인할 수 있다.
