# Changelog

All notable changes to the `carrot-ai` Python SDK will be documented in this file.

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

---

## [0.2.0] — 2026-03-09

### Added

- `name` parameter on `carrot_ai.wrap()` — override the default trace name (derived from the API resource, e.g. `"chat.completions"`) with a custom identifier for your service or client.
- `name` parameter on `carrot_ai.patch_litellm()` — same behavior for litellm-patched calls.

---

## [0.1.0] — 2025-01-01

### Added

- Initial public release of the Carrot AI Python SDK.
- `carrot_ai.init()` — initialize the SDK with an API key and optional configuration (`base_url`, `flush_interval`, `batch_size`).
- `carrot_ai.wrap()` — transparently wrap an `OpenAI` or `Anthropic` client to auto-capture every `create()` call as a structured trace. Works with both sync and async clients.
- `carrot_ai.patch_litellm()` — monkey-patch `litellm.completion` and `litellm.acompletion` for automatic tracing across 100+ LLM providers.
- `@carrot_ai.trace` decorator — capture multi-step functions (RAG pipelines, agents, chains) as parent traces, with wrapped LLM calls automatically linked as children via `metadata.parent_trace_id`.
- Streaming support — sync and async streaming responses are proxied transparently; traces are submitted automatically when the stream finishes.
- Tool call capture — full tool call payloads (names, arguments, IDs) are recorded for both OpenAI and Anthropic formats.
- Background batched submission — traces are queued in-memory and flushed to the Carrot API on a configurable interval by a daemon thread.
- `carrot_ai.flush()` — force-flush pending traces synchronously (useful before process exit in short-lived scripts).
- Automatic `atexit` flush — the SDK registers a shutdown hook so traces are never lost on normal interpreter exit.
- Zero required dependencies — the core SDK uses only the Python standard library; `openai`, `anthropic`, and `litellm` are optional extras.
- `py.typed` marker — full PEP 561 type annotation support.
- Auto-initialization via `CARROT_API_KEY` environment variable — explicit `init()` call can be skipped.
- `CARROT_BASE_URL` environment variable override for self-hosted deployments.

[0.2.0]: https://github.com/carrotlabs/carrot-ai-python/releases/tag/v0.2.0
[0.1.0]: https://github.com/carrotlabs/carrot-ai-python/releases/tag/v0.1.0
