Monitor your AI agents in 3 lines of code — tokens, cost, latency, and silent failures
Project description
opsveritas
Monitor your AI agents in three lines of code. Tracks tokens, cost, latency, model, and silent failures (200 OK with empty output) — and routes alerts to Slack / Email / Teams via OpsVeritas AI Agents Control Tower.
pip install opsveritas
Quick start (3 lines)
import opsveritas
opsveritas.init("<your-ingest-key>") # key from Settings → Integrations
client = opsveritas.wrap(openai_client, agent_name="Support Bot")
# use `client` exactly as before — runs appear in your dashboard automatically
Works the same for Anthropic and Gemini clients. Prefer manual control? Use the decorator:
@opsveritas.monitor("Nightly Report")
def run_report():
...
LangChain (one line)
Attach the handler to any LangChain chat model, LLM or chain — every call reports token / cost / latency / silent-failure automatically:
from langchain_openai import ChatOpenAI
import opsveritas
opsveritas.init("<your-ingest-key>")
model = ChatOpenAI(callbacks=[opsveritas.langchain("My Agent")])
Needs langchain-core (optional): pip install "opsveritas[langchain]". Works with any LangChain-backed provider (OpenAI, Anthropic, Gemini, Groq…). Inside opsveritas.run(...) the handler aggregates into a single execution instead of double-counting.
What data is sent
By design the SDK sends metadata only, plus a short output snippet — never your prompts/inputs:
| Sent | Detail |
|---|---|
| ✅ Metadata | agent name, status, timestamps, duration, token counts, model, cost, tool-call count |
| ⚠️ Output snippet | first 300 chars of the response (output_summary) — powers silent-failure detection |
| ⚠️ Error message | the exception text, if a call fails |
| ❌ Prompts / inputs | never sent — only token counts |
Metadata-only mode (for regulated / client data)
Drop the output snippet and redact error text so no response content ever leaves your environment — token/cost/latency metadata still flows:
opsveritas.init("<your-ingest-key>", metadata_only=True)
Or set the environment variable:
OPSVERITAS_METADATA_ONLY=true
Reliability
Telemetry is non-blocking and fire-and-forget — it never raises into your code and never slows your agent. If the ingest endpoint is briefly unreachable, sends are retried with backoff and buffered in memory (bounded), then flushed on the next event — so a transient outage doesn't lose telemetry.
Configuration
opsveritas.init(
api_key,
endpoint="https://agents.opsveritas.com", # optional
metadata_only=False, # optional; when True, no response content is sent
)
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 opsveritas-0.3.1.tar.gz.
File metadata
- Download URL: opsveritas-0.3.1.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
879acf9169aaa9925b54a12199e0d8bca862a91a917ca7776bbfdf875348abae
|
|
| MD5 |
212c5f728451a090e3973b31e77b1215
|
|
| BLAKE2b-256 |
56808b970721bb2c2c14618ecf95ac250d2e3dbc225974ceded575970ff07a70
|
File details
Details for the file opsveritas-0.3.1-py3-none-any.whl.
File metadata
- Download URL: opsveritas-0.3.1-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f120e932d23fa0e06cb7fc80a40ebd76a91607ddcad412b801f86db2b03faa3
|
|
| MD5 |
5b71c1ab45265a6ea0194ce8e003edaa
|
|
| BLAKE2b-256 |
414fc1ec42f621e9aa315817fd54e13c099b00102264079008063dac87d31825
|