Skip to content
Merged
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 @@ -203,3 +203,22 @@ jobs:
- name: Run tests
run: tox -c tox-loongsuite.ini -e lint-loongsuite-instrumentation-litellm

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 @@ -1457,3 +1457,79 @@ jobs:
- name: Run tests
run: tox -c tox-loongsuite.ini -e py313-test-loongsuite-instrumentation-litellm -- -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

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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

### 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,53 @@
# LoongSuite CrewAI Instrumentation

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

## Installation

```bash
git clone https://github.com/alibaba/loongsuite-python-agent.git
cd loongsuite-python-agent
pip install ./instrumentation-loongsuite/loongsuite-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 = "loongsuite-instrumentation-crewai"
dynamic = ["version"]
description = "LoongSuite 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.37.0",
"opentelemetry-instrumentation >= 0.58b0",
"opentelemetry-semantic-conventions >= 0.58b0",
"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/alibaba/loongsuite-python-agent/tree/main/instrumentation-loongsuite/loongsuite-instrumentation-crewai"
Repository = "https://github.com/alibaba/loongsuite-python-agent"

[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
Loading