Python SDK for PandaProbe — open-source agent tracing and evaluation
Project description
PandaProbe Python SDK
Python SDK for PandaProbe — open-source agent tracing and evaluation.
Installation
pip install pandaprobe
With optional integrations:
pip install pandaprobe[openai] # OpenAI wrapper
pip install pandaprobe[gemini] # Google Gemini wrapper
pip install pandaprobe[anthropic] # Anthropic wrapper
pip install pandaprobe[langgraph] # LangGraph integration
pip install pandaprobe[all] # Everything
Quick Start
1. Set environment variables
export PANDAPROBE_API_KEY="sk_pp_..."
export PANDAPROBE_PROJECT_NAME="my-project"
export PANDAPROBE_ENDPOINT="my-pandaprobe-endpoint"
export PANDAPROBE_ENVIRONMENT="production" # optional
export PANDAPROBE_RELEASE="v1.2.0" # optional
The SDK auto-initializes from these environment variables on first use — no explicit init() call is needed. To disable tracing, set PANDAPROBE_ENABLED=false.
You can still use pandaprobe.init(...) for programmatic configuration if preferred.
2. Decorator-based tracing (custom agents)
import pandaprobe
@pandaprobe.trace(name="my-agent")
def run_agent(query: str):
@pandaprobe.span(name="llm-call", kind="LLM")
def call_llm(prompt):
return openai_client.chat.completions.create(...)
@pandaprobe.span(name="search", kind="TOOL")
def search(q):
return search_engine.search(q)
context = search(query)
return call_llm(f"Context: {context}\nQuery: {query}")
3. OpenAI wrapper (automatic LLM tracing)
from pandaprobe.wrappers import wrap_openai
import openai
client = wrap_openai(openai.OpenAI())
# Chat Completions API — automatically traced:
response = client.chat.completions.create(
model="gpt-5.4-nano",
messages=[{"role": "user", "content": "Hello"}],
)
# Responses API — also automatically traced, including reasoning summaries
# and built-in tool calls (web_search, function_call, etc.) as child spans:
response = client.responses.create(
model="gpt-5.4-nano",
input="Explain recursion in one sentence.",
reasoning={"effort": "low", "summary": "auto"},
)
4. Gemini wrapper (automatic LLM tracing)
from pandaprobe.wrappers import wrap_gemini
from google import genai
client = wrap_gemini(genai.Client())
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Explain recursion in one sentence.",
)
5. Anthropic wrapper (automatic LLM tracing)
from pandaprobe.wrappers import wrap_anthropic
import anthropic
client = wrap_anthropic(anthropic.Anthropic())
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=150,
system="You are a concise assistant.",
messages=[{"role": "user", "content": "Explain recursion in one sentence."}],
)
6. LangGraph integration
from pandaprobe.integrations.langgraph import LangGraphCallbackHandler
handler = LangGraphCallbackHandler()
result = graph.invoke(
{"messages": [HumanMessage(content="hello")]},
config={"callbacks": [handler]},
)
7. Session and user tracking
Group related traces under a session and/or user using the universal context API:
import pandaprobe
# Context managers — scoped to the block
with pandaprobe.session("conversation-123"):
with pandaprobe.user("user-abc"):
run_agent("What is recursion?")
run_agent("Can you give me an example?")
# Imperative — useful for dynamic switching
pandaprobe.set_session("conversation-456")
pandaprobe.set_user("user-xyz")
run_agent("New topic")
Both propagate across all SDK layers (decorators, wrappers, integrations, context managers). Explicit parameters (session_id=, user_id=) take precedence over the context.
8. Programmatic scoring
pandaprobe.score(
trace_id="...",
name="user_satisfaction",
value="0.9",
data_type="NUMERIC",
reason="User clicked thumbs up",
)
9. Flushing
For short-lived scripts, call pandaprobe.flush() before exiting to ensure all traces are sent. For long-running processes, the SDK flushes automatically via a background thread and an atexit handler.
pandaprobe.flush()
pandaprobe.shutdown()
Configuration
| Environment Variable | Default | Description |
|---|---|---|
PANDAPROBE_API_KEY |
(required) | API key |
PANDAPROBE_PROJECT_NAME |
(required) | Project name |
PANDAPROBE_ENDPOINT |
http://localhost:8000 |
Backend URL |
PANDAPROBE_ENVIRONMENT |
None |
Environment tag (e.g. production, staging) |
PANDAPROBE_RELEASE |
None |
Release/version tag (e.g. v1.2.0) |
PANDAPROBE_ENABLED |
true |
Enable/disable SDK |
PANDAPROBE_BATCH_SIZE |
10 |
Traces per flush batch |
PANDAPROBE_FLUSH_INTERVAL |
5.0 |
Seconds between flushes |
PANDAPROBE_DEBUG |
false |
Verbose logging |
Development
make py-install # Install all deps (providers, examples, dev tools)
make py-lint # Run linter
make py-format # Auto-format
make py-test # Run tests
make py-test-cov # Tests with coverage
License
MIT
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
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 pandaprobe-0.1.1.tar.gz.
File metadata
- Download URL: pandaprobe-0.1.1.tar.gz
- Upload date:
- Size: 476.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a3ef2f096354beeeb552cfe14e58ca7360e0633760670ca934207b22d44d6c4
|
|
| MD5 |
7151275b42e77c7691964497f871f465
|
|
| BLAKE2b-256 |
6c1be6c9052bc90f8f0a00808ab32cb4b5ec73c156c143cbd952601c64f7dd0d
|
Provenance
The following attestation bundles were made for pandaprobe-0.1.1.tar.gz:
Publisher:
release-python.yml on chirpz-ai/pandaprobe-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pandaprobe-0.1.1.tar.gz -
Subject digest:
9a3ef2f096354beeeb552cfe14e58ca7360e0633760670ca934207b22d44d6c4 - Sigstore transparency entry: 1195600273
- Sigstore integration time:
-
Permalink:
chirpz-ai/pandaprobe-sdk@749558a104f21fab6b899a42dfab42a4c562e9d1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/chirpz-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@749558a104f21fab6b899a42dfab42a4c562e9d1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pandaprobe-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pandaprobe-0.1.1-py3-none-any.whl
- Upload date:
- Size: 79.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e3e3e5858d478687ce2971125c53408a547db41e46aa28d5af81ed878c4b40d
|
|
| MD5 |
f002ace3344ce5473009df35cd0ec437
|
|
| BLAKE2b-256 |
add141f4f50d30a10d446e7e6ce403953780ff977e5871f093fdf83dd0e6b637
|
Provenance
The following attestation bundles were made for pandaprobe-0.1.1-py3-none-any.whl:
Publisher:
release-python.yml on chirpz-ai/pandaprobe-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pandaprobe-0.1.1-py3-none-any.whl -
Subject digest:
5e3e3e5858d478687ce2971125c53408a547db41e46aa28d5af81ed878c4b40d - Sigstore transparency entry: 1195600441
- Sigstore integration time:
-
Permalink:
chirpz-ai/pandaprobe-sdk@749558a104f21fab6b899a42dfab42a4c562e9d1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/chirpz-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@749558a104f21fab6b899a42dfab42a4c562e9d1 -
Trigger Event:
push
-
Statement type: