OpenObserve Docs
IntegrationAIFrameworks

CrewAI → OpenObserve

Automatically capture crew executions, agent runs, task completions, and all nested LLM calls for every CrewAI workflow in your Python application.

Prerequisites

  • Python 3.10+
  • An OpenObserve account (cloud or self-hosted)
  • Your OpenObserve organisation ID and Base64-encoded auth token
  • An OpenAI API key (or whichever LLM provider your agents use)

Installation

pip install openobserve-telemetry-sdk opentelemetry-instrumentation-crewai crewai python-dotenv

Configuration

Create a .env file in your project root:

# OpenObserve instance URL
# Default for self-hosted: http://localhost:5080
OPENOBSERVE_URL=https://api.openobserve.ai/

# Your OpenObserve organisation slug or ID
OPENOBSERVE_ORG=your_org_id

# Basic auth token — Base64-encoded "email:password"
OPENOBSERVE_AUTH_TOKEN=Basic <your_base64_token>

# LLM provider key (whichever backend CrewAI is calling)
OPENAI_API_KEY=your-openai-key

Instrumentation

Set up openobserve_init() first, then call CrewAIInstrumentor().instrument(). Also set CREWAI_TELEMETRY_OPT_OUT=true to disable CrewAI's own internal telemetry, which would otherwise conflict with the OTel provider.

from dotenv import load_dotenv
load_dotenv()

import os
os.environ["CREWAI_TELEMETRY_OPT_OUT"] = "true"

from openobserve import openobserve_init
from opentelemetry.instrumentation.crewai import CrewAIInstrumentor

CrewAIInstrumentor().instrument()
openobserve_init()

from crewai import Agent, Task, Crew, Process

researcher = Agent(
    role="Researcher",
    goal="Find concise, factual answers.",
    backstory="You are a precise researcher who answers questions directly.",
    verbose=False,
)

task = Task(
    description="Explain what OpenTelemetry is in two sentences.",
    expected_output="A two-sentence explanation of OpenTelemetry.",
    agent=researcher,
)

crew = Crew(
    agents=[researcher],
    tasks=[task],
    process=Process.sequential,
    verbose=False,
)

result = crew.kickoff()
print("Result:", result)

What Gets Captured

Each crew.kickoff() call produces a root crewai.workflow span with child spans for each agent run and task execution.

AttributeDescription
gen_ai_systemcrewai
gen_ai_operation_nameinvoke_agent
llm_observation_typeAGENT for agent spans
traceloop_span_kindtask for task spans, agent for agent spans
operation_nameTask description with .task suffix
crewai_task_descriptionFull task description
crewai_task_expected_outputConfigured expected output
crewai_task_agentAgent assigned to the task
crewai_task_idUnique task ID
crewai_task_processed_by_agentsAgent(s) that executed the task
crewai_task_retry_countNumber of retry attempts
crewai_task_toolsTools available to the task
crewai_task_used_toolsNumber of tools actually used
durationSpan latency
span_statusOK on success, ERROR on failure

Viewing Traces

  1. Log in to OpenObserve and navigate to Traces in the left sidebar
  2. Filter by gen_ai_system = crewai to find CrewAI traces
  3. Click any root crewai.workflow span to open the full hierarchy
  4. Expand the tree to see agent spans, task spans, and nested LLM calls

CrewAI trace in OpenObserve

Next Steps

With CrewAI instrumented, every crew execution is recorded in OpenObserve with a full span hierarchy. From here you can track which agents consume the most tokens, compare task latency across runs, and set alerts on error spans from failed agent executions.

Read More

Was this page helpful?

Last updated on

On this page