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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,5 @@ cython_debug/
marimo/_static/
marimo/_lsp/
__marimo__/
CHANGELOG.md
MIGRATION_SUMMARY.md
61 changes: 50 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.2.0] - 2026-02-10

### Added
- Initial SDK structure
- Core monitoring capabilities
- Framework integrations (sklearn, PyTorch, TensorFlow, Transformers, LangChain, XGBoost, LightGBM)
- Offline mode with persistent queue
- Privacy filters and PII detection
- Local caching with TTL support
- Decorator-based monitoring
- Async/sync interfaces
- Drift detection
- Comprehensive documentation
- **Git Integration**: Automatic Git context detection for model versioning
- `GitContext` class for repository metadata
- `detect_git_context()` function for auto-detection
- `validate_git_context()` for validation
- Support for both GitPython and subprocess fallback
- **CrewAI Multi-Agent Monitoring**: Full support for CrewAI workflows
- `CrewAIMonitor` class for monitoring crews
- Automatic agent and task tracking
- Agent-to-agent interaction logging
- Token usage and cost tracking
- Workflow analytics
- **LangChain Multi-Agent Support**: Enhanced LangChain integration
- `MultiAgentCallbackHandler` for agent execution tracking
- `LangGraphMultiAgentMonitor` for LangGraph workflows
- Agent-to-agent handoff monitoring
- Tool call tracking
- `monitor_langchain_agent()` helper function
- **Documentation**: Complete MkDocs setup with Material theme
- Comprehensive navigation structure
- API reference integration
- Code highlighting and copy buttons
- Dark/light mode support

### Changed
- **BREAKING**: Fixed import paths from `explainai.*` to `whiteboxai.*`
- Users must update imports: `from explainai.client` → `from whiteboxai.client`
- Updated dependencies:
- httpx: >=0.24.0 → >=0.25.0
- numpy: >=1.24.0 (aligned with latest stable)
- Added pandas>=1.3.0 (core dependency)
- Added tenacity>=8.0.0 (core dependency)
- Enhanced optional dependencies:
- Added git extra: `pip install whiteboxai-sdk[git]`
- Added crewai extra: `pip install whiteboxai-sdk[crewai]`
- Updated all extra: includes git, crewai, and all integrations

### Fixed
- Import errors due to incorrect package naming (explainai vs whiteboxai)
Comment on lines +37 to +50
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CHANGELOG.md claims to have fixed import errors from "explainai" to "whiteboxai" (line 37-38, 50), but many existing files still contain "from explainai" imports. The following files were not updated and will cause ImportErrors:

  • src/whiteboxai/integrations/langchain.py (line 23, 43)
  • src/whiteboxai/integrations/sklearn.py (line 19, 30)
  • src/whiteboxai/integrations/pytorch.py (line 31, 234)
  • src/whiteboxai/integrations/tensorflow.py (line 19, 30, 44)
  • src/whiteboxai/integrations/transformers.py (line 44, 413)
  • src/whiteboxai/decorators.py (line 12, 283)
  • src/whiteboxai/monitor.py (line 13)
  • src/whiteboxai/resources.py (line 10)

All these imports need to be changed from "explainai" to "whiteboxai" to match the claimed fix and prevent breaking existing functionality.

Copilot uses AI. Check for mistakes.
- Missing MkDocs configuration causing documentation build failures
- Incomplete integration exports in `whiteboxai.integrations`

### Documentation
- Created comprehensive MkDocs configuration
- Added index page with quick start examples
- Organized documentation with clear navigation
- Added examples for Git integration, CrewAI, and LangChain agents

## [0.1.0] - 2026-01-05

Expand All @@ -40,5 +78,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- PII detection and masking
- Secure API key handling

[Unreleased]: https://github.com/AgentaFlow/whitebox-python-sdk/compare/v0.1.0...HEAD
[Unreleased]: https://github.com/AgentaFlow/whitebox-python-sdk/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/AgentaFlow/whitebox-python-sdk/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/AgentaFlow/whitebox-python-sdk/releases/tag/v0.1.0
202 changes: 202 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
# WhiteBoxAI Python SDK

Official Python SDK for integrating WhiteBoxAI monitoring into your ML applications.

## Features

- 🚀 **Easy Integration** - Monitor models with just a few lines of code
- 📊 **Framework Support** - Native integrations for Scikit-learn, PyTorch, TensorFlow, XGBoost, and more
- 🎯 **Decorator-based Monitoring** - Zero-code-change monitoring with decorators
- ⚡ **Async/Sync Interfaces** - Support for both synchronous and asynchronous workflows
- 🔒 **Privacy-First** - Built-in PII detection and data masking
- 💾 **Local Caching** - TTL-based caching to reduce API calls
- 📈 **Drift Detection** - Automatic model and data drift monitoring
- 🎨 **Flexible Configuration** - Extensive configuration options and feature flags
- 🔍 **Git Integration** - Automatic Git context detection for model versioning
- 🤖 **Multi-Agent Support** - Monitor CrewAI and LangChain multi-agent workflows

## Installation

```bash
pip install whiteboxai-sdk

# With specific framework support
pip install whiteboxai-sdk[sklearn]
pip install whiteboxai-sdk[pytorch]
pip install whiteboxai-sdk[langchain]
pip install whiteboxai-sdk[crewai]
pip install whiteboxai-sdk[all] # All integrations
```

## Quick Start

### Basic Usage

```python
from whiteboxai import WhiteBoxAI, ModelMonitor

# Initialize client
client = WhiteBoxAI(api_key="your-api-key")

# Create monitor
monitor = ModelMonitor(client)

# Register model
model_id = monitor.register_model(
name="fraud_detection",
model_type="classification",
framework="sklearn"
)

# Log predictions
monitor.log_prediction(
inputs={"amount": 100.0, "merchant": "store_123"},
output={"fraud_probability": 0.15, "prediction": "legitimate"}
)
```

### Git Integration

```python
from whiteboxai import WhiteBoxAI, detect_git_context

# Auto-detect Git context
git_context = detect_git_context()

# Initialize with Git context
client = WhiteBoxAI(api_key="your-api-key")
model_id = client.models.register(
name="my_model",
**git_context.to_dict() # Include Git metadata
)
```

### CrewAI Multi-Agent Monitoring

```python
from whiteboxai.integrations import CrewAIMonitor
from crewai import Agent, Task, Crew

# Initialize monitor
monitor = CrewAIMonitor(api_key="your-api-key")

# Define your crew
crew = Crew(agents=[...], tasks=[...])

# Start monitoring
workflow_id = monitor.start_monitoring(
crew=crew,
workflow_name="Research Workflow"
)

# Execute crew
result = crew.kickoff()

# Complete monitoring
summary = monitor.complete_monitoring(outputs={"result": result})
```

### LangChain Multi-Agent Monitoring

```python
from whiteboxai.integrations import LangGraphMultiAgentMonitor

# Create monitor
monitor = LangGraphMultiAgentMonitor(
client=client,
workflow_name="Multi-Agent Research"
)

# Start monitoring
workflow_id = monitor.start_monitoring()

# Register agents
monitor.register_agent("supervisor", role="Coordinates agents")
monitor.register_agent("researcher", role="Gathers information")

# Execute with callbacks
result = agent_executor.run(
callbacks=monitor.get_callbacks("researcher")
)

# Complete monitoring
summary = monitor.complete_monitoring(outputs={"result": result})
```

## Framework Integrations

### Scikit-learn

```python
from whiteboxai.integrations import SklearnMonitor
from sklearn.ensemble import RandomForestClassifier

# Wrap your model
monitor = SklearnMonitor(client=client, model_id=model_id)
model = RandomForestClassifier()
wrapped_model = monitor.wrap(model)

# Use as normal - monitoring happens automatically
wrapped_model.fit(X_train, y_train)
predictions = wrapped_model.predict(X_test)
```

### PyTorch

```python
from whiteboxai.integrations import TorchMonitor
import torch.nn as nn

# Monitor your model
monitor = TorchMonitor(client=client, model_id=model_id)
model = MyNeuralNetwork()
monitor.attach(model)

# Training is automatically monitored
for epoch in range(num_epochs):
train(model, train_loader)
```

### TensorFlow/Keras

```python
from whiteboxai.integrations import KerasMonitor

# Add callback
monitor = KerasMonitor(client=client, model_id=model_id)
model.fit(
X_train, y_train,
callbacks=[monitor.get_callback()],
epochs=10
)
```

### LangChain

```python
from whiteboxai.integrations import LangChainMonitor

# Monitor chain execution
monitor = LangChainMonitor(client=client)
callback = monitor.create_callback()

chain.run("question", callbacks=[callback])
```

## Documentation

- [Getting Started Guide](getting-started.md) - Detailed installation and setup
- [Integration Guides](integrations.md) - Framework-specific integration tutorials
- [Offline Mode](offline-mode.md) - Running without internet connectivity
- [Production Deployment](PRODUCTION_DEPLOYMENT.md) - Best practices for production
- [API Reference](api-reference.md) - Complete API documentation

## Support

- **Documentation**: [Full Documentation](https://github.com/AgentaFlow/whitebox-python-sdk)
- **Issues**: [GitHub Issues](https://github.com/AgentaFlow/whitebox-python-sdk/issues)
- **Community**: [Discussions](https://github.com/AgentaFlow/whitebox-python-sdk/discussions)

## License

MIT License - see [LICENSE](https://github.com/AgentaFlow/whitebox-python-sdk/blob/main/LICENSE) for details.
92 changes: 92 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
site_name: WhiteBoxAI Python SDK
site_description: Official Python SDK for WhiteBoxAI - AI Observability & Explainability Platform
site_author: AgentaFlow
site_url: https://github.com/AgentaFlow/whitebox-python-sdk

repo_name: AgentaFlow/whitebox-python-sdk
repo_url: https://github.com/AgentaFlow/whitebox-python-sdk
edit_uri: edit/main/docs/

theme:
name: material
palette:
# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
primary: indigo
accent: indigo
toggle:
icon: material/brightness-7
name: Switch to dark mode
# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: indigo
accent: indigo
toggle:
icon: material/brightness-4
name: Switch to light mode
features:
- navigation.tabs
- navigation.sections
- navigation.expand
- navigation.top
- search.suggest
- search.highlight
- content.code.copy
- content.code.annotate

plugins:
- search
- mkdocstrings:
handlers:
python:
paths: [src]
options:
docstring_style: google
show_source: true

markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
- admonition
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- attr_list
- md_in_html
- toc:
permalink: true

nav:
- Home: index.md
- Getting Started:
- Installation: getting-started.md
- Offline Mode: offline-mode.md
- Integrations:
- Overview: integrations.md
- Scikit-learn: SKLEARN_INTEGRATION.md
- PyTorch: PYTORCH_INTEGRATION.md
- TensorFlow: TENSORFLOW_INTEGRATION.md
- Hugging Face: HUGGINGFACE_INTEGRATION.md
- LangChain: LANGCHAIN_INTEGRATION.md
- Deployment:
- Production: PRODUCTION_DEPLOYMENT.md
- API Reference: api-reference.md

extra:
social:
- icon: fontawesome/brands/github
link: https://github.com/AgentaFlow/whitebox-python-sdk
- icon: fontawesome/brands/python
link: https://pypi.org/project/whiteboxai-sdk/

copyright: Copyright © 2026 AgentaFlow
Loading
Loading