# CrewAI

## 1. Install the CLI

**npm**

    ```bash
    npm install -g swytchcode
    ```

**Windows**

    ```powershell
    irm https://cli.swytchcode.com/install.ps1 | iex
    ```

**macOS / Linux**

    ```bash
    curl -fsSL https://cli.swytchcode.com/install.sh | sh
    ```

Use `swy` as a shorter alias for `swytchcode`.

## 2. Install the packages

**Python**

    ```bash
    pip install swytchcode-runtime crewai python-dotenv
    ```

**JavaScript**

    ```bash
    npm install @swytchcode/runtime dotenv
    ```

## 3. Initialize Swytchcode and fetch a toolkit

```bash
swy init
swy get github
```

`swy init` creates `.swytchcode/` and `tooling.json` for the project. `swy get github` downloads the GitHub integration bundle - the schemas that `tools.get` reads from in the next step.

## 4. Create the tool set

**Python**

    ```python
    from swytchcode_runtime import Swytchcode
    from swytchcode_runtime.providers.crewai import CrewAIProvider

    swx = Swytchcode(provider=CrewAIProvider())
    tools = swx.tools.get(toolkits=["github"])
    ```

**JavaScript**

    ```ts
    import { Swytchcode } from '@swytchcode/runtime';

    const swx = new Swytchcode();
    const tools = await swx.tools.get({ toolkits: ['github'] });
    ```

## 5. Hand the tools to your crew

**Python**

    ```python
    print(f"Loaded {len(tools)} tools for the crew")
    ```

**JavaScript**

    ```ts
    console.log(`Loaded ${tools.length} tools for the crew`);
    ```

## 6. Run the file

Save the example as `main.py` or `main.js`, then run the matching command:

**Python**

    ```bash
    python main.py
    ```

**JavaScript**

    ```bash
    node main.js
    ```

CrewAI can use those tools as normal agent tools while Swytchcode handles the execution path.

## Example projects

- [GitHub Operations Agent](https://github.com/swytchcodehq/swytchcode-examples/tree/main/github-agent-crewai-python) - A CrewAI agent that lists repos and PRs, creates issues, and comments on GitHub — entirely through Swytchcode tools.
