Security and Data Handling
Mavvrik agent instrumentation collects the operational and financial telemetry required for cost attribution without requiring prompt or response text.
Data sent by the SDK
Telemetry can include:
|
Category |
Examples |
|---|---|
|
Mavvrik identity |
tenant ID, agent ID |
|
AI operation |
provider, model, operation/step type, success/failure |
|
Usage |
input/output tokens and other supported usage quantities |
|
Timing |
start time, end time, duration |
|
Trace identity |
trace, span, and session relationships |
|
Business context supplied by the application |
user ID, customer ID, application ID, use case, request ID, region |
|
Tags supplied by the application |
environment, team, product, channel, etc. |
|
Metered usage |
metric, quantity, unit, rate/provider metadata |
|
Prompt/response fingerprints |
one-way hashes used for repeated-pattern identification |
Prompt and response text
Prompt and response text is not required for standard agent cost reporting and is not sent by default.
The SDK records one-way fingerprints that can identify repeated content patterns without sending the original prompt or response.
If prompt/response content capture is required, enable it deliberately:
export MVK_LOG_PROMPTS_RESPONSES=true
Enabling content capture can export application or user content. Review the setting under the organization's privacy, security, and data-processing policies before enabling it in production.
Mask prompt and response content
When prompt/response content capture is enabled, masking is enabled by default before captured content leaves the application process.
Built-in masking covers common sensitive categories such as:
-
email addresses and US Social Security numbers;
-
payment-card numbers;
-
common OpenAI, Anthropic, and AWS credential formats.
Add organization-specific patterns with MVK_PROMPTS_MASKING_PATTERNS:
export MVK_PROMPTS_MASKING_PATTERNS='["MRN-\\d{7}","POL-[A-Z]{2}\\d{6}","\\bACC\\d{10}\\b"]'
Custom patterns are added to the built-in masking set. Invalid patterns are logged and skipped rather than disabling the remaining masking rules.
Masking applies to prompt/response content. It does not mask identity fields that the application explicitly supplies, such as user_email.
Masking can be disabled with:
export MVK_PROMPTS_MASKING=false
Disable masking only when permitted by the organization's security and data-handling policy. If content must not leave the process, leave prompt/response capture disabled instead.
Protect business-context data
Values supplied through mvk.context() or withMvkContext() become part of exported telemetry.
with mvk.context(
user_id="member-4821",
customer_id="customer-123",
session_id="session-456",
):
run_agent()
Use internal surrogate identifiers for regulated or external users where appropriate. Do not place names, access tokens, secrets, medical identifiers, payment data, or raw user content in context fields or tags unless explicitly permitted by the organization's data policy.
user_email is a real identifier. Use it only when the organization's data policy permits that value to be exported.
Configure tags safely
Use tags for low-cardinality reporting dimensions:
env=production
team=support
channel=web
product=claims
Do not put secrets, raw content, or unique sensitive business records in tags.
Protect the Mavvrik API key
The Mavvrik API key authenticates telemetry to Mavvrik. It does not grant access to AI-provider credentials.
export MVK_API_KEY="..."
Store the key in the deployment environment or secret manager. Do not hard-code it in application source or commit it to version control.
AI-provider credentials
Mavvrik SDK instrumentation does not require OpenAI, Anthropic, AWS, Google, or other provider credentials for normal observation. The application continues to authenticate directly with each provider.
Inspect the exported SDK payload
Use console mode to inspect telemetry locally before enabling export:
export MVK_EXPORTER_TYPE=console
export MVK_EXPORTER_FORMAT=json
Verify:
-
model and usage fields;
-
business context fields;
-
tags;
-
absence of prompt/response text when content capture is disabled;
-
masking behavior when content capture is enabled;
-
metered usage metadata.
Limit instrumentation scope
The SDK attaches to a published list of supported integrations. It is not a general-purpose application profiler.
mvk.instrument(wrappers={"include": ["genai"]})
or:
export MVK_WRAPPERS="openai,anthropic,langchain"
HTTP instrumentation is off by default. When explicitly enabled in Python, it is limited to supported httpx instrumentation and does not read request or response bodies.
Use MVK_HTTP_EXCLUSIONS to exclude hosts:
export MVK_HTTP_EXCLUSIONS='["internal-billing.corp","patient-records.internal"]'
Network requirements
Direct SDK export uses HTTPS to:
ingest.mavvrik.ai:443
Allow outbound HTTPS to this host for workloads using direct export.
Reliability behavior
Mavvrik instrumentation is designed to fail open so telemetry problems do not become application failures.
Runtime behavior includes:
-
asynchronous export outside the AI request path;
-
a bounded in-memory telemetry buffer of approximately 10 MB;
-
dropping telemetry rather than allowing the buffer to grow without bound;
-
retry with backoff for transient delivery failures;
-
local disk spill for batches that continue to fail;
-
backoff when the ingest endpoint remains unavailable.
An SDK or export failure can cause telemetry loss or delay. It should not change the result of the instrumented provider call.
For short-lived/serverless workloads, use the documented flush or serverless wrapper so buffered records have an opportunity to export before the process freezes or exits.
Disable tracking
export MVK_ENABLED=false
This disables SDK tracking without uninstalling the package.
Langfuse data handling
The Langfuse connection requires a public key, secret key, and HTTPS base URL. Mavvrik reads the model, usage, trace, and metadata fields documented in Connect Langfuse.
Do not store sensitive values in metadata used for agent identity or cost attribution.
LiteLLM data handling
LiteLLM export uses the endpoint and authentication values shown in the Mavvrik Connect flow. Per-agent attribution uses the supported LiteLLM metadata/header fields documented in Connect LiteLLM.
Do not place API secrets or sensitive user content in agent IDs, session IDs, or LiteLLM tags.
n8n data handling
Static and dynamic n8n context becomes part of exported telemetry. Apply the same data-handling rules used for SDK business context.
For publicly reachable webhooks, strip or validate untrusted trace and context headers at the edge when external callers must not influence internal trace or cost attribution.
Security review checklist
- API keys are stored outside source control.
- Agent, customer, user, and session identifiers are appropriate for telemetry export.
- Tags contain no secrets or raw sensitive content.
- Prompt/response text capture is disabled unless required and permitted.
- Custom masking patterns are configured where required before content capture is enabled.
- Console-mode payload has been reviewed in a non-production environment.
- Only required instrumentation is enabled.
- Direct-export workloads can reach
ingest.mavvrik.ai:443. - External request headers are filtered where they could influence attribution.
- Operators understand the
MVK_ENABLED=falsekill switch.