# Briefcase AI Python SDK

Python SDK for AI observability, replay, and decision tracking. This package provides high-performance Rust-powered tools for monitoring and debugging AI applications in Python.

[![Crates.io](https://img.shields.io/crates/v/briefcase-python.svg)](https://crates.io/crates/briefcase-python)
[![PyPI](https://img.shields.io/pypi/v/briefcase-ai.svg)](https://pypi.org/project/briefcase-ai/)

## Overview

This Python SDK provides a complete toolkit for AI observability, decision tracking, and replay functionality. Built on a high-performance Rust core with Python bindings via [PyO3](https://pyo3.rs/), it offers the speed of Rust with the convenience of Python.

## Features

- **High Performance** - Rust core with minimal Python overhead
- **Memory Efficient** - Zero-copy operations where possible
- **Type Safe** - Full Python type hints and error handling
- **Async Support** - Async/await compatible operations

## Installation

Install the Python SDK using pip:

```bash
pip install briefcase-ai
```

## Quick Start

```python
import briefcase_ai

# Initialize the SDK
briefcase_ai.init()

# Create a decision snapshot
decision = briefcase_ai.DecisionSnapshot("my_ai_function")

# Add input and output data
input_data = briefcase_ai.Input("user_query", "What is AI?", "string")
output_data = briefcase_ai.Output("ai_response", "AI is...", "string").with_confidence(0.92)

decision.add_input(input_data)
decision.add_output(output_data)
decision.with_execution_time(234.5)

# Save to storage
storage = briefcase_ai.SqliteBackend.in_memory()
decision_id = storage.save_decision(decision)
print(f"Saved decision: {decision_id}")
```

## For Rust Developers

This crate is primarily used for building the Python extension. To use Briefcase AI in Rust, use the core library directly:

```toml
[dependencies]
briefcase-core = "2.0.4"
```

## Building

This crate requires:
- Rust 1.70+
- Python 3.10+
- PyO3 dependencies

Build the Python extension:

```bash
cd crates/python
maturin build --release
```

## Development

For development with maturin:

```bash
cd crates/python
maturin develop
```

Then test in Python:

```python
import briefcase_ai
print(briefcase_ai.__version__)
```

## Dependencies

- [`briefcase-core`](https://crates.io/crates/briefcase-core) - Core Rust library
- [`pyo3`](https://crates.io/crates/pyo3) - Python FFI bindings
- [`tokio`](https://crates.io/crates/tokio) - Async runtime

## License

MIT License - see [LICENSE](https://github.com/briefcasebrain/briefcase-ai-core/blob/main/LICENSE) file for details.

## Related Packages

- [`briefcase-ai`](https://pypi.org/project/briefcase-ai/) - Python package (end users)
- [`briefcase-core`](https://crates.io/crates/briefcase-core) - Core Rust library
- [`briefcase-wasm`](https://www.npmjs.com/package/briefcase-wasm) - WebAssembly bindings