Page cover

CrewAI

CrewAI 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

Integration Steps

  1. Create a folder for your project

mkdir arceeai_crewai && cd arceeai_crewai
  1. Setup Python Virtual Environment and Install CrewAI tooling

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
  1. Create a new python file called arceeai_crewai.py and copy in the following contents

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)
  1. Run your Arcee AI powered CrewAI Agent

python arceeai_crewai.py

Last updated