Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/loongsuite_lint_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,22 @@ jobs:
- name: Run tests
run: tox -c tox-loongsuite.ini -e lint-util-genai

lint-loongsuite-instrumentation-crewai:
name: LoongSuite loongsuite-instrumentation-crewai
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4

- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install tox
run: pip install tox-uv

- name: Run tests
run: tox -c tox-loongsuite.ini -e lint-loongsuite-instrumentation-crewai

76 changes: 76 additions & 0 deletions .github/workflows/loongsuite_test_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1001,3 +1001,79 @@ jobs:
- name: Run tests
run: tox -c tox-loongsuite.ini -e pypy3-test-util-genai -- -ra

py310-test-loongsuite-instrumentation-crewai_ubuntu-latest:
name: LoongSuite loongsuite-instrumentation-crewai 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install tox
run: pip install tox-uv

- name: Run tests
run: tox -c tox-loongsuite.ini -e py310-test-loongsuite-instrumentation-crewai -- -ra

py311-test-loongsuite-instrumentation-crewai_ubuntu-latest:
name: LoongSuite loongsuite-instrumentation-crewai 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install tox
run: pip install tox-uv

- name: Run tests
run: tox -c tox-loongsuite.ini -e py311-test-loongsuite-instrumentation-crewai -- -ra

py312-test-loongsuite-instrumentation-crewai_ubuntu-latest:
name: LoongSuite loongsuite-instrumentation-crewai 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install tox
run: pip install tox-uv

- name: Run tests
run: tox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-crewai -- -ra

py313-test-loongsuite-instrumentation-crewai_ubuntu-latest:
name: LoongSuite loongsuite-instrumentation-crewai 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4

- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install tox
run: pip install tox-uv

- name: Run tests
run: tox -c tox-loongsuite.ini -e py313-test-loongsuite-instrumentation-crewai -- -ra

3 changes: 3 additions & 0 deletions CHANGELOG-loongsuite.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `loongsuite-distro`: initialize loongsuite python agent distro
([#126](https://github.com/alibaba/loongsuite-python-agent/pull/126))

- `loongsuite-instrumentation-crewai`: add support for crewai
([#87](https://github.com/alibaba/loongsuite-python-agent/pull/87))
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## Version 0.1.0 (2026-03-05)



### Added

- Initialize the instrumentation for CrewAI
([#87](https://github.com/alibaba/loongsuite-python-agent/pull/87))
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# OpenTelemetry CrewAI Instrumentation

This library provides automatic instrumentation for [CrewAI](https://www.crewai.com/), a framework for orchestrating role-playing, autonomous AI agents.

## Installation

```bash
pip install opentelemetry-instrumentation-crewai
```

## Usage

```python
from opentelemetry.instrumentation.crewai import CrewAIInstrumentor

# Instrument CrewAI
CrewAIInstrumentor().instrument()

# Your CrewAI code here
from crewai import Agent, Task, Crew

agent = Agent(
role='Data Analyst',
goal='Extract actionable insights',
backstory='Expert in data analysis',
verbose=True
)

task = Task(
description='Analyze the latest AI trends',
agent=agent
)

crew = Crew(
agents=[agent],
tasks=[task],
verbose=True
)

result = crew.kickoff()
```

## Supported Versions

- CrewAI >= 0.80.0

## References

- [CrewAI Documentation](https://docs.crewai.com/)
- [OpenTelemetry Python Documentation](https://opentelemetry-python.readthedocs.io/)

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "opentelemetry-instrumentation-crewai"
dynamic = ["version"]
description = "OpenTelemetry CrewAI instrumentation"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.10,<4"
authors = [
{ name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"opentelemetry-api ~= 1.39.1",
"opentelemetry-instrumentation ~= 0.60b0",
"opentelemetry-semantic-conventions ~= 0.60b0",
"wrapt >= 1.0.0, < 2.0.0",
"opentelemetry-util-genai >= 0.3b0.dev0",
]

[project.optional-dependencies]
instruments = [
"crewai >= 0.80.0",
]

[project.entry-points.opentelemetry_instrumentor]
crewai = "opentelemetry.instrumentation.crewai:CrewAIInstrumentor"

[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-crewai"
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"

[tool.hatch.version]
path = "src/opentelemetry/instrumentation/crewai/version.py"

[tool.hatch.build.targets.sdist]
include = [
"/src",
"/tests",
]

[tool.hatch.build.targets.wheel]
packages = ["src/opentelemetry"]

Loading