TraceHawk SDK — observability for AI agents
Project description
TraceHawk Python SDK
Observability for AI agents. Automatically instrument OpenAI, Anthropic, MCP, and LangChain calls and send traces to TraceHawk.
Install
pip install tracehawk
Quick start
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
pip install tracehawk[mcp]
MCP tool calls are automatically captured as MCP-kind spans with mcp.tool_name attributes.
Self-hosted
tracehawk.init(
api_key="th-...",
endpoint="http://localhost:3001/api/otel",
)
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tracehawk-0.1.0.tar.gz.
File metadata
- Download URL: tracehawk-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8cc1aff486554bfe7086d01de613fa0462c1ab61aaca2fc8868b5e884dafc23
|
|
| MD5 |
1fa5ee0c95c7d34c7d3a39c8728a310c
|
|
| BLAKE2b-256 |
6a6c0fe0719932c7efa106ace88e28898f932baa0480f52b5672b980f22aa381
|
File details
Details for the file tracehawk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tracehawk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fefb4fca9cbb83e250f2e1f433b50ce31919d2e496b63414e7eed3b7b32879c6
|
|
| MD5 |
6087612f37195c282b3371837167396d
|
|
| BLAKE2b-256 |
9f129d469468c380f6fdee20c5cb55e09d75b1da51377008ae39fe37534e5e35
|