Skip to main content

Python SDK for Vaquero observability and tracing platform

Project description

🚀 Vaquero Python SDK

Comprehensive observability and tracing for AI agents and applications

Zero-config tracingAuto-instrumentationProduction-ready

PyPI version Python 3.8+ License: MIT

<style> .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; } .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0; } .card { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; padding: 1rem; margin: 0.5rem 0; } .feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin: 2rem 0; } .feature-card { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 1.5rem; border-radius: 12px; text-align: center; } .feature-icon { font-size: 2rem; margin-bottom: 1rem; } .doc-tabs { display: flex; gap: 1rem; margin: 2rem 0; flex-wrap: wrap; } .tab { background: #f1f3f4; padding: 1rem 1.5rem; border-radius: 8px; border: 2px solid transparent; cursor: pointer; } .tab.active { background: #4285f4; color: white; border-color: #4285f4; } .tab:hover { background: #e8f0fe; } .btn-primary { background: #4285f4; color: white; padding: 0.5rem 1rem; border-radius: 6px; text-decoration: none; display: inline-block; } .btn-primary:hover { background: #3367d6; } .install-options { margin: 2rem 0; } .option { background: #f8f9fa; border-left: 4px solid #4285f4; padding: 1rem; margin: 1rem 0; border-radius: 0 8px 8px 0; } .code-block { background: #1e1e1e; color: #d4d4d4; padding: 1rem; border-radius: 6px; overflow-x: auto; font-family: 'Consolas', monospace; font-size: 0.9em; } .code-card { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; padding: 1.5rem; margin: 1rem 0; } .code-card h4 { margin-top: 0; color: #4285f4; } .section-grid { display: grid; gap: 2rem; margin: 2rem 0; } .env-vars { background: #e8f5e8; border: 1px solid #4caf50; border-radius: 8px; padding: 1.5rem; margin: 1rem 0; } .env-vars h4 { margin-top: 0; color: #2e7d32; } .env-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.5rem; margin: 1rem 0; } .env-grid code { background: #f1f8e9; padding: 0.25rem 0.5rem; border-radius: 4px; font-family: monospace; } .config-table { overflow-x: auto; margin: 2rem 0; } .config-table table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; } .config-table th, .config-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid #e9ecef; } .config-table th { background: #f8f9fa; font-weight: 600; } .config-table tr:hover { background: #f8f9fa; } .best-practices { background: #fff3cd; border: 1px solid #ffc107; border-radius: 8px; padding: 1.5rem; margin: 2rem 0; } .best-practices h4 { margin-top: 0; color: #856404; } .dev-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin: 2rem 0; } .dev-card { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; padding: 1.5rem; } .dev-card h4 { margin-top: 0; color: #4285f4; } .resource-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin: 2rem 0; } .resource-link { display: flex; align-items: center; background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; padding: 1.5rem; text-decoration: none; color: inherit; } .resource-link:hover { background: #e9ecef; } .resource-link .icon { font-size: 2rem; margin-right: 1rem; } .resource-link h4 { margin: 0 0 0.5rem 0; color: #4285f4; } .resource-link p { margin: 0; color: #6c757d; } /* Mobile responsiveness */ @media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .feature-grid { grid-template-columns: 1fr; } .doc-tabs { flex-direction: column; } .env-grid { grid-template-columns: 1fr; } .dev-section { grid-template-columns: 1fr; } .resource-links { grid-template-columns: 1fr; } } </style>

⚡ Quick Start

1. Install

pip install vaquero-sdk

2. Configure

import vaquero

vaquero.init(api_key="your-api-key")

3. Trace

@vaquero.trace("my_agent")
def process_data(data):
    return {"result": data}

Done! ✨


🎯 Key Features

🔍

Automatic Tracing

One decorator instruments your entire function with comprehensive observability

🤖

LLM Auto-Instrumentation

Automatically captures OpenAI, Anthropic, and other LLM calls with zero code changes

Async-First

Full support for async/await patterns with intelligent batching

📊

Performance Monitoring

Built-in profiling, memory tracking, and performance insights

🛡️

Production Ready

Circuit breakers, retry logic, and enterprise-grade reliability

🎛️

Zero Configuration

Environment variables and sensible defaults get you started instantly


📚 Documentation

🚀 Getting Started

Complete guide to install, configure, and start tracing

View Guide

📖 API Reference

Detailed API documentation and configuration options

View Reference

💡 Examples

Real-world examples and integration patterns

View Examples

🔧 Installation Options

🛠️ From PyPI (Recommended)

pip install vaquero-sdk

🔨 From Source

git clone https://github.com/vaquero/vaquero-python.git
cd vaquero-python
pip install -e .

📦 With All Dependencies

pip install vaquero-sdk[all]

💻 Code Examples

Basic Function Tracing

import vaquero

# Configure once
vaquero.init(api_key="your-key")

@vaquero.trace("data_processor")
def process_data(data):
    """Process some data."""
    result = {"processed": len(data), "items": data}
    return result

# Your function is now automatically traced!
result = process_data(["item1", "item2", "item3"])

Async Support

@vaquero.trace("api_client")
async def fetch_data(url):
    """Async data fetching."""
    async with httpx.AsyncClient() as client:
        response = await client.get(url)
        return response.json()

# Works seamlessly with async/await
result = await fetch_data("https://api.example.com/data")

Manual Span Creation

async with vaquero.span("complex_operation") as span:
    span.set_attribute("operation_type", "batch_processing")
    span.set_attribute("batch_size", len(data))

    # Your complex logic here
    result = await process_batch(data)

    span.set_attribute("result_count", len(result))

Auto-Instrumentation (Zero Code Changes!)

# Enable LLM auto-instrumentation
vaquero.init(api_key="your-key", auto_instrument_llm=True)

# Now any LLM calls are automatically traced!
import openai

client = openai.OpenAI(api_key="your-key")
response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hello!"}]
)
# System prompts, tokens, timing all captured automatically! ✨

🎨 Advanced Usage

Manual Span Creation

Sync & Async Support

# Same API works for both sync and async!
with vaquero.span("custom_operation") as span:
    span.set_attribute("user_id", "12345")
    result = expensive_computation()
    span.set_attribute("result_size", len(result))

async with vaquero.span("async_operation") as span: span.set_attribute("operation_type", "ml_inference") result = await ml_model.predict(data) span.set_attribute("confidence", result.confidence)

Nested Tracing

Parent-Child Relationships

@vaquero.trace("main_processor")
def main_process(data):
    # Parent span automatically created
    preprocessed = preprocess_data(data)
# Child span with context
with vaquero.span("validation") as span:
    span.set_attribute("data_size", len(preprocessed))
    validate_data(preprocessed)

return postprocess_data(preprocessed)</pre>

Custom Configuration

Advanced Setup

from vaquero import SDKConfig

config = SDKConfig( api_key="your-api-key", project_id="your-project-id", # Optional - auto-provisioned batch_size=100, # Optimize for your workload flush_interval=5.0, # Balance latency vs efficiency max_retries=3, # Handle transient failures capture_inputs=True, # Privacy vs debugging tags={"team": "ml", "env": "prod"} # Global metadata )

vaquero.init(config=config)

Environment Variables

Configuration via Environment

VAQUERO_API_KEY=your-key VAQUERO_PROJECT_ID=your-project VAQUERO_ENDPOINT=https://api.vaquero.com VAQUERO_BATCH_SIZE=50 VAQUERO_AUTO_INSTRUMENT_LLM=true
import vaquero
vaquero.init()  # Loads from env vars

Error Handling & Resilience

Automatic Error Capture

@vaquero.trace("risky_operation")
def risky_operation(data):
    if not data:
        raise ValueError("Data cannot be empty")
    return process(data)

try: result = risky_operation([]) except ValueError as e: # Error automatically captured with full context print(f"Operation failed: {e}") # Stack trace, function args, timing all preserved

Performance Monitoring

Built-in Observability

# Check SDK health
stats = vaquero.get_default_sdk().get_stats()
print(f"Traces: {stats['traces_sent']}")
print(f"Memory: {stats['memory_usage_mb']} MB")

Manual control

vaquero.flush() # Force send pending traces

Get current context

from vaquero import get_current_span span = get_current_span() span.set_attribute("custom_metric", value)


🔧 Configuration Reference

Parameter Type Default Description
api_key string Required Your Vaquero API key
project_id string Optional Your project identifier (auto-provisioned)
batch_size int 100 Traces per batch
flush_interval float 5.0 Seconds between flushes
auto_instrument_llm bool true Auto-capture LLM calls
capture_system_prompts bool true Capture LLM system prompts
capture_code bool true Capture source code for analysis
mode string "development" Operating mode ("development" or "production")

🚨 Best Practices

✅ Do

  • Use descriptive agent names - @vaquero.trace("user_authentication_validator")
  • Add meaningful attributes - span.set_attribute("user_id", user_id)
  • Handle errors gracefully - SDK captures exceptions automatically
  • Use async context managers - async with vaquero.span("operation"):

❌ Avoid

  • Generic names - @vaquero.trace("validator") (too vague)
  • Sensitive data - Don't log passwords, keys, or PII
  • Blocking operations - Use async patterns for I/O
  • Manual timing - SDK handles timing automatically

🛠️ Development

🏗️ Setup

git clone https://github.com/vaquero/vaquero-python.git
cd vaquero-python
pip install -e ".[dev]"

🧪 Testing

make test          # Run all tests
make test-cov      # With coverage
make lint          # Code quality

📝 Contributing

Join our community! See Contributing Guide


📖 Resources


Need help? Join our Discord community or email support@vaquero.app

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vaquero_sdk-0.1.0.tar.gz (80.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vaquero_sdk-0.1.0-py3-none-any.whl (82.2 kB view details)

Uploaded Python 3

File details

Details for the file vaquero_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: vaquero_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 80.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for vaquero_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4d6c5f9ca1908d5d62b58762ba5c627ab3bb74d447a9d6984bc86d43fb3777df
MD5 7648fc6e324aa3c9165ac28182fe2e15
BLAKE2b-256 578cb4e77a5696cdf8bfe7aab3ef57358c733d45bc4ff8e1d4d4a76b3a3d0aec

See more details on using hashes here.

File details

Details for the file vaquero_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vaquero_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 82.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for vaquero_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 753109711c8b705519a54eee3babe7d875decec06f60a747f2995bd6120c4800
MD5 94cd8266ec18a1f5b2fc5c3c4d6e8e51
BLAKE2b-256 ada4a8d625a4dba3a608f9f7fb69810cbc9bf8feb21c4f167d40d80d034ac2b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page