Obiguard Trace Python SDK
Open Source & Open Telemetry(OTEL) Observability for LLM Applications
📚 Table of Contents
- ✨ Features
- 🚀 Quick Start
- 🔗 Integrations
- 🌐 Getting Started
- ⚙️ Configuration
- 🔧 Advanced Features
- 🔒 Security
- 📜 License
Obiguard Trace is an open source observability software which lets you capture, debug and analyze traces and metrics from all your applications that leverages LLM APIs, Vector Databases and LLM based Frameworks.
✨ Features
- 📊 Open Telemetry Support: Built on OTEL standards for comprehensive tracing
- 🔄 Real-time Monitoring: Track LLM API calls, vector operations, and framework usage
- 🎯 Performance Insights: Analyze latency, costs, and usage patterns
- 🔍 Debug Tools: Trace and debug your LLM application workflows
- 📈 Analytics: Get detailed metrics and visualizations
- 🛠️ Framework Support: Extensive integration with popular LLM frameworks
- 🔌 Vector DB Integration: Support for major vector databases
- 🎨 Flexible Configuration: Customizable tracing and monitoring options
🚀 Quick Start
pip install obiguard-trace-python-sdk
from obiguard_trace_python_sdk import langtrace
langtrace.init(api_key='<your Obiguard API or virtual key>') # Get your API key at obiguard.ai
🔗 Supported Integrations
Obiguard Trace automatically captures traces from the following vendors:
LLM Providers
| Provider | TypeScript SDK | Python SDK |
|---|---|---|
| OpenAI | ✅ | ✅ |
| Anthropic | ✅ | ✅ |
| Azure OpenAI | ✅ | ✅ |
| Cohere | ✅ | ✅ |
| Groq | ✅ | ✅ |
| Perplexity | ✅ | ✅ |
| Gemini | ❌ | ✅ |
| Mistral | ❌ | ✅ |
| AWS Bedrock | ✅ | ✅ |
| Ollama | ❌ | ✅ |
| Cerebras | ❌ | ✅ |
Frameworks
| Framework | TypeScript SDK | Python SDK |
|---|---|---|
| Langchain | ❌ | ✅ |
| LlamaIndex | ✅ | ✅ |
| Langgraph | ❌ | ✅ |
| LiteLLM | ❌ | ✅ |
| DSPy | ❌ | ✅ |
| CrewAI | ❌ | ✅ |
| VertexAI | ✅ | ✅ |
| EmbedChain | ❌ | ✅ |
| Autogen | ❌ | ✅ |
| HiveAgent | ❌ | ✅ |
| Inspect AI | ❌ | ✅ |
| Graphlit | ❌ | ✅ |
| Phidata | ❌ | ✅ |
| Arch | ❌ | ✅ |
Vector Databases
| Database | TypeScript SDK | Python SDK |
|---|---|---|
| Pinecone | ✅ | ✅ |
| ChromaDB | ✅ | ✅ |
| QDrant | ✅ | ✅ |
| Weaviate | ✅ | ✅ |
| PGVector | ✅ | ✅ (SQLAlchemy) |
| MongoDB | ❌ | ✅ |
| Milvus | ❌ | ✅ |
🌐 Getting Started
Obiguard Security Control Panel for your AI ☁️
- Sign up by going to this link.
- Create a new Project after signing up. Projects are containers for storing traces and metrics generated by your application. If you have only one application, creating 1 project will do.
- Generate an API key by going inside the project.
- In your application, install the Obiguard SDK and initialize it with the API key you generated in the step 3.
- The code for installing and setting up the SDK is shown below
⚙️ Configuration
Initialize Options
The SDK can be initialized with various configuration options to customize its behavior:
langtrace.init(
api_key: Optional[str] = None, # API key for authentication
batch: bool = True, # Enable/disable batch processing
write_spans_to_console: bool = False, # Console logging
custom_remote_exporter: Optional[Any] = None, # Custom exporter
api_host: Optional[str] = None, # Custom API host
disable_instrumentations: Optional[Dict] = None, # Disable specific integrations
service_name: Optional[str] = None, # Custom service name
disable_logging: bool = False, # Disable all logging
headers: Dict[str, str] = {}, # Custom headers
)
Configuration Details
| Parameter | Type | Default Value | Description |
|---|---|---|---|
api_key |
str |
LANGTRACE_API_KEY or None |
The API key for authentication. Can be set via environment variable |
batch |
bool |
True |
Whether to batch spans before sending them to reduce API calls |
write_spans_to_console |
bool |
False |
Enable console logging for debugging purposes |
custom_remote_exporter |
Optional[Exporter] |
None |
Custom exporter for sending traces to your own backend |
api_host |
Optional[str] |
https://langtrace.ai/ |
Custom API endpoint for self-hosted deployments |
disable_instrumentations |
Optional[Dict] |
None |
Disable specific vendor instrumentations (e.g., {'only': ['openai']}) |
service_name |
Optional[str] |
None |
Custom service name for trace identification |
disable_logging |
bool |
False |
Disable SDK logging completely |
headers |
Dict[str, str] |
{} |
Custom headers for API requests |
Environment Variables
Configure Obiguard Trace behavior using these environment variables:
| Variable | Description | Default | Impact |
|---|---|---|---|
LANGTRACE_API_KEY |
Primary authentication method | Required* | Required if not passed to init() |
TRACE_PROMPT_COMPLETION_DATA |
Control prompt/completion tracing | true |
Set to 'false' to opt out of prompt/completion data collection |
TRACE_DSPY_CHECKPOINT |
Control DSPy checkpoint tracing | true |
Set to 'false' to disable checkpoint tracing |
LANGTRACE_ERROR_REPORTING |
Control error reporting | true |
Set to 'false' to disable Sentry error reporting |
LANGTRACE_API_HOST |
Custom API endpoint | https://langtrace.ai/ |
Override default API endpoint for self-hosted deployments |
Performance Note: Setting
TRACE_DSPY_CHECKPOINT=falseis recommended in production environments as checkpoint tracing involves state serialization which can impact latency.
Security Note: When
TRACE_PROMPT_COMPLETION_DATA=false, no prompt or completion data will be collected, ensuring sensitive information remains private.
🔧 Advanced Features
Root Span Decorator
Use the root span decorator to create custom trace hierarchies:
from obiguard_trace_python_sdk import langtrace
@langtrace.with_langtrace_root_span(name="custom_operation")
def my_function():
# Your code here
pass
Additional Attributes
Inject custom attributes into your traces:
# Using decorator
@langtrace.with_additional_attributes({"custom_key": "custom_value"})
def my_function():
pass
# Using context manager
with langtrace.inject_additional_attributes({"custom_key": "custom_value"}):
# Your code here
pass
Prompt Registry
Register and manage prompts for better traceability:
from obiguard_trace_python_sdk import langtrace
# Register a prompt template
langtrace.register_prompt("greeting", "Hello, {name}!")
# Use registered prompt
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": langtrace.get_prompt("greeting", name="Alice")}]
)
User Feedback System
Collect and analyze user feedback:
from obiguard_trace_python_sdk import langtrace
# Record user feedback for a trace
langtrace.record_feedback(
trace_id="your_trace_id",
rating=5,
feedback_text="Great response!",
metadata={"user_id": "123"}
)
DSPy Checkpointing
Manage DSPy checkpoints for workflow tracking:
from obiguard_trace_python_sdk import langtrace
# Enable checkpoint tracing (disabled by default in production)
langtrace.init(
api_key="your_api_key",
dspy_checkpoint_tracing=True
)
Vector Database Operations
Track vector database operations:
from obiguard_trace_python_sdk import langtrace
# Vector operations are automatically traced
with langtrace.inject_additional_attributes({"operation_type": "similarity_search"}):
results = vector_db.similarity_search("query", k=5)
For more detailed examples and use cases, visit our documentation.
🔒 Security
To report security vulnerabilities, email us at support@obiguard.com.
📜 License
Obiguard Trace Python SDK is licensed under the Apache 2.0 License. You can read about this license here.
Metadata
Release files for obiguard-trace-python-sdk 3.8.26
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| obiguard_trace_python_sdk-3.8.26.tar.gz | 6.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| obiguard_trace_python_sdk-3.8.26-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.3 MB
Release files / obiguard_trace_python_sdk-3.8.26.tar.gz
| Download URL | obiguard_trace_python_sdk-3.8.26.tar.gz |
|---|---|
| Size | 6.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbacb8c55b4b18031b65fa79d7bde72c62c0089269faea9484e6cf5cfd8487a3
|
|
BLAKE2b-256 checksum How to use checksums |
6707c7a73ea2568fc73e2899c1b0362ce3ac71a0e99ed00bee3f7109660de57e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2025.
Transparency logRelease files / obiguard_trace_python_sdk-3.8.26-py3-none-any.whl
| Download URL | obiguard_trace_python_sdk-3.8.26-py3-none-any.whl |
|---|---|
| Size | 6.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66a1c7bf1579d8426c096260a0b08b2ac4a46f0d1e601f325cf81532aca2bc20
|
|
BLAKE2b-256 checksum How to use checksums |
bea0f9ff681160ade3508413096412a0ae0632c1b15548eefe96546049e6cb6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2025.
Transparency log