Metadata-Version: 2.4
Name: tracehawk
Version: 0.1.0
Summary: TraceHawk SDK — observability for AI agents
Author-email: TraceHawk <sdk@tracehawk.dev>
License: Apache-2.0
Project-URL: Homepage, https://tracehawk.dev
Project-URL: Documentation, https://docs.tracehawk.dev
Project-URL: Repository, https://github.com/Pha6ha007/AgentObserve
Keywords: opentelemetry,llm,observability,tracing,ai,agents,mcp
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: traceloop-sdk==0.53.2
Requires-Dist: opentelemetry-exporter-otlp-proto-http<2,>=1.38.0
Requires-Dist: opentelemetry-api<2,>=1.38.0
Requires-Dist: opentelemetry-sdk<2,>=1.38.0
Provides-Extra: mcp
Requires-Dist: mcp>=1.6.0; extra == "mcp"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: python-dotenv>=1.0; extra == "dev"
Requires-Dist: mcp>=1.6.0; extra == "dev"
Requires-Dist: fastmcp>=2.0.0; extra == "dev"

# TraceHawk Python SDK

[![PyPI version](https://img.shields.io/pypi/v/tracehawk)](https://pypi.org/project/tracehawk/)
[![Python](https://img.shields.io/pypi/pyversions/tracehawk)](https://pypi.org/project/tracehawk/)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)

**Observability for AI agents.** Automatically instrument OpenAI, Anthropic, MCP, and LangChain calls and send traces to [TraceHawk](https://tracehawk.dev).

## Install

```bash
pip install tracehawk
```

## Quick start

```python
import tracehawk
from openai import OpenAI

tracehawk.init(
    api_key="th-...",          # from TraceHawk Settings → API Keys
    app_name="my-agent",
)

client = OpenAI()

@tracehawk.observe
def run_agent(prompt: str) -> str:
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": prompt}],
    )
    return response.choices[0].message.content
```

All OpenAI, Anthropic, and LangChain calls inside `@tracehawk.observe` are automatically traced — no manual span creation needed.

## Configuration

| Parameter | Env var | Default |
|-----------|---------|---------|
| `api_key` | `TRACEHAWK_API_KEY` | — |
| `endpoint` | `TRACEHAWK_ENDPOINT` | `https://app.tracehawk.dev/api/otel` |
| `app_name` | — | `tracehawk-app` |
| `capture_content` | — | `True` |
| `disable_batch` | — | `False` |

## MCP tracing

```python
pip install tracehawk[mcp]
```

MCP tool calls are automatically captured as `MCP`-kind spans with `mcp.tool_name` attributes.

## Self-hosted

```python
tracehawk.init(
    api_key="th-...",
    endpoint="http://localhost:3001/api/otel",
)
```

## License

Apache 2.0
