Skip to main content

Observability SDK for AI agents — traces, costs, and alerts in 3 lines of code.

Project description

Vantra Python SDK

Observability for AI agents — traces, costs, and alerts in 3 lines of code.

PyPI version License: MIT

Install

pip install vantra

Quickstart

import vantra

vantra.init(
    api_key="van_live_...",
    project="my-agent"
)

@vantra.trace
def run_agent(message: str):
    return agent.run(message)  # your existing code — untouched

Every call to run_agent appears in your Vantra dashboard with timing, token usage, cost, and status.

OpenAI auto-patch

import vantra
import openai

vantra.init(api_key="van_live_...", project="my-agent")
client = openai.OpenAI()

@vantra.trace
def ask(question: str) -> str:
    # captured automatically — tokens, cost, latency
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": question}]
    )
    return response.choices[0].message.content

Anthropic auto-patch

import vantra
import anthropic

vantra.init(api_key="van_live_...", project="my-agent")
client = anthropic.Anthropic()

@vantra.trace
def ask(question: str) -> str:
    response = client.messages.create(
        model="claude-opus-4-5",
        max_tokens=1024,
        messages=[{"role": "user", "content": question}]
    )
    return response.content[0].text

Manual spans

@vantra.trace
def run_agent(message: str):
    with vantra.span("search_kb", kind="tool") as span:
        results = search(message)
        span.set_output({"results": results, "count": len(results)})

    with vantra.span("generate", kind="llm"):
        return llm.chat(message, context=results)

Options

Parameter Type Default Description
api_key str required Your van_live_... key from Settings
project str required Project name shown in dashboard
patch_openai bool True Auto-instrument OpenAI calls
patch_anthropic bool True Auto-instrument Anthropic calls
enabled bool True Set False to disable in tests

Links

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

vantra-0.1.3.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

vantra-0.1.3-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file vantra-0.1.3.tar.gz.

File metadata

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

File hashes

Hashes for vantra-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d4cfd84779f6974b9e4a08e1d530b050b8fba0d3e34a0fa0092473d7c99cc45f
MD5 d9bdb5b13ba92bf51f337807619d311d
BLAKE2b-256 6afc0d6257576a350b113cd80978784e70126efe411cb7f2a7e1f63d52e98ca8

See more details on using hashes here.

File details

Details for the file vantra-0.1.3-py3-none-any.whl.

File metadata

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

File hashes

Hashes for vantra-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 90d89f6e547a0853c0e5ba7e2f8bd433b2bb13c24a96f98544b5713e7fa9829b
MD5 5fa16be15c1895f5f2b8f68dfbb939cf
BLAKE2b-256 719a3d7cccad0bcc74b8fa8c8eb6ecc60affdcfd4a966386b7bdb7711af77a68

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