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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
174 changes: 174 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc
13 changes: 13 additions & 0 deletions examples/agent/crewAI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# CrewAI + Splunk AO Examples

This repo contains examples of how to use Splunk AO to instrument [CrewAI](https://www.crewai.com/) agents for observability and evaluation engineering.

## research_crew

The [resarch-crew](./research_crew/) is a quickstart tutorial. It is a completed version of the [CrewAI quickstart](https://docs.crewai.com/en/quickstart) and adds the
Splunk AO's [CrewAIEventListener](https://docs.galileo.ai/sdk-api/python/reference/handlers/crewai/handler),
an event handler implemented on top of OpenTelemetry (OTel). For more information, see
Splunk AO’s [Add Splunk AO to a CrewAI Application](https://docs.galileo.ai/how-to-guides/third-party-integrations/add-galileo-to-crewai/add-galileo-to-crewai)
how-to guide.

See the [README.md](./research_crew/README.md) for detailed setup instructions.
3 changes: 3 additions & 0 deletions examples/agent/crewAI/research_crew/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
__pycache__/
.DS_Store
111 changes: 111 additions & 0 deletions examples/agent/crewAI/research_crew/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# CrewAI and Splunk AO Cookbook

This tutorial is a completed version of the [CrewAI quickstart](https://docs.crewai.com/en/quickstart) and adds the
Splunk AO [CrewAIEventListener](https://docs.galileo.ai/sdk-api/python/reference/handlers/crewai/handler),
an event handler implemented on top of OpenTelemetry (OTel). For more information, see
Splunk AO’s [Add Splunk AO to a CrewAI Application](https://docs.galileo.ai/how-to-guides/third-party-integrations/add-galileo-to-crewai/add-galileo-to-crewai)
how-to guide.

Below you'll find concise setup steps, configuration notes, and a short primer on Splunk AO so you know why we add it and what it provides.

## Resources

The relevant guides:

- [Add Splunk AO to CrewAI](https://docs.galileo.ai/how-to-guides/third-party-integrations/add-galileo-to-crewai/add-galileo-to-crewai)
- [CrewAI quickstart](https://docs.crewai.com/en/guides/crews/first-crew)

## What is Splunk AO?

[Splunk AO](https://galileo.ai) is an observability and evaluation platform for generative AI agents. Integrating Splunk AO into a CrewAI project gives you:

- Structured logging of prompts, agent decisions, and model responses.
- Metrics, logs, and traces to evaluate agent performance and behavior over time.
- A centralized dashboard for debugging, auditing, and running evaluations on AI agents.

## Why add Splunk AO here?

- Faster troubleshooting: quickly find which agent produced what output and why
- Better evaluation: collect examples, compare model versions, and compute metrics
- Reproducibility: attach metadata (env, model, prompt) to recorded runs for later analysis

## Prerequisites

- Python 3.10–3.13
- `uv` installed and available.
- [CrewAI CLI](https://docs.crewai.com/en/installation) installed and available.
- A [Splunk AO API key](https://app.galileo.ai/)
- A [Serper API Key](https://serper.dev/)
- An [OpenAI Key](https://platform.openai.com/)

## Quick setup

Run these steps from the repository root.

1. Clone and open the repo

```zsh
git clone https://github.com/rungalileo/sdk-examples.git
cd sdk-examples/python/agent/crewAI/research_crew
```

2. Copy the .env.example and configure credentials

```zsh
cp .env.example .env
```

In addition to API keys, you’ll need to specify a Splunk AO project and log stream (e.g. SPLUNK_AO_PROJECT and SPLUNK_AO_LOG_STREAM). All CrewAI run data will be logged to this destination in Splunk AO. See
[Understanding the Splunk AO Integration](#understanding-the-galileo-integration) for more detail.

3. Install project dependencies into the active environment:

```zsh
crewai install
```

4. Run the Crew

```zsh
crewai run
```

## Understanding the Splunk AO Integration

Splunk AO integrates with CrewAI by registering an event listener that captures Crew execution events (e.g., agent actions, tool calls, model responses) and forwards them to Splunk AO for observability and evaluation. Under the hood, this integration is built on OpenTelemetry (OTel) for standardized tracing and telemetry collection.

### Register the event listener

At the beginning of your run() function (or before starting the Crew), instantiate the Splunk AO event listener:

```python

def run():
# Create the event listener (registers itself with CrewAI)
CrewAIEventListener()

# The rest of your existing code goes here
```

This is instrumented in [main.py](research_crew/src/research_crew/main.py).

### What this does

Creating a CrewAIEventListener() instance is all that’s required to enable Splunk AO for a CrewAI run. When instantiated, the listener:

- Automatically registers itself with CrewAI
- Uses OpenTelemetry (OTel) to instrument Crew execution events
- Reads Splunk AO configuration from environment variables
- Logs all run data to the Splunk AO project and log stream specified by
`SPLUNK_AO_PROJECT` and `SPLUNK_AO_LOG_STREAM`

No additional configuration or code changes are required. All data from this run is logged to the Splunk AO project and log stream specified by your environment configuration (for example, SPLUNK_AO_PROJECT and SPLUNK_AO_LOG_STREAM).

## CrewAI Support

For support, questions, or feedback regarding the ResearchCrew Crew or crewAI.

- Visit the [CrewAI documentation](https://docs.crewai.com)
- Reach out to CrewAI through their [GitHub repository](https://github.com/joaomdmoura/crewai)
- [Join the CrewAI Discord](https://discord.com/invite/X4JWnZnxPb)
- [Chat with the CrewAI docs](https://chatg.pt/DWjSBZn)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
User name is John Doe.
User is an AI Engineer.
User is interested in AI Agents.
User is based in San Francisco, California.
86 changes: 86 additions & 0 deletions examples/agent/crewAI/research_crew/output/report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---

# Comprehensive Report on Artificial Intelligence in Healthcare

**Executive Summary:**
Artificial Intelligence (AI) is transforming the healthcare industry by enhancing diagnostic accuracy, revolutionizing treatment personalization, and improving operational efficiency. This report analyzes key concepts, historical developments, challenges, and opportunities associated with AI in healthcare. It also highlights prominent case studies and explores potential future developments. By examining current trends and future potential, this report provides a comprehensive perspective on AI's transformative role in the healthcare sector.

---

## 1. Key Concepts and Definitions

**Artificial Intelligence in Healthcare:**
AI in healthcare entails the use of machine learning algorithms and software to emulate human cognition in analyzing, interpreting, and understanding complex medical and health data. It aims to provide solutions that enhance clinical practices and outcomes.

**Machine Learning:**
A critical subset of AI, machine learning involves algorithms that empower computers to learn from new data and make informed decisions without human intervention. Its applications include predictive analytics and pattern recognition in patient data.

**Natural Language Processing:**
Natural Language Processing (NLP) is the AI technology that enables machines to understand and generate human language. In healthcare, NLP is instrumental in augmenting clinical documentation and managing electronic health records.

_References:_
- [NIH Overview of AI in Medicine](https://pmc.ncbi.nlm.nih.gov/articles/PMC6691444/).
- [Arm Glossary on AI in Healthcare](https://www.arm.com/glossary/ai-in-healthcare).

---

## 2. Historical Development and Recent Trends

**Development Timeline:**
The integration of AI in healthcare began in the 1960s. Its journey saw significant advancements with the adoption of electronic health records and evolving data analytics capabilities, proving crucial in contemporary medical practices.

**Current Trends:**
AI currently plays a pivotal role in enhancing diagnostic accuracy, personalizing treatment, and optimizing healthcare operations. Emerging technological integrations have elevated its effectiveness in clinical workflows and patient management systems.

_References:_
- [National Library of Medicine Historical Review](https://pmc.ncbi.nlm.nih.gov/articles/PMC11122160/).
- [Inferscience Milestones in AI](https://www.inferscience.com/10-milestones-in-the-history-of-ai-in-healthcare).

---

## 3. Major Challenges and Opportunities

**Challenges:**
The primary challenges faced include ethical considerations around data privacy and potential biases, the high initial investment costs, algorithmic accountability, and the complexities of integrating AI into existing healthcare frameworks.

**Opportunities:**
AI opens numerous opportunities, such as enhancing diagnostic processes, advancing predictive analytics, tailoring patient care, and accelerating drug discovery. These innovations promise to bolster clinical efficiency and patient outcomes.

_References:_
- [Forbes on AI Opportunities and Challenges](https://www.forbes.com/councils/forbesbusinesscouncil/2023/02/07/top-five-opportunities-and-challenges-of-ai-in-healthcare/).
- [ScienceDirect on Ethical Implications](https://www.sciencedirect.com/science/article/pii/S1078143923004179).

---

## 4. Notable Applications or Case Studies

**AI-Assisted Diagnostics:**
AI applications, like Aidoc, facilitate radiology workflows by accurately predicting anomalies in medical imaging, significantly improving diagnostic precision.

**Personalized Treatment Planning:**
IBM Watson for Oncology exemplifies how AI can assist oncologists in customizing cancer treatment plans, thus illustrating AI's potential in personalizing healthcare strategies.

_References:_
- [VKTR AI Case Studies](https://www.vktr.com/ai-disruption/5-ai-case-studies-in-health-care/).
- [Philips Real-World AI Applications](https://www.philips.com/a-w/about/news/archive/features/2022/20221124-10-real-world-examples-of-ai-in-healthcare.html).

---

## 5. Future Outlook and Potential Developments

**Predictions:**
AI is poised to revolutionize healthcare delivery through hybrid models that complement human decision-making with AI-powered insights, enhancing diagnostic speed and accuracy.

**Growth Areas:**
Future expansions in AI applications are anticipated in areas like preventive care, mental health support, and chronic disease management, which promise to redefine standard healthcare delivery models.

_References:_
- [Deloitte AI Future Insights](https://www.deloitte.com/us/en/Industries/life-sciences-health-care/articles/future-of-artificial-intelligence-in-health-care.html).
- [International SOS AI Outlook](https://www.internationalsos.com/magazine/how-ai-is-transforming-the-future-of-healthcare).

---

**Conclusion:**
AI is a transformative force in healthcare, promising improvements in diagnostic accuracy, treatment personalization, and operational efficiency. Overcoming the existing challenges, AI offers robust opportunities that can fundamentally reshape healthcare delivery. The ongoing advancements and integration of AI technologies are crucial for achieving future innovations in various sectors of healthcare.

---
Loading
Loading