Plott Analytics SDK Core for Python - Event tracking and batching
Project description
Plott SDK Core for Python
The core analytics client for Plott, providing event tracking with batching, retry logic, and async support.
Installation
pip install plott-sdk-core
Quick Start
from plott_analytics import PlottAnalytics
# Initialize the client
client = PlottAnalytics({
"api_key": "cpk_...", # or set PLOTT_API_KEY env var
"environment": "development",
})
# Track events
client.track_message_event(
role="user",
content="Hello, world!",
run_id="run-123",
session_id="session-456",
)
client.track_message_event(
role="assistant",
content="Hi there! How can I help you today?",
run_id="run-123",
session_id="session-456",
)
# Flush and shutdown when done
await client.flush()
await client.shutdown()
Event Types
Message Events
Track messages between users and AI assistants:
client.track_message_event(
role="user", # or "assistant", "system"
content="Message content",
run_id="run-123",
session_id="session-456",
token_count=50, # optional
model="gpt-4", # optional
)
Run Events
Track the lifecycle of agent runs:
client.track_run_event(value="start", run_id="run-123")
# ... agent execution ...
client.track_run_event(value="end", run_id="run-123")
Tool Events
Track tool/function calls:
client.track_tool_event(
tool_call_id="call-123",
tool_status="started",
tool_name="search",
args={"query": "latest news"},
)
client.track_tool_event(
tool_call_id="call-123",
tool_status="completed",
result="Found 10 results...",
)
State Snapshot Events
Track state changes:
client.track_state_snapshot_event(
snapshot={"messages": [...], "context": {...}},
run_id="run-123",
)
Error Events
Track errors:
client.track_error_event(
error={
"name": "ValidationError",
"message": "Invalid input",
"code": "INVALID_INPUT",
},
run_id="run-123",
severity="medium",
)
LLM Call Events
Track LLM API calls with token usage:
client.track_llm_call_event(
model="gpt-4",
input_tokens=100,
output_tokens=50,
latency_ms=1200,
provider="openai",
is_streaming=True,
)
Configuration
client = PlottAnalytics({
"api_key": "cpk_...", # Required
"base_url": "https://...", # Default: https://api.askwise.com
"environment": "production", # production, staging, development, test
"batch_size": 10, # Events per batch
"flush_interval": 1.0, # Seconds between auto-flushes
"retry_attempts": 3, # Max retry attempts
"retry_delay": 1.0, # Initial retry delay (exponential backoff)
"debug": False, # Enable debug logging
})
License
MIT
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
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 plott_sdk_core-0.0.0a0.tar.gz.
File metadata
- Download URL: plott_sdk_core-0.0.0a0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91985843533e0d93390c4a2e110c3756bb18d42037e9ca066f44a135036d4a69
|
|
| MD5 |
4b9cc32e851edc80c4bf2fe3e3e19de6
|
|
| BLAKE2b-256 |
bec3db9ca7500327772680f58ba3c9a8e967dec152e443d8d4627fdb8833ae8c
|
File details
Details for the file plott_sdk_core-0.0.0a0-py3-none-any.whl.
File metadata
- Download URL: plott_sdk_core-0.0.0a0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
375d874a3475ad7408f42606bc78bc56c38c4dca4609d62d85377171cad4b3ca
|
|
| MD5 |
a6b9dab57708c8f0c0ac5e42a9fcb8ff
|
|
| BLAKE2b-256 |
ef0938a4eb61dc97d2886e5992cd81d270ae9605b01e3fcb944db9214ad02df7
|