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

# CrewAI

> Run a CrewAI agent on skills from your project with CrewAI's own loader and no DecimalAI account. With a key, trace every crew, or serve the skills saved on an agent.

## What you get

CrewAI has no `agent_config()`. It has a skill loader of its own, and `decimalai.crewai.skills()` points that loader at the folder `decimalai skills add` writes, so an agent runs on registry skills before you have a DecimalAI account.

With a key, `instrument()` traces each crew. It can also serve the skills saved on an agent instead, so you can change them without redeploying.

## Install

```bash theme={null}
pip install "decimalai>=0.27" "crewai>=1.15.27"
export OPENAI_API_KEY="sk-..."
```

There's no extra: you install `decimalai` and CrewAI side by side. The adapter supports crewai 1.15.27 and later, and CrewAI needs a Python below 3.14. Tracing takes two more packages, listed under [Add a key](#add-a-key).

## Run with no account

Save this as `main.py`:

```python theme={null}
import decimalai.crewai
from crewai import LLM, Agent, Crew, Task

agent = Agent(
    role="Assistant",
    goal="Answer the question",
    backstory="A helpful assistant.",
    llm=LLM(model="gpt-5.4-mini"),
    skills=decimalai.crewai.skills(),      # the installed folder
    tools=decimalai.crewai.skill_tools(),  # reads a skill's files
)
question = (
    "What command connects the browser CLI tool "
    "to a browser already running on http://localhost:9222?"
)
task = Task(
    description=question
    + " Load any skill that could apply before you answer.",
    expected_output="The command",
    agent=agent,
)
print(Crew(agents=[agent], tasks=[task]).kickoff())
```

An agent often skips a skill unless the task asks it to load one. Measured on November 3, 2026, it used the skill in 2 of 6 runs without that instruction and in 5 of 5 with it. That's why this program's task says so.

Add a skill before you run it, in the next step. Until the project has one, `decimalai.crewai.skills()` raises `SkillsNotInstalledError`. The program never calls `decimalai.init()`, so it needs no `DECIMAL_API_KEY` and sends DecimalAI nothing.

* **`skills=decimalai.crewai.skills()`** is the installed folder. CrewAI lists every skill in it in its own catalog and gives the agent its own `load_skill` tool, which returns a skill's full text.
* **`tools=decimalai.crewai.skill_tools()`** adds what CrewAI's loader lacks. `load_skill_resource` reads a file under a skill's `references/`, `assets/` or `scripts/`. `run_skill_script` runs one of its `scripts/`, with no shell and a 60-second limit. Both accept only installed skills and paths inside them. `run_skill_script` doesn't enforce a skill's `allowed-tools`, and `skill_tools(scripts=False)` leaves it out.
* **CrewAI reads the whole folder.** Every skill folder in `.agents/skills` is offered, whether or not `.decimal/skills.toml` lists it. [`agent_config()` with no key](https://docs.decimal.ai/sdk/python/frameworks/how-skills-reach-the-model#without-a-decimalai-key), on other frameworks, uses only the listed ones.

### Your own tools

List your tools before `skill_tools()`:

```python theme={null}
from crewai.tools import tool


@tool("Look up an order")
def lookup_order(order_id: str) -> str:
    """Look up the status of an order."""
    return f"Order {order_id} shipped yesterday."


agent = Agent(
    role="Assistant",
    goal="Answer the question",
    backstory="A helpful assistant.",
    llm=LLM(model="gpt-5.4-mini"),
    skills=decimalai.crewai.skills(),
    tools=[lookup_order, *decimalai.crewai.skill_tools()],
)
```

## Add a registry skill

```bash theme={null}
decimalai skills add playwright-cli
```

Run `main.py`. The model loads the skill and gives the real command, `playwright-cli attach --cdp=http://localhost:9222`.

The command wrote the skill's files to `.agents/skills/`, listed it in `.decimal/skills.toml`, and recorded its exact bytes in `.decimal/skills.lock`. To find others, see [Browse the registry](https://docs.decimal.ai/guides/registry.md). A skill you wrote goes in the same folder.

## Add a key

A key alone changes nothing here, because `main.py` never calls `decimalai.init()`. To keep CrewAI's loader and record its loads, see [Its own skill loader](#its-own-skill-loader). To serve the skills saved on an agent, use `instrument()`.

Get a key from [Settings → API keys](https://app.decimal.ai/settings/api-keys), add the tracing packages, and put a skill on the agent. `--to-agent` creates the agent if it's new:

```bash theme={null}
export DECIMAL_API_KEY="dai_sk_..."
pip install "openinference-instrumentation-crewai>=1.1.21" openinference-instrumentation-openai
decimalai skills add playwright-cli --to-agent my-agent
```

Then drop `skills=` and `tools=` from the agent:

```python theme={null}
import decimalai
from decimalai.crewai import instrument
from crewai import LLM, Agent, Crew, Task

decimalai.init()                                             # reads DECIMAL_API_KEY
instrument(agent_name="my-agent", enable_skill_loader=True)  # before the first kickoff()

agent = Agent(
    role="Assistant",
    goal="Answer the question",
    backstory="A helpful assistant.",
    llm=LLM(model="gpt-5.4-mini"),
)
task = Task(description=question, expected_output="The command", agent=agent)
print(Crew(agents=[agent], tasks=[task]).kickoff())
decimalai.flush()                                            # send the trace now
```

* **`enable_skill_loader=True`** hooks CrewAI's `before_llm_call`. There's no `load_skill` on this route, so each model call an agent makes is ranked on the task's description, and the skill list goes into that call right after CrewAI's system prompt, with the full text of the skill ranked first. If the ranking wasn't about this task and the agent has other skills, the call gets the list alone, and the model can't open a skill from it. Calls outside an agent's turn, such as output conversion and guardrails, are left alone.
* **`decimalai.init()` comes first.** Without it, `instrument()` installs and the agent gets no skills, with no error. `decimalai.init(crewai=True, agent_name="my-agent")` is the one-line form of both calls.
* **The agent has no `skills=`.** An agent with CrewAI skills of its own keeps them, and this route stays out of its calls.
* **Call it before the first `kickoff()`.** CrewAI copies its hooks into an agent's executor when it builds one, so an executor built earlier gets no skills.
* **The two packages are for tracing.** Skills reach the model without them, but no run is recorded. Use `openinference-instrumentation-anthropic` or `-google-genai` for those models.
* **`instrument()` doesn't connect the project.** It copies nothing from `.decimal/skills.toml` and writes no `.decimal/link.toml`, which is why the skill goes on with `--to-agent` or on the agent's page. Folders in `.agents/skills` go unused on this route.

## Change the prompt without redeploying

CrewAI's prompt stays in your code. It's built from the `role`, `goal` and `backstory` you pass to `Agent(...)`, and `instrument()` reads no saved prompt, so a prompt saved in the dashboard doesn't reach this agent. Only the skills can change without redeploying: add or remove one on the agent's [Prompt & skills](https://docs.decimal.ai/guides/agent-setup-versions.md) page, and later runs get the new list. `{{name}}` variables and `MissingPromptVariable` don't apply.

To keep the text on DecimalAI anyway, read it yourself with the [neutral `agent_config()`](https://docs.decimal.ai/sdk/python/init#your-own-model-calls) when you build the agent:

```python theme={null}
support = decimalai.agent_config("my-agent", fallback="A helpful assistant.")
agent = Agent(
    role="Assistant",
    goal="Answer the question",
    backstory=support.prompt,
    llm=LLM(model="gpt-5.4-mini"),
)
```

`support.prompt` is the text as saved, with any `{{name}}` unfilled. It's read when you call `agent_config()`, so a new version reaches the next agent built after a fresh call, and its trace records no prompt version. With a key, that call also [connects the project](https://docs.decimal.ai/sdk/python/frameworks/how-skills-reach-the-model.md#without-a-decimalai-key).

## Conversations

This doesn't apply: `decimalai.crewai` has no `conversation()`, and each `kickoff()` is one run with its own task and its own trace.

## Its own skill loader

This is the route in [Run with no account](#run-with-no-account): `decimalai.crewai.skills()` and `skill_tools()`. To record its loads, add a key and the tracing packages from [Add a key](#add-a-key), and put one line at the top of `main.py`:

```python theme={null}
decimalai.init(crewai=True, agent_name="my-agent")
```

* **Each load counts as [Loaded](https://docs.decimal.ai/sdk/python/frameworks/how-skills-reach-the-model.md#offered-delivered-loaded),** with the version of the text the model received, and the names in CrewAI's catalog count as Offered.
* **Updates take effect at once.** CrewAI reads a skill's text from disk on every load, so after `decimalai skills update` the same agent serves the new version.
* **DecimalAI's route steps aside by itself.** That flag also turns on the `instrument()` route, which leaves an agent with `skills=` alone, so there's no need for `skills=False`. If another agent in the same crew gets skills that way, a warning says once that [two catalogs](https://docs.decimal.ai/sdk/python/frameworks/how-skills-reach-the-model.md#deliver-a-skill-one-way) reached the model in that run.

[Native skill loaders](https://docs.decimal.ai/guides/native-skill-loaders.md) covers how the version is decided and how the other frameworks compare.

## Tracing

`instrument()` or `init(crewai=True)` turns tracing on for the process, and each crew run is one trace. CrewAI emits no spans to your tracer provider by itself, so OpenInference's instrumentors supply them, and each of those is a package you install.

* **`openinference-instrumentation-crewai`** records the crew, each task, agent interactions and tool calls, with inputs and outputs.
* **A provider instrumentor** (`openinference-instrumentation-openai`, `-anthropic` or `-google-genai`) records the model calls, with the model name, token counts and messages. CrewAI's own instrumentor emits no model call.
* **Skills on the `instrument()` route** are recorded as [Offered and Delivered, never Loaded](https://docs.decimal.ai/sdk/python/frameworks/how-skills-reach-the-model.md#offered-delivered-loaded), because the model never asks for one.
* **To trace with no skills,** use `decimalai.init(crewai=True, skills=False)`, or set `DECIMALAI_SKILLS=0`.
* **`instrument(on_trace=fn)`** calls `fn` once per run, failed runs included, with a copy of the finished trace before it's sent. A run inside `decimalai.start_trace()` is filed as that trace's child.
* **Several agents in one process.** Wrap a kickoff in `agent_run("billing-crew")`, from `decimalai.providers`, to file the run and route its skills under that name.

The manifest (the agent's setup, which DecimalAI versions) holds tool names only. For regression checks on tool schemas, [register it yourself](https://docs.decimal.ai/sdk/python/manifests.md). Spans leave within five seconds or at exit, and `decimalai.flush()` sends them at once.

## Troubleshooting

* **The agent ignored its skill.** Have the task ask it to load one, as `main.py` does. See the measurement in [Run with no account](#run-with-no-account).
* **`SkillsNotInstalledError`.** The project has no skills yet. Run `decimalai skills add` in its folder.
* **A skill is missing from CrewAI's catalog.** CrewAI skips a folder it can't parse, and logs it on `crewai.skills` instead of raising. Its `metadata` parser requires every value to be a string. `decimalai skills verify` reports what a loader would reject.
* **`NO CrewAI traces will be captured`.** `openinference-instrumentation-crewai` is missing, or refused your CrewAI version. The warning says which.
* **The trace has crew and task spans but no model or tokens.** The provider instrumentor is missing. It's only logged at INFO, as `CrewAI traces will lack openai model/token detail`.
* **No skills arrive on the `instrument()` route, and nothing is logged.** Check for `decimalai.init()` before the first `kickoff()`, and for `skills=` on the agent. That one is logged at INFO, once per agent.
* **LiteLLM calls aren't traced.** DecimalAI turns on the OpenAI, Anthropic and Google instrumentors only. Install `openinference-instrumentation-litellm` and call `LiteLLMInstrumentor().instrument()` yourself.
* **`CrewAI ran its before_llm_call hook on a thread with a running asyncio event loop`.** The deprecated `CrewAgentExecutor` under `Crew.akickoff()` blocks the loop during ranking. Drop `executor_class`, or use `Crew.kickoff_async()`.
* **`enable_load_skill_tool is not supported on the crewai adapter`.** The argument does nothing, because a hook can't add a tool. For a model that asks for skills, use [its own skill loader](#its-own-skill-loader).

The switches every framework shares are in [Turn it off](https://docs.decimal.ai/sdk/python/frameworks/how-skills-reach-the-model.md#turn-it-off).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.