# CrewAI

[CrewAI](https://www.crewai.com/) is an open-source framework designed to orchestrate role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks and multi-agent workflows. CrewAI supports integration with various Language Models (LLMs) through LiteLLM, providing a unified interface to connect with models from numerous providers, including custom OpenAI-compatible endpoints.

This tutorial will guide you through integrating Arcee AI language models into CrewAI using an OpenAI-compatible endpoint, allowing you to leverage Arcee's specialized models within CrewAI's agent orchestration framework.

**Prerequisites**

* Python: `>=3.10 and <3.14`&#x20;

**Integration Steps**

1. Create a folder for your project

<pre class="language-bash"><code class="lang-bash"><strong>mkdir arceeai_crewai &#x26;&#x26; cd arceeai_crewai
</strong></code></pre>

2. Setup Python Virtual Environment and Install CrewAI tooling

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env

uv venv --python 3.12 --seed
source .venv/bin/activate

uv pip install crewai
```

{% hint style="danger" %}
If you run into any errors installing crewai, follow their [Instillation Guide](https://docs.crewai.com/en/installation).
{% endhint %}

3. Create a new python file called `arceeai_crewai.py` and copy in the following contents

```python
import os
from crewai import LLM, Agent, Task, Crew

# Configure Arcee AI Model
ARCEE_BASE = os.getenv("OPENAI_API_BASE", "http://127.0.0.1:8080/v1")
ARCEE_KEY  = os.getenv("OPENAI_API_KEY", "your-arcee-api-key")
ARCEE_MODEL = os.getenv("OPENAI_MODEL_NAME", "afm-4.5b")

# Initialize Arcee AI model with OpenAI-compatible configuration
arcee_llm = LLM(
    model=f"openai/{ARCEE_MODEL}",
    api_base=ARCEE_BASE,
    api_key=ARCEE_KEY
)

# Define a simple agent that uses the Arcee AI model
summarizer = Agent(
    role="Summarizer",
    goal="Summarize text into three crisp bullet points.",
    backstory="A concise technical writer who removes fluff.",
    llm=arcee_llm,
    verbose=True,
)

# Define the task the agent will perform
text = """Arcee AI is a foundation model provider with a focus on building the highest performing models per parameter. 
They offer a range of models from on-device and edge optimized models to large language models. Their suite of models 
provides customers with the flexibility to choose the right model for the right task. All models are released Apache 2.0 
enabling the community to use safe, built-in-the-US models in their own environment or via the Arcee AI API platform."""
task = Task(
    description=f"Summarize the following in three bullets:\n\n{text}",
    expected_output="Exactly three bullet points, each under 20 words.",
    agent=summarizer,
)

# Orchestrate & run
crew = Crew(agents=[summarizer], tasks=[task], verbose=True)
result = crew.kickoff()

# Print the results
print("\n=== RESULT ===\n")
print(result)
```

{% hint style="success" %}
This works out-of-the-box if you have an Arcee AI model running locally on your laptop. If you do not, change `ARCEE_BASE` , `ARCEE_KEY` , and `ARCEE_MODEL` .

You can also setup a `.env` file to store the configurations.
{% endhint %}

4. Run your Arcee AI powered CrewAI Agent

```bash
python arceeai_crewai.py
```
