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

# CrewAI

> Build and coordinate autonomous multi-agent systems with Neosantara and CrewAI.

[CrewAI](https://www.crewai.com/?utm_source=neosantara-docs\&utm_medium=referral) is a production-grade multi-agent orchestration framework. It allows autonomous agents to collaborate by assuming specific roles, sharing context, and executing interdependent tasks.

## Setup

Install the CrewAI package:

```bash theme={"theme":{"light":"ayu-dark","dark":"catppuccin-latte"}}
pip install -U crewai
```

<CodeGroup>
  ```bash Bash / zsh icon="terminal" theme={"theme":{"light":"ayu-dark","dark":"catppuccin-latte"}}
  export NEOSANTARA_API_KEY="nsk_your_api_key_here"
  ```

  ```env .env icon="file-code" theme={"theme":{"light":"ayu-dark","dark":"catppuccin-latte"}}
  NEOSANTARA_API_KEY=nsk_your_api_key_here
  ```

  ```powershell PowerShell icon="terminal" theme={"theme":{"light":"ayu-dark","dark":"catppuccin-latte"}}
  $env:NEOSANTARA_API_KEY="nsk_your_api_key_here"
  ```
</CodeGroup>

## LLM Initialization

Use the `crewai.LLM` class with the `neosantara/<model>` provider prefix to connect Neosantara models to your CrewAI agents. Credentials can be passed explicitly or automatically loaded from the `NEOSANTARA_API_KEY` environment variable.

```python theme={"theme":{"light":"ayu-dark","dark":"catppuccin-latte"}}
import os
from crewai import LLM

# Initialize model using neosantara/ prefix
llm = LLM(
    model="neosantara/gemini-3.8-flash",
    api_key=os.environ["NEOSANTARA_API_KEY"]
)
```

## Multi-Agent Workflow Example

The following example orchestrates two agents: a **Researcher** that gathers insights, and a **Writer** that compiles a concise technical overview from the research.

```python theme={"theme":{"light":"ayu-dark","dark":"catppuccin-latte"}}
import os
from crewai import Agent, Task, Crew, Process, LLM

llm = LLM(
    model="neosantara/gemini-3.8-flash",
    api_key=os.environ["NEOSANTARA_API_KEY"]
)

# Define Agents
researcher = Agent(
    role="AI Infrastructure Analyst",
    goal="Identify emerging trends in Indonesian LLM gateways and routing latency",
    backstory="You are an experienced systems researcher specializing in Indonesian AI infrastructure and latency optimization.",
    llm=llm,
    verbose=True
)

writer = Agent(
    role="Technical Content Strategist",
    goal="Compose a crisp 2-paragraph briefing based on the research report",
    backstory="You are a technical writer who communicates infrastructure concepts clearly and concisely.",
    llm=llm,
    verbose=True
)

# Define Tasks
task_research = Task(
    description="Analyze the key advantages of Indonesia's AI Gateway for local developer teams over US-only endpoints.",
    expected_output="A bulleted summary highlighting latency benefits, local billing currency, and Indonesian data guardrails.",
    agent=researcher
)

task_write = Task(
    description="Write a 2-paragraph technical briefing using the research output.",
    expected_output="A 2-paragraph executive briefing ready for publication.",
    agent=writer
)

# Assemble and Kick off the Crew
crew = Crew(
    agents=[researcher, writer],
    tasks=[task_research, task_write],
    process=Process.sequential,
    verbose=True
)

result = crew.kickoff()
print(result)
```

## Next Steps

* [Model Context Protocol (MCP) Guide](/en/agents/overview)
* [Model Catalog & Pricing](/en/gateway/models)
* [Agno Native Integration](/en/integrations/agno)


## Related topics

- [Agno](/en/integrations/agno.md)
- [AutoGen (AG2)](/en/integrations/autogen.md)
- [MCP & Agent Architecture](/en/agents/overview.md)
- [Model Catalog](/en/gateway/models.md)
