Oopstrace Python SDK — LLM observability with automatic batching
Project description
OopsTrace Python SDK
LLM observability for Python. Trace every call, span, token count, and cost — visible instantly at app.oopstrace.com.
Install
pip install oopstrace
Quickstart
import oopstrace
oopstrace.init(
api_key="tr_...", # from app.oopstrace.com → project → Access Keys
project_id="...", # your project ID
)
@oopstrace.trace
def run_agent(user_input: str) -> str:
with oopstrace.span("llm-call", span_kind="LLM") as s:
s.set_output("Hello from OopsTrace")
return "Hello from OopsTrace"
run_agent("test")
oopstrace.flush()
Auto-instrument OpenAI / Anthropic
oopstrace.init(api_key="tr_...", project_id="...", auto_instrument=True)
# All openai.chat.completions.create() and anthropic.messages.create()
# calls are now traced automatically — no decorators needed.
Manual spans
@oopstrace.trace
def pipeline(query: str):
with oopstrace.span("retrieval", span_kind="TOOL") as s:
docs = retrieve(query)
s.set_input(query)
s.set_output(str(docs))
with oopstrace.span("generate", span_kind="LLM") as s:
answer = llm(query, docs)
s.set_model("gpt-4o")
s.set_tokens(input=100, output=50)
return answer
Self-hosted
oopstrace.init(
api_key="tr_...",
project_id="...",
endpoint="https://app.yourdomain.com", # point at your own server
)
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
oopstrace-0.1.0.tar.gz
(8.3 kB
view details)
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 oopstrace-0.1.0.tar.gz.
File metadata
- Download URL: oopstrace-0.1.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8c0edfd4f6453f72d82329336797610682b9eee38b9fd2584f8d98ebc919e5f
|
|
| MD5 |
fbc80c6a382539ee1c4d1320385f127e
|
|
| BLAKE2b-256 |
f86e6ed803eebeead9f833700d698e604b5c601b9efe82d20d569df4ec6c478d
|
File details
Details for the file oopstrace-0.1.0-py3-none-any.whl.
File metadata
- Download URL: oopstrace-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4958d08df7d8d3772f6bc776b52513dbe2eb5cc3ec1d6e6c55e3a55eada2c843
|
|
| MD5 |
24432bf24e414b05cd3f30d585cd8dcf
|
|
| BLAKE2b-256 |
3ec778565826f87c0d181b379e1a6ba7af77556c37d5f19dc56750d60c52b284
|