> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenfactory.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Crew AI

> Crew AI + Nebius Token Factory

**Crew AI** is an open source agentic framework.

[Crew AI docs](https://docs.crewai.com/en/introduction)

## Prerequisites

1. [Create an API key](https://tokenfactory.nebius.com/project/api-keys) to authorize requests to Nebius Token Factory.
2. Save the API key into a `NEBIUS_API_KEY` environment variable:

   ```shellscript theme={null}
   export NEBIUS_API_KEY="<API_key>"
   ```
3. Install the `crewai` package:

   ```shellscript theme={null}
   pip install crewai   
   ```

## Quickstart

```python theme={null}
from crewai import Agent, Task, LLM, Crew, Process
import os

llm=LLM(
        model="nebius/Qwen/Qwen3-30B-A3B",
        api_key=os.getenv("NEBIUS_API_KEY")
)

# Create a researcher agent
## see documentation : https://docs.crewai.com/en/concepts/agents#direct-code-definition
researcher = Agent(
  role='Senior Researcher',
  goal='Discover groundbreaking technologies',
  verbose=True,
  llm=llm,
  backstory='A curious mind fascinated by cutting-edge innovation and the potential to change the world, you know everything about tech.'
)

# Task for the researcher
research_task = Task(
  description='Identify the next big trend in AI',
  expected_output='5 paragraphs on the next big AI trend',
  agent=researcher  # Assigning the task to the researcher
)

# Instantiate your crew
tech_crew = Crew(
  agents=[researcher],
  tasks=[research_task],
  process=Process.sequential  # Tasks will be executed one after the other
)

# Begin the task execution
result = tech_crew.kickoff()

## see raw response
print("=== CREW OUTPUT ===")
print(result.raw)
## Look at `token_usage` output
print("\n=== TOKEN USAGE ===")
print(f"Total tokens: {result.token_usage.total_tokens}")
print(f"Prompt tokens: {result.token_usage.prompt_tokens}")
print(f"Completion tokens: {result.token_usage.completion_tokens}")
print(f"Successful requests: {result.token_usage.successful_requests}")
```

## More Examples

View [more examples](https://github.com/nebius/token-factory-cookbook/blob/main/agents/README.md#crewai) in our cookbook.
